1 /***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Networks nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
45 #ifndef __CVMX_LOG_H__
46 #define __CVMX_LOG_H__
51 * cvmx-log supplies a fast log buffer implementation. Each core writes
52 * log data to a differnet buffer to avoid synchronization overhead. Function
53 * call logging can be turned on with the GCC option "-pg".
55 * <hr>$Revision: 49448 $<hr>
63 * Add CVMX_LOG_DISABLE_PC_LOGGING as an attribute to and function prototype
64 * that you don't want logged when the gcc option "-pg" is supplied. We
65 * use it on the cvmx-log functions since it is pointless to log the
66 * calling of a function than in itself writes to the log.
68 #define CVMX_LOG_DISABLE_PC_LOGGING __attribute__((no_instrument_function))
71 * Log a constant printf style format string with 0 to 4
72 * arguments. The string must persist until the log is read,
73 * but the parameters are copied into the log.
75 * @param format Constant printf style format string.
76 * @param numberx 64bit argument to the printf format string
78 void cvmx_log_printf0(const char *format) CVMX_LOG_DISABLE_PC_LOGGING;
79 void cvmx_log_printf1(const char *format, uint64_t number1) CVMX_LOG_DISABLE_PC_LOGGING;
80 void cvmx_log_printf2(const char *format, uint64_t number1, uint64_t number2) CVMX_LOG_DISABLE_PC_LOGGING;
81 void cvmx_log_printf3(const char *format, uint64_t number1, uint64_t number2, uint64_t number3) CVMX_LOG_DISABLE_PC_LOGGING;
82 void cvmx_log_printf4(const char *format, uint64_t number1, uint64_t number2, uint64_t number3, uint64_t number4) CVMX_LOG_DISABLE_PC_LOGGING;
85 * Log an arbitrary block of 64bit words. At most 255 64bit
86 * words can be logged. The words are copied into the log.
88 * @param size_in_dwords
89 * Number of 64bit dwords to copy into the log.
90 * @param data Array of 64bit dwords to copy
92 void cvmx_log_data(uint64_t size_in_dwords, const uint64_t *data) CVMX_LOG_DISABLE_PC_LOGGING;
95 * Log a structured data object. Post processing will use the
96 * debugging information in the ELF file to determine how to
97 * display the structure. Max of 2032 bytes.
100 * cvmx_log_structure("cvmx_wqe_t", work, sizeof(*work));
102 * @param type C typedef expressed as a string. This will be used to
103 * lookup the structure in the debugging infirmation.
104 * @param data Data to be written to the log.
105 * @param size_in_bytes
106 * Size if the data in bytes. Normally you'll use the
107 * sizeof() operator here.
109 void cvmx_log_structure(const char *type, void *data, int size_in_bytes) CVMX_LOG_DISABLE_PC_LOGGING;
112 * Setup the mips performance counters
114 * @param counter1 Event type for counter 1
115 * @param counter2 Event type for counter 2
117 void cvmx_log_perf_setup(cvmx_core_perf_t counter1, cvmx_core_perf_t counter2);
120 * Log the performance counters
122 void cvmx_log_perf(void) CVMX_LOG_DISABLE_PC_LOGGING;
125 * Display the current log in a human readable format.
127 void cvmx_log_display(void);