|
GNU Radio 3.3.0 C++ API
|
00001 /* -------------------------------------------------------------- */ 00002 /* (C)Copyright 2007 */ 00003 /* International Business Machines Corporation */ 00004 /* All Rights Reserved. */ 00005 /* */ 00006 /* Redistribution and use in source and binary forms, with or */ 00007 /* without modification, are permitted provided that the */ 00008 /* following conditions are met: */ 00009 /* */ 00010 /* - Redistributions of source code must retain the above copyright*/ 00011 /* notice, this list of conditions and the following disclaimer. */ 00012 /* */ 00013 /* - Redistributions in binary form must reproduce the above */ 00014 /* copyright notice, this list of conditions and the following */ 00015 /* disclaimer in the documentation and/or other materials */ 00016 /* provided with the distribution. */ 00017 /* */ 00018 /* - Neither the name of IBM Corporation nor the names of its */ 00019 /* contributors may be used to endorse or promote products */ 00020 /* derived from this software without specific prior written */ 00021 /* permission. */ 00022 /* */ 00023 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ 00024 /* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ 00025 /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 00026 /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ 00027 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ 00028 /* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ 00029 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ 00030 /* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ 00031 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ 00032 /* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ 00033 /* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ 00034 /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 00035 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00036 /* -------------------------------------------------------------- */ 00037 /* PROLOG END TAG zYx */ 00038 #ifndef __LIBSYNC_PPU_TRACEHOOKS_H__ 00039 #define __LIBSYNC_PPU_TRACEHOOKS_H__ 00040 00041 #ifdef LIBSYNC_TRACE 00042 00043 #include <trace_events.h> 00044 00045 /* 00046 * last parameter in the trace_even and trace_interval_entry call is 00047 * the stack level to report the PC in the trace record. so 0 means 00048 * the PC of the current frame, 1 means the PC of the caller, etc. 00049 * there's a dilemma here - these macros are included in the inline 00050 * _mutex calls which get called from the (created during build) 00051 * mutex functions in the mutex .c files. in that case, the level 00052 * should be 1 - we don't want the PC of where in the mutex function 00053 * the trace call is happening, we want the PC of whomever is calling 00054 * the mutex function. 00055 * 00056 * but.. an app can call the inline functions - it can #include the 00057 * appropriate libsync mutex .h files, and call the inlined _mutex 00058 * function in their code. in that case, the appropriate level for the 00059 * trace calls would be 0 - the user would want to know where in their 00060 * code the call to the _mutex function is. 00061 * 00062 * so, we'll assume _LEVEL of 0 which is what the inline funtions need. 00063 * when we build the files for libsync, we'll do a -D_LEVEL=1 00064 */ 00065 #ifndef _LEVEL 00066 #define _LEVEL 0 00067 #endif 00068 00069 00070 #define TRACE_EVENT_MUTEX_INIT 0x0003 00071 00072 #define TRACE_MUTEX_INIT(lock) { \ 00073 trace_payload_t payload; \ 00074 payload.dword[0]=(uint64_t)lock; \ 00075 trace_event(TRACE_EVENT_MUTEX_INIT, 1, &payload, "Event=%d, lock=0x%x",_LEVEL); \ 00076 } 00077 00078 #define TRACE_EVENT_MUTEX_LOCK 0x0103 00079 00080 #define TRACE_MUTEX_LOCK_ENTRY(_INTERVAL) \ 00081 trace_interval_p _INTERVAL = trace_interval_entry(TRACE_EVENT_MUTEX_LOCK, _LEVEL) 00082 00083 #define TRACE_MUTEX_LOCK_EXIT(_INTERVAL,lock,miss) { \ 00084 trace_payload_t payload; \ 00085 payload.dword[0]=(uint64_t)lock; \ 00086 payload.word[2]=(uint32_t)miss; \ 00087 trace_interval_exit(_INTERVAL, 2, &payload, "Event=%d, lock=0x%x, miss=0x%x"); \ 00088 } 00089 00090 #define TRACE_EVENT_MUTEX_TRYLOCK 0x0203 00091 00092 #define TRACE_MUTEX_TRYLOCK(lock,ret) { \ 00093 trace_payload_t payload; \ 00094 payload.dword[0]=(uint64_t)lock; \ 00095 payload.word[2]=(uint32_t)ret; \ 00096 trace_event(TRACE_EVENT_MUTEX_TRYLOCK, 2, &payload, "Event=%d, lock=0x%x, ret=0x%x", _LEVEL); \ 00097 } 00098 00099 #define TRACE_EVENT_MUTEX_UNLOCK 0x0303 00100 00101 #define TRACE_MUTEX_UNLOCK(lock) { \ 00102 trace_payload_t payload; \ 00103 payload.dword[0]=(uint64_t)lock; \ 00104 trace_event(TRACE_EVENT_MUTEX_UNLOCK, 1, &payload, "Event=%d, lock=0x%x", _LEVEL); \ 00105 } 00106 00107 #else /* LIBSYNC_TRACE */ 00108 00109 #define TRACE_MUTEX_INIT(lock) 00110 #define TRACE_MUTEX_LOCK_ENTRY(_INTERVAL) 00111 #define TRACE_MUTEX_LOCK_EXIT(_INTERVAL,lock,miss) 00112 #define TRACE_MUTEX_TRYLOCK(lock,ret_val) 00113 #define TRACE_MUTEX_UNLOCK(lock) 00114 00115 #endif /* LIBSYNC_TRACE */ 00116 00117 #endif /* __LIBSYNC_PPU_TRACEHOOKS_H__ */