1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/a3ftrace/inc/a3f_trace_utils.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,429 @@
1.4 +/*
1.5 +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +
1.24 +/**
1.25 + @file
1.26 + @internalTechnology
1.27 +*/
1.28 +
1.29 +#ifndef _A3F_TRACE_UTILS_H_
1.30 +#define _A3F_TRACE_UTILS_H_
1.31 +
1.32 +// INCLUDES
1.33 +#include <a3f/a3f_trace_types.h>
1.34 +
1.35 +#define DP_ASSERT(_assertion) __DP_ASSERT_DBG(_assertion)
1.36 +
1.37 +
1.38 +#ifdef _DEBUG
1.39 +
1.40 + #ifndef DISABLE_SYNTAX_CHECK
1.41 + #define _MARK_ENTRY() _dc.inOk=ETrue
1.42 + #define _DOINCHK() _dc.DoInChk()
1.43 + #define _CHK_MULTIIN() _dc.ChkMultiIn()
1.44 + #define _CHK_MULTIOUT() _dc.ChkMultiOut()
1.45 + #define _MARK_EXIT() _dc.outOk=ETrue
1.46 + #else
1.47 + #define _MARK_ENTRY()
1.48 + #define _DOINCHK()
1.49 + #define _CHK_MULTIIN()
1.50 + #define _CHK_MULTIOUT()
1.51 + #define _MARK_EXIT()
1.52 + #endif // DISABLE_SYNTAX_CHECK
1.53 +
1.54 + #ifndef DISABLE_GROUP_CHECKS
1.55 + #include <a3f/a3f_trace_heap.h>
1.56 + #define _CHK_GRP() if ( (!TraceHeap::IsMaskOn(TRACENFO[_dc.iId].iGrpId)) || ((!_dc.iApi) && TraceHeap::IsApiOnly()) ) { break; }
1.57 + #define _CREATE_MASK() TRAP_IGNORE(TraceHeap::CreateL(CtxDefaultGroups))
1.58 + #define _CHK_LEVEL(level) if ( TraceHeap::IsBelowLevel(level) ) { break; }
1.59 + #else
1.60 + #define _CHK_GRP()
1.61 + #define _CREATE_MASK()
1.62 + #define _CHK_LEVEL(level)
1.63 + #endif // DISABLE_GROUP_CHECKS
1.64 +
1.65 + #ifdef SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
1.66 +
1.67 + #ifndef __KERNEL_MODE__
1.68 + #define DP_CONTEXT(_fn, _id, _vis) _TTraceCtx _dc((TText*)L ## #_fn, _id, _vis, (TUint)this)
1.69 + #define DP_STATIC_CONTEXT(_fn, _id, _vis) _CREATE_MASK(); _TTraceCtx _dc((TText*)L ## #_fn, _id, _vis, 0)
1.70 +
1.71 + #define DP_IN() do { _CHK_GRP(); _CHK_MULTIIN(); _DPPRINTER(_T(L ## "%s%d[%x:%x]>%s "), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn); _MARK_ENTRY(); } while(0)
1.72 + #define DP0_IN(string) do { _CHK_GRP(); _CHK_MULTIIN(); _DPPRINTER(_T(L ## "%s%d[%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn); _MARK_ENTRY(); } while(0)
1.73 + #define DP1_IN(string, p1) do { _CHK_GRP(); _CHK_MULTIIN(); _DPPRINTER(_T(L ## "%s%d[%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1); _MARK_ENTRY(); } while(0)
1.74 + #define DP2_IN(string, p1, p2) do { _CHK_GRP(); _CHK_MULTIIN(); _DPPRINTER(_T(L ## "%s%d[%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2); _MARK_ENTRY(); } while(0)
1.75 + #define DP3_IN(string, p1, p2, p3) do { _CHK_GRP(); _CHK_MULTIIN(); _DPPRINTER(_T(L ## "%s%d[%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3); _MARK_ENTRY(); } while(0)
1.76 + #define DP4_IN(string, p1, p2, p3, p4) do { _CHK_GRP(); _CHK_MULTIIN(); _DPPRINTER(_T(L ## "%s%d[%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4); _MARK_ENTRY(); } while(0)
1.77 + #define DP5_IN(string, p1, p2, p3, p4, p5) do { _CHK_GRP(); _CHK_MULTIIN(); _DPPRINTER(_T(L ## "%s%d[%x:%x]>%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4, p5); _MARK_ENTRY(); } while(0)
1.78 +
1.79 + #define DP_OUT() do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s "), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn); _MARK_EXIT(); } while(0)
1.80 + #define DP0_OUT(string) do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn); _MARK_EXIT(); } while(0)
1.81 + #define DP1_OUT(string, p1) do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1); _MARK_EXIT(); } while(0)
1.82 + #define DP2_OUT(string, p1, p2) do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2); _MARK_EXIT(); } while(0)
1.83 + #define DP3_OUT(string, p1, p2, p3) do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3); _MARK_EXIT(); } while(0)
1.84 + #define DP4_OUT(string, p1, p2, p3, p4) do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4); _MARK_EXIT(); } while(0)
1.85 + #define DP5_OUT(string, p1, p2, p3, p4, p5) do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4, p5); _MARK_EXIT(); } while(0)
1.86 +
1.87 + #define DP0_RET(val, fmtstr) do { do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val); _MARK_EXIT(); } while(0); return val;} while(0)
1.88 + #define DP1_RET(val, fmtstr, p1) do { do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1); _MARK_EXIT(); } while(0); return val;} while(0)
1.89 + #define DP2_RET(val, fmtstr, p1, p2) do { do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1, p2); _MARK_EXIT(); } while(0); return val;} while(0)
1.90 + #define DP3_RET(val, fmtstr, p1, p2, p3) do { do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1, p2, p3); _MARK_EXIT(); } while(0); return val;} while(0)
1.91 + #define DP4_RET(val, fmtstr, p1, p2, p3, p4) do { do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1, p2, p3, p4); _MARK_EXIT(); } while(0); return val;} while(0)
1.92 + #define DP5_RET(val, fmtstr, p1, p2, p3, p4, p5) do { do { _CHK_GRP(); _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s " L ## fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1, p2, p3, p4, p5); _MARK_EXIT(); } while(0); return val;} while(0)
1.93 +
1.94 + #define DP0(level, string) do { _CHK_GRP(); _CHK_LEVEL(level); _DOINCHK(); _DPPRINTER(_T(L ## "%s%d[%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn); } while(0)
1.95 + #define DP1(level, string, p1) do { _CHK_GRP(); _CHK_LEVEL(level); _DOINCHK(); _DPPRINTER(_T(L ## "%s%d[%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1); } while(0)
1.96 + #define DP2(level, string, p1, p2) do { _CHK_GRP(); _CHK_LEVEL(level); _DOINCHK(); _DPPRINTER(_T(L ## "%s%d[%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2); } while(0)
1.97 + #define DP3(level, string, p1, p2, p3) do { _CHK_GRP(); _CHK_LEVEL(level); _DOINCHK(); _DPPRINTER(_T(L ## "%s%d[%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3); } while(0)
1.98 + #define DP4(level, string, p1, p2, p3, p4) do { _CHK_GRP(); _CHK_LEVEL(level); _DOINCHK(); _DPPRINTER(_T(L ## "%s%d[%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4); } while(0)
1.99 + #define DP5(level, string, p1, p2, p3, p4, p5) do { _CHK_GRP(); _CHK_LEVEL(level); _DOINCHK(); _DPPRINTER(_T(L ## "%s%d[%x:%x]%s " L ## string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4, p5); } while(0)
1.100 +
1.101 + #define __DP_ASSERT_DBG( _assertion ) do { if( _assertion ) { break; } TFileName file; file.Copy( _L8( __FILE__ ) ); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s Assert:%S:%d:" L ## #_assertion) , _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, &file, __LINE__ ); User::Invariant(); } while( 0 )
1.102 +
1.103 + #define __TRACE_ASSERT_DBG(_assertion, _textToPrint, _panicCode) do { if (_assertion) { break; } _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s ASSERTION FAILED!!! %s file: %s, line: %s"), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, _textToPrint, __FILE__, __LINE__); User::Panic(_L("AssertionFailed"), _panicCode} while(0)
1.104 +
1.105 + #else // __KERNEL_MODE__
1.106 + #define DP_CONTEXT(_fn, _id, _vis) _TTraceCtx _dc((TText*) #_fn, _id, _vis, (TUint)this )
1.107 + #define DP_STATIC_CONTEXT(_fn, _id, _vis) _TTraceCtx _dc((TText*) #_fn, _id, _vis, 0)
1.108 +
1.109 + // NOTE: no trace mask checks in kernel code (no access to shared heap)
1.110 + #define DP_IN() do { _CHK_MULTIIN(); _DPPRINTER(_T("%s%d[%x:%x]>%s "), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn); _MARK_ENTRY(); } while(0)
1.111 + #define DP0_IN(string) do { _CHK_MULTIIN(); _DPPRINTER(_T("%s%d[%x:%x]>%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn); _MARK_ENTRY(); } while(0)
1.112 + #define DP1_IN(string, p1) do { _CHK_MULTIIN(); _DPPRINTER(_T("%s%d[%x:%x]>%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1); _MARK_ENTRY(); } while(0)
1.113 + #define DP2_IN(string, p1, p2) do { _CHK_MULTIIN(); _DPPRINTER(_T("%s%d[%x:%x]>%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2); _MARK_ENTRY(); } while(0)
1.114 + #define DP3_IN(string, p1, p2, p3) do { _CHK_MULTIIN(); _DPPRINTER(_T("%s%d[%x:%x]>%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3); _MARK_ENTRY(); } while(0)
1.115 + #define DP4_IN(string, p1, p2, p3, p4) do { _CHK_MULTIIN(); _DPPRINTER(_T("%s%d[%x:%x]>%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4); _MARK_ENTRY(); } while(0)
1.116 + #define DP5_IN(string, p1, p2, p3, p4, p5) do { _CHK_MULTIIN(); _DPPRINTER(_T("%s%d[%x:%x]>%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4, p5); _MARK_ENTRY(); } while(0)
1.117 +
1.118 + #define DP_OUT() do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s "), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn); _MARK_EXIT(); } while(0)
1.119 + #define DP0_OUT(string) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn); _MARK_EXIT(); } while(0)
1.120 + #define DP1_OUT(string, p1) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1); _MARK_EXIT(); } while(0)
1.121 + #define DP2_OUT(string, p1, p2) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2); _MARK_EXIT(); } while(0)
1.122 + #define DP3_OUT(string, p1, p2, p3) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3); _MARK_EXIT(); } while(0)
1.123 + #define DP4_OUT(string, p1, p2, p3, p4) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4); _MARK_EXIT(); } while(0)
1.124 + #define DP5_OUT(string, p1, p2, p3, p4, p5) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " string), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4, p5); _MARK_EXIT(); } while(0)
1.125 +
1.126 + #define DP0_RET(val, fmtstr) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val); _MARK_EXIT(); return val; } while(0)
1.127 + #define DP1_RET(val, fmtstr, p1) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1); _MARK_EXIT(); return val; } while(0)
1.128 + #define DP2_RET(val, fmtstr, p1, p2) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1, p2); _MARK_EXIT(); return val; } while(0)
1.129 + #define DP3_RET(val, fmtstr, p1, p2, p3) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1, p2, p3); _MARK_EXIT(); return val; } while(0)
1.130 + #define DP4_RET(val, fmtstr, p1, p2, p3, p4) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1, p2, p3, p4); _MARK_EXIT(); return val; } while(0)
1.131 + #define DP5_RET(val, fmtstr, p1, p2, p3, p4, p5) do { _DOINCHK(); _CHK_MULTIOUT(); _DPPRINTER(_T("%s%d[%x:%x]<%s " fmtstr), _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, val, p1, p2, p3, p4, p5); _MARK_EXIT(); return val; } while(0)
1.132 +
1.133 + #define DP0(level, string) do { _DOINCHK(); _DPPRINTER(_T("%s%d[%x:%x]%s " string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn); } while(0)
1.134 + #define DP1(level, string, p1) do { _DOINCHK(); _DPPRINTER(_T("%s%d[%x:%x]%s " string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1); } while(0)
1.135 + #define DP2(level, string, p1, p2) do { _DOINCHK(); _DPPRINTER(_T("%s%d[%x:%x]%s " string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2); } while(0)
1.136 + #define DP3(level, string, p1, p2, p3) do { _DOINCHK(); _DPPRINTER(_T("%s%d[%x:%x]%s " string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3); } while(0)
1.137 + #define DP4(level, string, p1, p2, p3, p4) do { _DOINCHK(); _DPPRINTER(_T("%s%d[%x:%x]%s " string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4); } while(0)
1.138 + #define DP5(level, string, p1, p2, p3, p4, p5) do { _DOINCHK(); _DPPRINTER(_T("%s%d[%x:%x]%s " string), _dc.iVis, level, _dc.iId, _dc.iAddr, _dc.iFn, p1, p2, p3, p4, p5); } while(0)
1.139 +
1.140 + #define __DP_ASSERT_DBG( _assertion ) do { if( _assertion ) { break; } TFileName file; file.Copy( _L8( __FILE__ ) ); _DPPRINTER(_T(L ## "%s%d[%x:%x]<%s Assert:%S:%d:" L ## #_assertion) , _dc.iVis, _dc.iCategory, _dc.iId, _dc.iAddr, _dc.iFn, &file, __LINE__ ); User::Invariant(); } while( 0 )
1.141 +
1.142 + #define __TRACE_ASSERT_DBG(_assertion, _textToPrint, _panicCode) do { if (_assertion) { break; } _DPPRINTER(_T("%s[%x:%x:%d]<%s ASSERTION FAILED!!! %s file: %s, line: %s"), _dc.iVis, _dc.iId, _dc.iAddr, _dc.iFn, _textToPrint, __FILE__, __LINE__); User::Panic(_L("AssertionFailed"), _panicCode} while(0)
1.143 +
1.144 + #endif // __KERNEL_MODE__
1.145 +
1.146 + #define BIND_TRACE_TRAPHANDLER() _TTraceTrapHandler _traceTrapHandler; _traceTrapHandler.oldHandler = User::SetTrapHandler(&_traceTrapHandler)
1.147 + #define TRACE_CREATE() _CREATE_MASK();
1.148 + #define TRACE_FAST_CREATE(_thdId) _CREATE_MASK();
1.149 +
1.150 + #else // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
1.151 +
1.152 + #define DP_CONTEXT(_fn, _id, _vis)
1.153 + #define DP_STATIC_CONTEXT(_fn, _id, _vis)
1.154 +
1.155 + #define DP_IN()
1.156 + #define DP0_IN(string)
1.157 + #define DP1_IN(string, p1)
1.158 + #define DP2_IN(string, p1, p2)
1.159 + #define DP3_IN(string, p1, p2, p3)
1.160 + #define DP4_IN(string, p1, p2, p3, p4)
1.161 + #define DP5_IN(string, p1, p2, p3, p4, p5)
1.162 +
1.163 + #define DP_OUT()
1.164 + #define DP0_OUT(string)
1.165 + #define DP1_OUT(string, p1)
1.166 + #define DP2_OUT(string, p1, p2)
1.167 + #define DP3_OUT(string, p1, p2, p3)
1.168 + #define DP4_OUT(string, p1, p2, p3, p4)
1.169 + #define DP5_OUT(string, p1, p2, p3, p4, p5)
1.170 +
1.171 + #define DP0_RET(val, fmtstr) return val
1.172 + #define DP1_RET(val, fmtstr, p1) return val
1.173 + #define DP2_RET(val, fmtstr, p1, p2) return val
1.174 + #define DP3_RET(val, fmtstr, p1, p2, p3) return val
1.175 + #define DP4_RET(val, fmtstr, p1, p2, p3, p4) return val
1.176 + #define DP5_RET(val, fmtstr, p1, p2, p3, p4, p5) return val
1.177 +
1.178 + #define DP0(level, string)
1.179 + #define DP1(level, string, p1)
1.180 + #define DP2(level, string, p1, p2)
1.181 + #define DP3(level, string, p1, p2, p3)
1.182 + #define DP4(level, string, p1, p2, p3, p4)
1.183 + #define DP5(level, string, p1, p2, p3, p4, p5)
1.184 +
1.185 + #define __DP_ASSERT_DBG( _assertion )
1.186 + #define __TRACE_ASSERT_DBG(_assertion, _textToPrint, _panicCode)
1.187 +
1.188 + #define BIND_TRACE_TRAPHANDLER()
1.189 + #define TRACE_CREATE()
1.190 + #define TRACE_FAST_CREATE(_thdId) _thdId++;
1.191 +
1.192 + #endif // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
1.193 +
1.194 +#else // _DEBUG
1.195 +
1.196 + /**
1.197 + * Creates a trace context for traceable function. This variant is used with instance functions (methods).
1.198 + * Parameter @a _fn defines the name of the function (method) to trace. @_id defines the group where this trace entry belongs.
1.199 + * For full list of available trace contexts, see file a3f_trace_ctxt.h. Parameter @a _vis defines the visibility this context is having.
1.200 + * Methods with IMPORT_C / EXPORT_C definitions are marked as DPAPI, others have signature DPLOCAL. \n\n
1.201 + * Usage example:
1.202 + * @code
1.203 + * DP_CONTEXT(CFoo::Bar, CtxTest, DPLOCAL);
1.204 + * @endcode
1.205 + */
1.206 + #define DP_CONTEXT(_fn, _id, _vis)
1.207 +
1.208 + /**
1.209 + * Creates a trace context for traceable function. This variant is used with plain functions and static methods.
1.210 + * Parameter @a _fn defines the name of the function (method) to trace. @_id defines the group where this trace entry belongs.
1.211 + * For full list of available trace contexts, see file a3f_trace_ctxt.h. Parameter @a _vis defines the visibility this context is having.
1.212 + * Methods / functions with IMPORT_C / EXPORT_C definitions are marked as DPAPI, others have signature DPLOCAL.
1.213 + * Parameter @a _thdId is a name for a variable to create when thread id is queried from kernel. Later in the code you can use this
1.214 + * variable e.g. to instantiate other trace enabled classes.\n\n
1.215 + * Usage example:
1.216 + * @code
1.217 + * DP_CONTEXT(FooBar, CtxTest, DPAPI, thdId);
1.218 + * ...
1.219 + * TRACE_FAST_CREATE(thdId);
1.220 + * @endcode
1.221 + */
1.222 + #define DP_STATIC_CONTEXT(_fn, _id, _vis)
1.223 +
1.224 + /**
1.225 + * Using the defined trace context, outputs method entry information into traces.
1.226 + * <b> NOTE: Trace context must be defined before this method can be used.</b>
1.227 + * Trace context can be defined using either DP_CONTEXT or DP_STATIC_CONTEXT
1.228 + */
1.229 + #define DP_IN()
1.230 + #define DP0_IN(string)
1.231 + #define DP1_IN(string, p1)
1.232 + #define DP2_IN(string, p1, p2)
1.233 + #define DP3_IN(string, p1, p2, p3)
1.234 + #define DP4_IN(string, p1, p2, p3, p4)
1.235 + #define DP5_IN(string, p1, p2, p3, p4, p5)
1.236 +
1.237 + #define DP_OUT()
1.238 + #define DP0_OUT(string)
1.239 + #define DP1_OUT(string, p1)
1.240 + #define DP2_OUT(string, p1, p2)
1.241 + #define DP3_OUT(string, p1, p2, p3)
1.242 + #define DP4_OUT(string, p1, p2, p3, p4)
1.243 + #define DP5_OUT(string, p1, p2, p3, p4, p5)
1.244 +
1.245 + #define DP0_RET(val, fmtstr) return val
1.246 + #define DP1_RET(val, fmtstr, p1) return val
1.247 + #define DP2_RET(val, fmtstr, p1, p2) return val
1.248 + #define DP3_RET(val, fmtstr, p1, p2, p3) return val
1.249 + #define DP4_RET(val, fmtstr, p1, p2, p3, p4) return val
1.250 + #define DP5_RET(val, fmtstr, p1, p2, p3, p4, p5) return val
1.251 +
1.252 + #define DP0(level, string)
1.253 + #define DP1(level, string, p1)
1.254 + #define DP2(level, string, p1, p2)
1.255 + #define DP3(level, string, p1, p2, p3)
1.256 + #define DP4(level, string, p1, p2, p3, p4)
1.257 + #define DP5(level, string, p1, p2, p3, p4, p5)
1.258 +
1.259 + #define BIND_TRACE_TRAPHANDLER()
1.260 + #define TRACE_FAST_CREATE(_thdId) _thdId++;
1.261 + #define TRACE_CREATE()
1.262 +
1.263 + #define __DP_ASSERT_DBG(_assertion)
1.264 + #define __TRACE_ASSERT_DBG(_assertion, _message, _panicCode )
1.265 +
1.266 +#endif // _DEBUG
1.267 +
1.268 +#define PERF_IN_USE
1.269 +
1.270 +//performance trace categories
1.271 +#define PRF_NONE 0x0000
1.272 +#define PRF_TIME 0x0001
1.273 +#define PRF_LOAD 0x0002
1.274 +#define PRF_MEM 0x0004
1.275 +
1.276 +//performance trace actions
1.277 +#define PRF_START 1
1.278 +#define PRF_STOP 0
1.279 +
1.280 +#define PRF_ID 1
1.281 +#define PRF_NO_ID 0
1.282 +
1.283 +//active categories
1.284 +#define PRF_CATEGORIES ( PRF_TIME | PRF_LOAD | PRF_MEM )
1.285 +
1.286 +#ifdef SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
1.287 +
1.288 + #ifndef __KERNEL_MODE__
1.289 + #ifdef ASW_PERF_TRACES_ENABLED
1.290 + #define _T(a) (TPtrC((const TText *)(a)))
1.291 + #define PRF_PRINT RDebug::Print
1.292 +
1.293 + #define PRF(id, action, category, event, string); \
1.294 + do { \
1.295 + if (category == (TUint16)(PRF_CATEGORIES & category))\
1.296 + {\
1.297 + if (PRF_NO_ID == id) \
1.298 + {\
1.299 + PRF_PRINT(_L("e_[]%s %d"), (TText*)L ## # event, action); \
1.300 + }\
1.301 + else \
1.302 + {\
1.303 + RThread thdIdGeneral; \
1.304 + if ("" == string) \
1.305 + {\
1.306 + PRF_PRINT(_L("e_[%x:%x]%s %d"), \
1.307 + category, (TInt)thdIdGeneral.Id(), this, (TText*)L ## # event, action); \
1.308 + }\
1.309 + else \
1.310 + {\
1.311 + PRF_PRINT(_L("e_[%x:%x]%s %d, %s"), \
1.312 + category, (TInt)thdIdGeneral.Id(), this, (TText*)L ## # event, action, \
1.313 + (TText*)L ## # string); \
1.314 + }\
1.315 + }\
1.316 + }\
1.317 + } while(0)
1.318 +
1.319 + #define PRF1(id, action, category, event, string, p1); \
1.320 + do { \
1.321 + if (category == (TUint16)(PRF_CATEGORIES & category))\
1.322 + {\
1.323 + RThread thdId; \
1.324 + PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
1.325 + category, (TInt)thdId.Id(), this, L ## # event, action, p1); \
1.326 + }\
1.327 + } while(0)
1.328 +
1.329 + #define PRF2(id, action, category, event, string, p1, p2); \
1.330 + do { \
1.331 + if (category == (TUint16)(PRF_CATEGORIES & category))\
1.332 + {\
1.333 + RThread thdId; \
1.334 + PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
1.335 + category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2); \
1.336 + }\
1.337 + } while(0)
1.338 +
1.339 + #define PRF3(id, action, category, event, string, p1, p2, p3); \
1.340 + do { \
1.341 + if (category == (TUint16)(PRF_CATEGORIES & category))\
1.342 + {\
1.343 + RThread thdId; \
1.344 + PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
1.345 + category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2, p3); \
1.346 + }\
1.347 + } while(0)
1.348 +
1.349 + #define PRF4(id, action, category, event, string, p1, p2, p3, p4); \
1.350 + do { \
1.351 + if (category == (TUint16)(PRF_CATEGORIES & category))\
1.352 + {\
1.353 + RThread thdId; \
1.354 + PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
1.355 + category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2, p3, p4); \
1.356 + }\
1.357 + } while(0)
1.358 +
1.359 + #define PRF5(id, action, category, event, string, p1, p2, p3, p4, p5); \
1.360 + do { \
1.361 + if (category == (TUint16)(PRF_CATEGORIES & category))\
1.362 + {\
1.363 + RThread thdId; \
1.364 + PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
1.365 + category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2, p3, p4, p5); \
1.366 + }\
1.367 + } while(0)
1.368 +
1.369 + #define PRF_TEST(event, string, param); \
1.370 + PRF_PRINT(_L("string: %s, param %d, " ## string), \
1.371 + (TText*)L ## # event, param); \
1.372 +
1.373 + #define PRF_HEAP_STATUS(category, component); \
1.374 + do { \
1.375 + if(category == (TUint16)(PRF_CATEGORIES & category )) \
1.376 + { \
1.377 + TInt cellsFree(0); \
1.378 + TInt cellsAllocated = User::CountAllocCells( cellsFree ); \
1.379 + TInt bytesAllocated(0); \
1.380 + TInt cellsAllocatedInHeap = User::AllocSize( bytesAllocated ); \
1.381 + TInt bytesInLargestFreeBlock(0); \
1.382 + TInt bytesAvailable = User::Available(bytesInLargestFreeBlock); \
1.383 + PRF_PRINT(_L("[%x:%x]%s cellsFree=%d, cellsAllocated=%d, bytesAllocated=%d, cellsAllocatedInHeap=%d, bytesInLargestFreeBlock=%d, bytesAvailable=%d"), \
1.384 + category, this, (TText*)L ## # component, \
1.385 + cellsFree, cellsAllocated, bytesAllocated, cellsAllocatedInHeap, \
1.386 + bytesInLargestFreeBlock, bytesAvailable); \
1.387 + } \
1.388 + } while(0)
1.389 + #else
1.390 + #define PRF(id, action, category, event, string);
1.391 + #define PRF1(id, action, category, event, string, p1);
1.392 + #define PRF2(id, action, category, event, string, p1, p2);
1.393 + #define PRF3(id, action, category, event, string, p1, p2, p3);
1.394 + #define PRF4(id, action, category, event, string, p1, p2, p3, p4);
1.395 + #define PRF5(id, action, category, event, string, p1, p2, p3, p4, p5);
1.396 + #define PRF_HEAP_STATUS(category, component);
1.397 +
1.398 + #endif //ASW_PERF_TRACES_ENABLED
1.399 + #endif //__KERNEL_MODE__
1.400 +
1.401 +#else // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
1.402 +
1.403 + #define PRF_PRINT
1.404 +
1.405 + #define PRF(id, action, category, event, string);
1.406 + #define PRF1(id, action, category, event, string, p1);
1.407 + #define PRF2(id, action, category, event, string, p1, p2);
1.408 + #define PRF3(id, action, category, event, string, p1, p2, p3);
1.409 + #define PRF4(id, action, category, event, string, p1, p2, p3, p4);
1.410 + #define PRF5(id, action, category, event, string, p1, p2, p3, p4, p5);
1.411 + #define PRF_HEAP_STATUS(category, component);
1.412 +
1.413 +#endif // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
1.414 +
1.415 +// DATA TYPES
1.416 +//enum ?declaration
1.417 +//typedef ?declaration
1.418 +//extern ?data_type;
1.419 +
1.420 +// FUNCTION PROTOTYPES
1.421 +//?type ?function_name(?arg_list);
1.422 +
1.423 +// FORWARD DECLARATIONS
1.424 +//class ?FORWARD_CLASSNAME;
1.425 +
1.426 +// CLASS DECLARATION
1.427 +
1.428 +
1.429 +
1.430 +#endif // _A3F_TRACE_UTILS_H_
1.431 +
1.432 +// End of File