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