OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2007-2009 NVIDIA Corporation. |
| 3 * All rights reserved. |
| 4 * |
| 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: |
| 7 * |
| 8 * Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. |
| 10 * |
| 11 * Redistributions in binary form must reproduce the above copyright notice, |
| 12 * this list of conditions and the following disclaimer in the documentation |
| 13 * and/or other materials provided with the distribution. |
| 14 * |
| 15 * Neither the name of the NVIDIA Corporation nor the names of its contributors |
| 16 * may be used to endorse or promote products derived from this software |
| 17 * without specific prior written permission. |
| 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 * POSSIBILITY OF SUCH DAMAGE. |
| 30 * |
| 31 */ |
| 32 |
| 33 #ifndef INCLUDED_NVOS_TRACE_H |
| 34 #define INCLUDED_NVOS_TRACE_H |
| 35 |
| 36 #define NVOS_TRACE 0 |
| 37 |
| 38 #ifdef __cplusplus |
| 39 extern "C" |
| 40 { |
| 41 #endif /* __cplusplus */ |
| 42 |
| 43 /** |
| 44 * The nvos_trace.txt is a nvos trace file to collect aggregate statistics |
| 45 * about how system calls and resources are used in higher-level software. |
| 46 * It has format: |
| 47 * NvOsFunctionName , CallingFile , CallingLine , CallTime , Data |
| 48 * NvOsFunctionName is the function name |
| 49 * CallingFile and CallingLine are just the __FILE__ and __LINE__ parameters. |
| 50 * CallTime is a NvU32 storing time in miliseconds. |
| 51 * Data is a function-specific data parameter. For MutexLock and MutexUnlock |
| 52 * this would be the mutex handle. For NvOsAlloc * and NvOsFree this |
| 53 * would be the allocated address. |
| 54 * |
| 55 */ |
| 56 |
| 57 /** |
| 58 * opens the trace file nvos_trace.txt |
| 59 * |
| 60 * This function should be called via a macro so that it may be compiled out. |
| 61 * |
| 62 */ |
| 63 void |
| 64 NvOsTraceLogStart(void); |
| 65 |
| 66 /** |
| 67 * closes the trace file nvos_trace.txt. |
| 68 * |
| 69 * This function should be called via a macro so that it may be compiled out. |
| 70 */ |
| 71 void |
| 72 NvOsTraceLogEnd(void); |
| 73 |
| 74 /** |
| 75 * emits a string to the trace file nvos_trace.txt |
| 76 * |
| 77 * @param format Printf style argument format string |
| 78 * |
| 79 * This function should be called via a macro so that it may be compiled out. |
| 80 * |
| 81 */ |
| 82 void |
| 83 NvOsTraceLogPrintf( const char *format, ... ); |
| 84 |
| 85 /** |
| 86 * Helper macro to go along with NvOsTraceLogPrintf. Usage: |
| 87 * NVOS_TRACE_LOG_PRINTF(("foo: %s\n", bar)); |
| 88 * The NvOs trace log prints will be disabled by default in all builds, debug |
| 89 * and release. |
| 90 * Note the use of double parentheses. |
| 91 * |
| 92 * To enable NvOs trace log prints |
| 93 * #define NVOS_TRACE 1 |
| 94 */ |
| 95 #if NVOS_TRACE |
| 96 #define NVOS_TRACE_LOG_PRINTF(a) NvOsTraceLogPrintf a |
| 97 #define NVOS_TRACE_LOG_START \ |
| 98 do { \ |
| 99 NvOsTraceLogStart(); \ |
| 100 } while (0); |
| 101 #define NVOS_TRACE_LOG_END \ |
| 102 do { \ |
| 103 NvOsTraceLogEnd(); \ |
| 104 } while (0); |
| 105 #else |
| 106 #define NVOS_TRACE_LOG_PRINTF(a) (void)0 |
| 107 #define NVOS_TRACE_LOG_START (void)0 |
| 108 #define NVOS_TRACE_LOG_END (void)0 |
| 109 #endif |
| 110 |
| 111 #ifdef __cplusplus |
| 112 } |
| 113 #endif /* __cplusplus */ |
| 114 |
| 115 #endif /* NVOS_TRACE_H */ |
| 116 |
OLD | NEW |