devsound/a3ftrace/inc/a3f_trace_utils.h
changeset 0 b8ed18f6c07b
equal deleted inserted replaced
-1:000000000000 0:b8ed18f6c07b
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalTechnology
       
    24 */
       
    25 
       
    26 #ifndef _A3F_TRACE_UTILS_H_
       
    27 #define _A3F_TRACE_UTILS_H_
       
    28 
       
    29 //  INCLUDES
       
    30 #include <a3f/a3f_trace_types.h>
       
    31 
       
    32 #define DP_ASSERT(_assertion)  __DP_ASSERT_DBG(_assertion)
       
    33 
       
    34 
       
    35 #ifdef _DEBUG
       
    36 
       
    37     #ifndef DISABLE_SYNTAX_CHECK
       
    38         #define _MARK_ENTRY() _dc.inOk=ETrue
       
    39         #define _DOINCHK() _dc.DoInChk()
       
    40         #define _CHK_MULTIIN() _dc.ChkMultiIn()
       
    41         #define _CHK_MULTIOUT() _dc.ChkMultiOut()
       
    42         #define _MARK_EXIT() _dc.outOk=ETrue
       
    43     #else
       
    44         #define _MARK_ENTRY()
       
    45         #define _DOINCHK()
       
    46         #define _CHK_MULTIIN()
       
    47         #define _CHK_MULTIOUT()
       
    48         #define _MARK_EXIT()
       
    49     #endif // DISABLE_SYNTAX_CHECK
       
    50 
       
    51     #ifndef DISABLE_GROUP_CHECKS
       
    52         #include <a3f/a3f_trace_heap.h>
       
    53         #define _CHK_GRP() if ( (!TraceHeap::IsMaskOn(TRACENFO[_dc.iId].iGrpId)) || ((!_dc.iApi) && TraceHeap::IsApiOnly()) ) { break; }
       
    54         #define _CREATE_MASK() TRAP_IGNORE(TraceHeap::CreateL(CtxDefaultGroups))
       
    55         #define _CHK_LEVEL(level) if ( TraceHeap::IsBelowLevel(level) ) { break; }
       
    56     #else
       
    57         #define _CHK_GRP()
       
    58         #define _CREATE_MASK()
       
    59         #define _CHK_LEVEL(level)
       
    60     #endif // DISABLE_GROUP_CHECKS
       
    61 
       
    62 	#ifdef SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
       
    63 
       
    64 		#ifndef __KERNEL_MODE__
       
    65 			#define DP_CONTEXT(_fn, _id, _vis) _TTraceCtx _dc((TText*)L ## #_fn, _id, _vis, (TUint)this)
       
    66 			#define DP_STATIC_CONTEXT(_fn, _id, _vis) _CREATE_MASK(); _TTraceCtx _dc((TText*)L ## #_fn, _id, _vis, 0)
       
    67 
       
    68 			#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)
       
    69 			#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)
       
    70 			#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)
       
    71 			#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)
       
    72 			#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)
       
    73 			#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)
       
    74 			#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)
       
    75 
       
    76 			#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)
       
    77 			#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)
       
    78 			#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)
       
    79 			#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)
       
    80 			#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)
       
    81 			#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)
       
    82 			#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)
       
    83 
       
    84 			#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)
       
    85 			#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)
       
    86 			#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)
       
    87 			#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)
       
    88 			#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)
       
    89 			#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)
       
    90 
       
    91 			#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)
       
    92 			#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)
       
    93 			#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)
       
    94 			#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)
       
    95 			#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)
       
    96 			#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)
       
    97 
       
    98 			#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 )
       
    99 
       
   100 			#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)
       
   101 
       
   102 		#else // __KERNEL_MODE__
       
   103 			#define DP_CONTEXT(_fn, _id, _vis) _TTraceCtx _dc((TText*) #_fn, _id, _vis, (TUint)this )
       
   104 			#define DP_STATIC_CONTEXT(_fn, _id, _vis) _TTraceCtx _dc((TText*) #_fn, _id, _vis, 0)
       
   105 
       
   106 			// NOTE: no trace mask checks in kernel code (no access to shared heap)
       
   107 			#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)
       
   108 			#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)
       
   109 			#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)
       
   110 			#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)
       
   111 			#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)
       
   112 			#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)
       
   113 			#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)
       
   114 
       
   115 			#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)
       
   116 			#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)
       
   117 			#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)
       
   118 			#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)
       
   119 			#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)
       
   120 			#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)
       
   121 			#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)
       
   122 
       
   123 			#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)
       
   124 			#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)
       
   125 			#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)
       
   126 			#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)
       
   127 			#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)
       
   128 			#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)
       
   129 
       
   130 			#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)
       
   131 			#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)
       
   132 			#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)
       
   133 			#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)
       
   134 			#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)
       
   135 			#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)
       
   136 
       
   137 			#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 )
       
   138 
       
   139 			#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)
       
   140 
       
   141 		#endif // __KERNEL_MODE__
       
   142 
       
   143 		#define BIND_TRACE_TRAPHANDLER() _TTraceTrapHandler _traceTrapHandler; _traceTrapHandler.oldHandler = User::SetTrapHandler(&_traceTrapHandler)
       
   144 		#define TRACE_CREATE() _CREATE_MASK();
       
   145 		#define TRACE_FAST_CREATE(_thdId) _CREATE_MASK();
       
   146 
       
   147 	#else // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
       
   148 
       
   149 		#define DP_CONTEXT(_fn, _id, _vis)
       
   150 		#define DP_STATIC_CONTEXT(_fn, _id, _vis)
       
   151 
       
   152 		#define DP_IN()
       
   153 		#define DP0_IN(string)
       
   154 		#define DP1_IN(string, p1)
       
   155 		#define DP2_IN(string, p1, p2)
       
   156 		#define DP3_IN(string, p1, p2, p3)
       
   157 		#define DP4_IN(string, p1, p2, p3, p4)
       
   158 		#define DP5_IN(string, p1, p2, p3, p4, p5)
       
   159 
       
   160 		#define DP_OUT()
       
   161 		#define DP0_OUT(string)
       
   162 		#define DP1_OUT(string, p1)
       
   163 		#define DP2_OUT(string, p1, p2)
       
   164 		#define DP3_OUT(string, p1, p2, p3)
       
   165 		#define DP4_OUT(string, p1, p2, p3, p4)
       
   166 		#define DP5_OUT(string, p1, p2, p3, p4, p5)
       
   167 
       
   168 		#define DP0_RET(val, fmtstr) return val
       
   169 		#define DP1_RET(val, fmtstr, p1) return val
       
   170 		#define DP2_RET(val, fmtstr, p1, p2) return val
       
   171 		#define DP3_RET(val, fmtstr, p1, p2, p3) return val
       
   172 		#define DP4_RET(val, fmtstr, p1, p2, p3, p4) return val
       
   173 		#define DP5_RET(val, fmtstr, p1, p2, p3, p4, p5) return val
       
   174 
       
   175 		#define DP0(level, string)
       
   176 		#define DP1(level, string, p1)
       
   177 		#define DP2(level, string, p1, p2)
       
   178 		#define DP3(level, string, p1, p2, p3)
       
   179 		#define DP4(level, string, p1, p2, p3, p4)
       
   180 		#define DP5(level, string, p1, p2, p3, p4, p5)
       
   181 
       
   182 		#define __DP_ASSERT_DBG( _assertion )
       
   183 		#define __TRACE_ASSERT_DBG(_assertion, _textToPrint, _panicCode)
       
   184 
       
   185 		#define BIND_TRACE_TRAPHANDLER()
       
   186 		#define TRACE_CREATE()
       
   187 		#define TRACE_FAST_CREATE(_thdId) _thdId++;
       
   188 
       
   189 	#endif // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
       
   190 
       
   191 #else // _DEBUG
       
   192 
       
   193     /**
       
   194     * Creates a trace context for traceable function. This variant is used with instance functions (methods).
       
   195     * Parameter @a _fn defines the name of the function (method) to trace. @_id defines the group where this trace entry belongs.
       
   196     * For full list of available trace contexts, see file a3f_trace_ctxt.h. Parameter @a _vis defines the visibility this context is having.
       
   197     * Methods with IMPORT_C / EXPORT_C definitions are marked as DPAPI, others have signature DPLOCAL. \n\n
       
   198     * Usage example:
       
   199     * @code
       
   200     * DP_CONTEXT(CFoo::Bar, CtxTest, DPLOCAL);
       
   201     * @endcode
       
   202     */
       
   203     #define DP_CONTEXT(_fn, _id, _vis)
       
   204 
       
   205     /**
       
   206     * Creates a trace context for traceable function. This variant is used with plain functions and static methods.
       
   207     * Parameter @a _fn defines the name of the function (method) to trace. @_id defines the group where this trace entry belongs.
       
   208     * For full list of available trace contexts, see file a3f_trace_ctxt.h. Parameter @a _vis defines the visibility this context is having.
       
   209     * Methods / functions with IMPORT_C / EXPORT_C definitions are marked as DPAPI, others have signature DPLOCAL.
       
   210     * 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
       
   211     * variable e.g. to instantiate other trace enabled classes.\n\n
       
   212     * Usage example:
       
   213     * @code
       
   214     * DP_CONTEXT(FooBar, CtxTest, DPAPI, thdId);
       
   215     * ...
       
   216     * TRACE_FAST_CREATE(thdId);
       
   217     * @endcode
       
   218     */
       
   219     #define DP_STATIC_CONTEXT(_fn, _id, _vis)
       
   220 
       
   221     /**
       
   222     * Using the defined trace context, outputs method entry information into traces.
       
   223     * <b> NOTE: Trace context must be defined before this method can be used.</b>
       
   224     * Trace context can be defined using either DP_CONTEXT or DP_STATIC_CONTEXT
       
   225     */
       
   226     #define DP_IN()
       
   227     #define DP0_IN(string)
       
   228     #define DP1_IN(string, p1)
       
   229     #define DP2_IN(string, p1, p2)
       
   230     #define DP3_IN(string, p1, p2, p3)
       
   231     #define DP4_IN(string, p1, p2, p3, p4)
       
   232     #define DP5_IN(string, p1, p2, p3, p4, p5)
       
   233 
       
   234     #define DP_OUT()
       
   235     #define DP0_OUT(string)
       
   236     #define DP1_OUT(string, p1)
       
   237     #define DP2_OUT(string, p1, p2)
       
   238     #define DP3_OUT(string, p1, p2, p3)
       
   239     #define DP4_OUT(string, p1, p2, p3, p4)
       
   240     #define DP5_OUT(string, p1, p2, p3, p4, p5)
       
   241 
       
   242     #define DP0_RET(val, fmtstr) return val
       
   243     #define DP1_RET(val, fmtstr, p1) return val
       
   244     #define DP2_RET(val, fmtstr, p1, p2) return val
       
   245     #define DP3_RET(val, fmtstr, p1, p2, p3) return val
       
   246     #define DP4_RET(val, fmtstr, p1, p2, p3, p4) return val
       
   247     #define DP5_RET(val, fmtstr, p1, p2, p3, p4, p5) return val
       
   248 
       
   249     #define DP0(level, string)
       
   250     #define DP1(level, string, p1)
       
   251     #define DP2(level, string, p1, p2)
       
   252     #define DP3(level, string, p1, p2, p3)
       
   253     #define DP4(level, string, p1, p2, p3, p4)
       
   254     #define DP5(level, string, p1, p2, p3, p4, p5)
       
   255 
       
   256     #define BIND_TRACE_TRAPHANDLER()
       
   257     #define TRACE_FAST_CREATE(_thdId) _thdId++;
       
   258     #define TRACE_CREATE()
       
   259 
       
   260     #define __DP_ASSERT_DBG(_assertion)
       
   261     #define __TRACE_ASSERT_DBG(_assertion, _message, _panicCode )
       
   262 
       
   263 #endif // _DEBUG
       
   264 
       
   265 #define PERF_IN_USE
       
   266 
       
   267 //performance trace categories
       
   268 #define PRF_NONE 				0x0000
       
   269 #define PRF_TIME 				0x0001
       
   270 #define PRF_LOAD   			0x0002
       
   271 #define PRF_MEM   			0x0004
       
   272 
       
   273 //performance trace actions
       
   274 #define PRF_START 	1
       
   275 #define PRF_STOP  	0
       
   276 
       
   277 #define PRF_ID 			1
       
   278 #define PRF_NO_ID 	0
       
   279 
       
   280 //active categories
       
   281 #define PRF_CATEGORIES ( PRF_TIME | PRF_LOAD | PRF_MEM )
       
   282 
       
   283 #ifdef SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
       
   284 
       
   285 	#ifndef __KERNEL_MODE__
       
   286 		#ifdef ASW_PERF_TRACES_ENABLED
       
   287 			#define _T(a) (TPtrC((const TText *)(a)))
       
   288 			#define PRF_PRINT RDebug::Print
       
   289 
       
   290 			#define PRF(id, action, category, event, string); \
       
   291 				do { \
       
   292 					if (category == (TUint16)(PRF_CATEGORIES & category))\
       
   293 						{\
       
   294 						if (PRF_NO_ID == id) \
       
   295 							{\
       
   296 							PRF_PRINT(_L("e_[]%s %d"), (TText*)L ## # event, action); \
       
   297 							}\
       
   298 						else \
       
   299 							{\
       
   300 							RThread thdIdGeneral; \
       
   301 							if ("" == string) \
       
   302 								{\
       
   303 								PRF_PRINT(_L("e_[%x:%x]%s %d"), \
       
   304 									category, (TInt)thdIdGeneral.Id(), this, (TText*)L ## # event, action); \
       
   305 								}\
       
   306 							else \
       
   307 								{\
       
   308 								PRF_PRINT(_L("e_[%x:%x]%s %d, %s"), \
       
   309 									category, (TInt)thdIdGeneral.Id(), this, (TText*)L ## # event, action, \
       
   310 									(TText*)L ## # string); \
       
   311 								}\
       
   312 							}\
       
   313 						}\
       
   314 				   } while(0)
       
   315 
       
   316 			#define PRF1(id, action, category, event, string, p1); \
       
   317 				do { \
       
   318 					if (category == (TUint16)(PRF_CATEGORIES & category))\
       
   319 						{\
       
   320 						RThread thdId; \
       
   321 						PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
       
   322 							category, (TInt)thdId.Id(), this, L ## # event, action, p1); \
       
   323 						}\
       
   324 				   } while(0)
       
   325 
       
   326 			#define PRF2(id, action, category, event, string, p1, p2); \
       
   327 				do { \
       
   328 					if (category == (TUint16)(PRF_CATEGORIES & category))\
       
   329 						{\
       
   330 						RThread thdId; \
       
   331 						PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
       
   332 							category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2); \
       
   333 						}\
       
   334 				   } while(0)
       
   335 
       
   336 			#define PRF3(id, action, category, event, string, p1, p2, p3); \
       
   337 				do { \
       
   338 					if (category == (TUint16)(PRF_CATEGORIES & category))\
       
   339 						{\
       
   340 						RThread thdId; \
       
   341 						PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
       
   342 							category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2, p3); \
       
   343 						}\
       
   344 				   } while(0)
       
   345 
       
   346 			#define PRF4(id, action, category, event, string, p1, p2, p3, p4); \
       
   347 				do { \
       
   348 					if (category == (TUint16)(PRF_CATEGORIES & category))\
       
   349 						{\
       
   350 						RThread thdId; \
       
   351 						PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
       
   352 							category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2, p3, p4); \
       
   353 						}\
       
   354 				   } while(0)
       
   355 
       
   356 			#define PRF5(id, action, category, event, string, p1, p2, p3, p4, p5); \
       
   357 				do { \
       
   358 					if (category == (TUint16)(PRF_CATEGORIES & category))\
       
   359 						{\
       
   360 						RThread thdId; \
       
   361 						PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \
       
   362 							category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2, p3, p4, p5); \
       
   363 						}\
       
   364 				   } while(0)
       
   365 
       
   366 			#define PRF_TEST(event, string, param); \
       
   367 				PRF_PRINT(_L("string: %s, param %d, " ## string), \
       
   368 					(TText*)L ## # event, param); \
       
   369 
       
   370 			#define PRF_HEAP_STATUS(category, component); \
       
   371 				do { \
       
   372 					if(category == (TUint16)(PRF_CATEGORIES & category )) \
       
   373 						{ \
       
   374 						TInt cellsFree(0); \
       
   375 						TInt cellsAllocated = User::CountAllocCells( cellsFree ); \
       
   376 						TInt bytesAllocated(0); \
       
   377 						TInt cellsAllocatedInHeap = User::AllocSize( bytesAllocated ); \
       
   378 						TInt bytesInLargestFreeBlock(0); \
       
   379 						TInt bytesAvailable = User::Available(bytesInLargestFreeBlock); \
       
   380 						PRF_PRINT(_L("[%x:%x]%s cellsFree=%d, cellsAllocated=%d, bytesAllocated=%d, cellsAllocatedInHeap=%d, bytesInLargestFreeBlock=%d, bytesAvailable=%d"), \
       
   381 							category, this, (TText*)L ## # component, \
       
   382 							cellsFree, cellsAllocated, bytesAllocated, cellsAllocatedInHeap, \
       
   383 							bytesInLargestFreeBlock, bytesAvailable); \
       
   384 						} \
       
   385 				   } while(0)
       
   386 		#else
       
   387 			#define PRF(id, action, category, event, string);
       
   388 			#define PRF1(id, action, category, event, string, p1);
       
   389 			#define PRF2(id, action, category, event, string, p1, p2);
       
   390 			#define PRF3(id, action, category, event, string, p1, p2, p3);
       
   391 			#define PRF4(id, action, category, event, string, p1, p2, p3, p4);
       
   392 			#define PRF5(id, action, category, event, string, p1, p2, p3, p4, p5);
       
   393 			#define PRF_HEAP_STATUS(category, component);
       
   394 
       
   395 		#endif  //ASW_PERF_TRACES_ENABLED
       
   396 	#endif //__KERNEL_MODE__
       
   397 
       
   398 #else // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
       
   399 
       
   400 	#define PRF_PRINT
       
   401 
       
   402 	#define PRF(id, action, category, event, string);
       
   403 	#define PRF1(id, action, category, event, string, p1);
       
   404 	#define PRF2(id, action, category, event, string, p1, p2);
       
   405 	#define PRF3(id, action, category, event, string, p1, p2, p3);
       
   406 	#define PRF4(id, action, category, event, string, p1, p2, p3, p4);
       
   407 	#define PRF5(id, action, category, event, string, p1, p2, p3, p4, p5);
       
   408 	#define PRF_HEAP_STATUS(category, component);
       
   409 
       
   410 #endif	// SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING
       
   411 
       
   412 // DATA TYPES
       
   413 //enum ?declaration
       
   414 //typedef ?declaration
       
   415 //extern ?data_type;
       
   416 
       
   417 // FUNCTION PROTOTYPES
       
   418 //?type ?function_name(?arg_list);
       
   419 
       
   420 // FORWARD DECLARATIONS
       
   421 //class ?FORWARD_CLASSNAME;
       
   422 
       
   423 // CLASS DECLARATION
       
   424 
       
   425 
       
   426 
       
   427 #endif      // _A3F_TRACE_UTILS_H_
       
   428 
       
   429 // End of File