sl@0: /* sl@0: * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef _A3F_TRACE_UTILS_H_ sl@0: #define _A3F_TRACE_UTILS_H_ sl@0: sl@0: // INCLUDES sl@0: #include sl@0: sl@0: #define DP_ASSERT(_assertion) __DP_ASSERT_DBG(_assertion) sl@0: sl@0: sl@0: #ifdef _DEBUG sl@0: sl@0: #ifndef DISABLE_SYNTAX_CHECK sl@0: #define _MARK_ENTRY() _dc.inOk=ETrue sl@0: #define _DOINCHK() _dc.DoInChk() sl@0: #define _CHK_MULTIIN() _dc.ChkMultiIn() sl@0: #define _CHK_MULTIOUT() _dc.ChkMultiOut() sl@0: #define _MARK_EXIT() _dc.outOk=ETrue sl@0: #else sl@0: #define _MARK_ENTRY() sl@0: #define _DOINCHK() sl@0: #define _CHK_MULTIIN() sl@0: #define _CHK_MULTIOUT() sl@0: #define _MARK_EXIT() sl@0: #endif // DISABLE_SYNTAX_CHECK sl@0: sl@0: #ifndef DISABLE_GROUP_CHECKS sl@0: #include sl@0: #define _CHK_GRP() if ( (!TraceHeap::IsMaskOn(TRACENFO[_dc.iId].iGrpId)) || ((!_dc.iApi) && TraceHeap::IsApiOnly()) ) { break; } sl@0: #define _CREATE_MASK() TRAP_IGNORE(TraceHeap::CreateL(CtxDefaultGroups)) sl@0: #define _CHK_LEVEL(level) if ( TraceHeap::IsBelowLevel(level) ) { break; } sl@0: #else sl@0: #define _CHK_GRP() sl@0: #define _CREATE_MASK() sl@0: #define _CHK_LEVEL(level) sl@0: #endif // DISABLE_GROUP_CHECKS sl@0: sl@0: #ifdef SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: #define DP_CONTEXT(_fn, _id, _vis) _TTraceCtx _dc((TText*)L ## #_fn, _id, _vis, (TUint)this) sl@0: #define DP_STATIC_CONTEXT(_fn, _id, _vis) _CREATE_MASK(); _TTraceCtx _dc((TText*)L ## #_fn, _id, _vis, 0) sl@0: sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: sl@0: #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 ) sl@0: sl@0: #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) sl@0: sl@0: #else // __KERNEL_MODE__ sl@0: #define DP_CONTEXT(_fn, _id, _vis) _TTraceCtx _dc((TText*) #_fn, _id, _vis, (TUint)this ) sl@0: #define DP_STATIC_CONTEXT(_fn, _id, _vis) _TTraceCtx _dc((TText*) #_fn, _id, _vis, 0) sl@0: sl@0: // NOTE: no trace mask checks in kernel code (no access to shared heap) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: #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) sl@0: sl@0: #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 ) sl@0: sl@0: #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) sl@0: sl@0: #endif // __KERNEL_MODE__ sl@0: sl@0: #define BIND_TRACE_TRAPHANDLER() _TTraceTrapHandler _traceTrapHandler; _traceTrapHandler.oldHandler = User::SetTrapHandler(&_traceTrapHandler) sl@0: #define TRACE_CREATE() _CREATE_MASK(); sl@0: #define TRACE_FAST_CREATE(_thdId) _CREATE_MASK(); sl@0: sl@0: #else // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING sl@0: sl@0: #define DP_CONTEXT(_fn, _id, _vis) sl@0: #define DP_STATIC_CONTEXT(_fn, _id, _vis) sl@0: sl@0: #define DP_IN() sl@0: #define DP0_IN(string) sl@0: #define DP1_IN(string, p1) sl@0: #define DP2_IN(string, p1, p2) sl@0: #define DP3_IN(string, p1, p2, p3) sl@0: #define DP4_IN(string, p1, p2, p3, p4) sl@0: #define DP5_IN(string, p1, p2, p3, p4, p5) sl@0: sl@0: #define DP_OUT() sl@0: #define DP0_OUT(string) sl@0: #define DP1_OUT(string, p1) sl@0: #define DP2_OUT(string, p1, p2) sl@0: #define DP3_OUT(string, p1, p2, p3) sl@0: #define DP4_OUT(string, p1, p2, p3, p4) sl@0: #define DP5_OUT(string, p1, p2, p3, p4, p5) sl@0: sl@0: #define DP0_RET(val, fmtstr) return val sl@0: #define DP1_RET(val, fmtstr, p1) return val sl@0: #define DP2_RET(val, fmtstr, p1, p2) return val sl@0: #define DP3_RET(val, fmtstr, p1, p2, p3) return val sl@0: #define DP4_RET(val, fmtstr, p1, p2, p3, p4) return val sl@0: #define DP5_RET(val, fmtstr, p1, p2, p3, p4, p5) return val sl@0: sl@0: #define DP0(level, string) sl@0: #define DP1(level, string, p1) sl@0: #define DP2(level, string, p1, p2) sl@0: #define DP3(level, string, p1, p2, p3) sl@0: #define DP4(level, string, p1, p2, p3, p4) sl@0: #define DP5(level, string, p1, p2, p3, p4, p5) sl@0: sl@0: #define __DP_ASSERT_DBG( _assertion ) sl@0: #define __TRACE_ASSERT_DBG(_assertion, _textToPrint, _panicCode) sl@0: sl@0: #define BIND_TRACE_TRAPHANDLER() sl@0: #define TRACE_CREATE() sl@0: #define TRACE_FAST_CREATE(_thdId) _thdId++; sl@0: sl@0: #endif // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING sl@0: sl@0: #else // _DEBUG sl@0: sl@0: /** sl@0: * Creates a trace context for traceable function. This variant is used with instance functions (methods). sl@0: * Parameter @a _fn defines the name of the function (method) to trace. @_id defines the group where this trace entry belongs. sl@0: * For full list of available trace contexts, see file a3f_trace_ctxt.h. Parameter @a _vis defines the visibility this context is having. sl@0: * Methods with IMPORT_C / EXPORT_C definitions are marked as DPAPI, others have signature DPLOCAL. \n\n sl@0: * Usage example: sl@0: * @code sl@0: * DP_CONTEXT(CFoo::Bar, CtxTest, DPLOCAL); sl@0: * @endcode sl@0: */ sl@0: #define DP_CONTEXT(_fn, _id, _vis) sl@0: sl@0: /** sl@0: * Creates a trace context for traceable function. This variant is used with plain functions and static methods. sl@0: * Parameter @a _fn defines the name of the function (method) to trace. @_id defines the group where this trace entry belongs. sl@0: * For full list of available trace contexts, see file a3f_trace_ctxt.h. Parameter @a _vis defines the visibility this context is having. sl@0: * Methods / functions with IMPORT_C / EXPORT_C definitions are marked as DPAPI, others have signature DPLOCAL. sl@0: * 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 sl@0: * variable e.g. to instantiate other trace enabled classes.\n\n sl@0: * Usage example: sl@0: * @code sl@0: * DP_CONTEXT(FooBar, CtxTest, DPAPI, thdId); sl@0: * ... sl@0: * TRACE_FAST_CREATE(thdId); sl@0: * @endcode sl@0: */ sl@0: #define DP_STATIC_CONTEXT(_fn, _id, _vis) sl@0: sl@0: /** sl@0: * Using the defined trace context, outputs method entry information into traces. sl@0: * NOTE: Trace context must be defined before this method can be used. sl@0: * Trace context can be defined using either DP_CONTEXT or DP_STATIC_CONTEXT sl@0: */ sl@0: #define DP_IN() sl@0: #define DP0_IN(string) sl@0: #define DP1_IN(string, p1) sl@0: #define DP2_IN(string, p1, p2) sl@0: #define DP3_IN(string, p1, p2, p3) sl@0: #define DP4_IN(string, p1, p2, p3, p4) sl@0: #define DP5_IN(string, p1, p2, p3, p4, p5) sl@0: sl@0: #define DP_OUT() sl@0: #define DP0_OUT(string) sl@0: #define DP1_OUT(string, p1) sl@0: #define DP2_OUT(string, p1, p2) sl@0: #define DP3_OUT(string, p1, p2, p3) sl@0: #define DP4_OUT(string, p1, p2, p3, p4) sl@0: #define DP5_OUT(string, p1, p2, p3, p4, p5) sl@0: sl@0: #define DP0_RET(val, fmtstr) return val sl@0: #define DP1_RET(val, fmtstr, p1) return val sl@0: #define DP2_RET(val, fmtstr, p1, p2) return val sl@0: #define DP3_RET(val, fmtstr, p1, p2, p3) return val sl@0: #define DP4_RET(val, fmtstr, p1, p2, p3, p4) return val sl@0: #define DP5_RET(val, fmtstr, p1, p2, p3, p4, p5) return val sl@0: sl@0: #define DP0(level, string) sl@0: #define DP1(level, string, p1) sl@0: #define DP2(level, string, p1, p2) sl@0: #define DP3(level, string, p1, p2, p3) sl@0: #define DP4(level, string, p1, p2, p3, p4) sl@0: #define DP5(level, string, p1, p2, p3, p4, p5) sl@0: sl@0: #define BIND_TRACE_TRAPHANDLER() sl@0: #define TRACE_FAST_CREATE(_thdId) _thdId++; sl@0: #define TRACE_CREATE() sl@0: sl@0: #define __DP_ASSERT_DBG(_assertion) sl@0: #define __TRACE_ASSERT_DBG(_assertion, _message, _panicCode ) sl@0: sl@0: #endif // _DEBUG sl@0: sl@0: #define PERF_IN_USE sl@0: sl@0: //performance trace categories sl@0: #define PRF_NONE 0x0000 sl@0: #define PRF_TIME 0x0001 sl@0: #define PRF_LOAD 0x0002 sl@0: #define PRF_MEM 0x0004 sl@0: sl@0: //performance trace actions sl@0: #define PRF_START 1 sl@0: #define PRF_STOP 0 sl@0: sl@0: #define PRF_ID 1 sl@0: #define PRF_NO_ID 0 sl@0: sl@0: //active categories sl@0: #define PRF_CATEGORIES ( PRF_TIME | PRF_LOAD | PRF_MEM ) sl@0: sl@0: #ifdef SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: #ifdef ASW_PERF_TRACES_ENABLED sl@0: #define _T(a) (TPtrC((const TText *)(a))) sl@0: #define PRF_PRINT RDebug::Print sl@0: sl@0: #define PRF(id, action, category, event, string); \ sl@0: do { \ sl@0: if (category == (TUint16)(PRF_CATEGORIES & category))\ sl@0: {\ sl@0: if (PRF_NO_ID == id) \ sl@0: {\ sl@0: PRF_PRINT(_L("e_[]%s %d"), (TText*)L ## # event, action); \ sl@0: }\ sl@0: else \ sl@0: {\ sl@0: RThread thdIdGeneral; \ sl@0: if ("" == string) \ sl@0: {\ sl@0: PRF_PRINT(_L("e_[%x:%x]%s %d"), \ sl@0: category, (TInt)thdIdGeneral.Id(), this, (TText*)L ## # event, action); \ sl@0: }\ sl@0: else \ sl@0: {\ sl@0: PRF_PRINT(_L("e_[%x:%x]%s %d, %s"), \ sl@0: category, (TInt)thdIdGeneral.Id(), this, (TText*)L ## # event, action, \ sl@0: (TText*)L ## # string); \ sl@0: }\ sl@0: }\ sl@0: }\ sl@0: } while(0) sl@0: sl@0: #define PRF1(id, action, category, event, string, p1); \ sl@0: do { \ sl@0: if (category == (TUint16)(PRF_CATEGORIES & category))\ sl@0: {\ sl@0: RThread thdId; \ sl@0: PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \ sl@0: category, (TInt)thdId.Id(), this, L ## # event, action, p1); \ sl@0: }\ sl@0: } while(0) sl@0: sl@0: #define PRF2(id, action, category, event, string, p1, p2); \ sl@0: do { \ sl@0: if (category == (TUint16)(PRF_CATEGORIES & category))\ sl@0: {\ sl@0: RThread thdId; \ sl@0: PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \ sl@0: category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2); \ sl@0: }\ sl@0: } while(0) sl@0: sl@0: #define PRF3(id, action, category, event, string, p1, p2, p3); \ sl@0: do { \ sl@0: if (category == (TUint16)(PRF_CATEGORIES & category))\ sl@0: {\ sl@0: RThread thdId; \ sl@0: PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \ sl@0: category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2, p3); \ sl@0: }\ sl@0: } while(0) sl@0: sl@0: #define PRF4(id, action, category, event, string, p1, p2, p3, p4); \ sl@0: do { \ sl@0: if (category == (TUint16)(PRF_CATEGORIES & category))\ sl@0: {\ sl@0: RThread thdId; \ sl@0: PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \ sl@0: category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2, p3, p4); \ sl@0: }\ sl@0: } while(0) sl@0: sl@0: #define PRF5(id, action, category, event, string, p1, p2, p3, p4, p5); \ sl@0: do { \ sl@0: if (category == (TUint16)(PRF_CATEGORIES & category))\ sl@0: {\ sl@0: RThread thdId; \ sl@0: PRF_PRINT( _T(L ## "e_[%x:%x]%s %d, " L ## string), \ sl@0: category, (TInt)thdId.Id(), this, L ## # event, action, p1, p2, p3, p4, p5); \ sl@0: }\ sl@0: } while(0) sl@0: sl@0: #define PRF_TEST(event, string, param); \ sl@0: PRF_PRINT(_L("string: %s, param %d, " ## string), \ sl@0: (TText*)L ## # event, param); \ sl@0: sl@0: #define PRF_HEAP_STATUS(category, component); \ sl@0: do { \ sl@0: if(category == (TUint16)(PRF_CATEGORIES & category )) \ sl@0: { \ sl@0: TInt cellsFree(0); \ sl@0: TInt cellsAllocated = User::CountAllocCells( cellsFree ); \ sl@0: TInt bytesAllocated(0); \ sl@0: TInt cellsAllocatedInHeap = User::AllocSize( bytesAllocated ); \ sl@0: TInt bytesInLargestFreeBlock(0); \ sl@0: TInt bytesAvailable = User::Available(bytesInLargestFreeBlock); \ sl@0: PRF_PRINT(_L("[%x:%x]%s cellsFree=%d, cellsAllocated=%d, bytesAllocated=%d, cellsAllocatedInHeap=%d, bytesInLargestFreeBlock=%d, bytesAvailable=%d"), \ sl@0: category, this, (TText*)L ## # component, \ sl@0: cellsFree, cellsAllocated, bytesAllocated, cellsAllocatedInHeap, \ sl@0: bytesInLargestFreeBlock, bytesAvailable); \ sl@0: } \ sl@0: } while(0) sl@0: #else sl@0: #define PRF(id, action, category, event, string); sl@0: #define PRF1(id, action, category, event, string, p1); sl@0: #define PRF2(id, action, category, event, string, p1, p2); sl@0: #define PRF3(id, action, category, event, string, p1, p2, p3); sl@0: #define PRF4(id, action, category, event, string, p1, p2, p3, p4); sl@0: #define PRF5(id, action, category, event, string, p1, p2, p3, p4, p5); sl@0: #define PRF_HEAP_STATUS(category, component); sl@0: sl@0: #endif //ASW_PERF_TRACES_ENABLED sl@0: #endif //__KERNEL_MODE__ sl@0: sl@0: #else // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING sl@0: sl@0: #define PRF_PRINT sl@0: sl@0: #define PRF(id, action, category, event, string); sl@0: #define PRF1(id, action, category, event, string, p1); sl@0: #define PRF2(id, action, category, event, string, p1, p2); sl@0: #define PRF3(id, action, category, event, string, p1, p2, p3); sl@0: #define PRF4(id, action, category, event, string, p1, p2, p3, p4); sl@0: #define PRF5(id, action, category, event, string, p1, p2, p3, p4, p5); sl@0: #define PRF_HEAP_STATUS(category, component); sl@0: sl@0: #endif // SYMBIAN_MULTIMEDIA_A3F_ENABLE_LOGGING sl@0: sl@0: // DATA TYPES sl@0: //enum ?declaration sl@0: //typedef ?declaration sl@0: //extern ?data_type; sl@0: sl@0: // FUNCTION PROTOTYPES sl@0: //?type ?function_name(?arg_list); sl@0: sl@0: // FORWARD DECLARATIONS sl@0: //class ?FORWARD_CLASSNAME; sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: sl@0: sl@0: #endif // _A3F_TRACE_UTILS_H_ sl@0: sl@0: // End of File