| author | hgs |
| Tue, 02 Nov 2010 15:42:21 +0000 | |
| changeset 301 | 172f33f13d7d |
| parent 289 | 55a0a1279a7e |
| permissions | -rw-r--r-- |
| 0 | 1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// Trace API |
|
15 |
// |
|
16 |
||
17 |
#ifndef OPENSYSTEMTRACEV2_H |
|
18 |
#define OPENSYSTEMTRACEV2_H |
|
19 |
||
20 |
#include <opensystemtrace_types.h> |
|
21 |
||
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
/** |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
This macro defines the version of the Open System Trace instrumentation API. |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
*/ |
| 289 | 25 |
#define OST_INSTRUMENTATION_API_VERSION 2.2.0 |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
|
| 0 | 27 |
|
28 |
/** |
|
29 |
Methods for tracing from user side. |
|
30 |
||
31 |
These methods are used to output trace packets. |
|
32 |
Each trace packet consists of attributes and the user defined payload. |
|
33 |
||
34 |
In order to output trace packets, tracing needs to be |
|
35 |
included and enabled at compile time in the executable, |
|
36 |
as well as be filtered at run-time. |
|
37 |
||
38 |
Note: |
|
39 |
OSTv2 does not enforce any security. It is the developer's responsibility |
|
40 |
to ensure that trace packets do not contain any sensitive information that |
|
41 |
may undermine platform security. |
|
42 |
||
43 |
@file |
|
44 |
@publishedPartner |
|
45 |
@prototype |
|
46 |
*/ |
|
47 |
||
48 |
/** |
|
49 |
Class used to encapsulate the context of a trace point. |
|
50 |
For more information about the attributes please @see opensystemtrace_types.h. |
|
51 |
||
52 |
The attributes in @see TTraceContext are used to identify and filter the trace packet. |
|
53 |
@see opensystemtrace.mmh |
|
54 |
@see RUlogger for information on how to filter at run-time |
|
55 |
||
56 |
@deprecated |
|
57 |
*/ |
|
58 |
NONSHARABLE_CLASS(TTraceContext) |
|
59 |
{
|
|
60 |
public: |
|
61 |
inline TTraceContext(const TGroupId aGroupId); |
|
62 |
inline TTraceContext(const TGroupId aGroupId, const THasThreadIdentification aHasThreadIdentification, const THasProgramCounter aHasProgramCounter); |
|
63 |
||
64 |
inline TTraceContext(const TComponentId aComponentId, const TGroupId aGroupId); |
|
65 |
inline TTraceContext(const TComponentId aComponentId, const TGroupId aGroupId, const THasThreadIdentification aHasThreadIdentification, const THasProgramCounter aHasProgramCounter); |
|
66 |
||
67 |
IMPORT_C TComponentId ComponentId() const; |
|
68 |
IMPORT_C TClassification Classification() const; |
|
69 |
IMPORT_C TGroupId GroupId() const; |
|
70 |
IMPORT_C THasThreadIdentification HasThreadIdentification() const; |
|
71 |
IMPORT_C THasProgramCounter HasProgramCounter() const; |
|
72 |
IMPORT_C static TComponentId DefaultComponentId(); |
|
73 |
private: |
|
74 |
inline TTraceContext(){};
|
|
75 |
private: |
|
76 |
TComponentId iComponentId; ///<@see TComponentId |
|
77 |
TGroupId iGroupId; ///<@see TGroupId |
|
78 |
THasThreadIdentification iHasThreadIdentification; ///<@see THasThreadIdentification |
|
79 |
THasProgramCounter iHasProgramCounter; ///<@see THasProgramCounter |
|
80 |
TUint32 iReserved1; //Reserved for future use |
|
81 |
TUint32 iReserved2; //Reserved for future use |
|
82 |
}; |
|
83 |
||
84 |
IMPORT_C TBool OstPrint(const TTraceContext& aContext, const TDesC8& aDes); |
|
85 |
IMPORT_C TBool OstPrintf(const TTraceContext& aContext, const char* aFmt, ...); |
|
86 |
IMPORT_C TBool OstPrintf(const TTraceContext& aContext, TRefByValue<const TDesC8> aFmt,...); |
|
87 |
#ifndef __KERNEL_MODE__ |
|
88 |
IMPORT_C TBool OstPrint(const TTraceContext& aContext, const TDesC16& aDes); |
|
89 |
IMPORT_C TBool OstPrintf(const TTraceContext& aContext, TRefByValue<const TDesC16> aFmt,...); |
|
90 |
#endif //__KERNEL_MODE__ |
|
91 |
||
92 |
IMPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId); |
|
93 |
IMPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TUint8 aData); |
|
94 |
IMPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TUint16 aData); |
|
95 |
IMPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TUint32 aData); |
|
96 |
IMPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TUint32 aData1, const TUint32 aData2); |
|
97 |
IMPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TDesC8& aData); |
|
98 |
#ifndef __KERNEL_MODE__ |
|
99 |
IMPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TDesC16& aData); |
|
100 |
#endif |
|
101 |
template<typename T> |
|
102 |
static inline TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const T& aData); |
|
103 |
IMPORT_C TBool OstTrace(const TTraceContext& aContext, const TTraceId aTraceId, const TAny* aData, const TInt aDataSize); |
|
104 |
||
105 |
IMPORT_C TBool IsTraceActive(const TTraceContext& aContext); |
|
106 |
||
107 |
||
108 |
/** |
|
109 |
The following trace APIs require a TraceCompiler to be present in the build system. |
|
110 |
This TraceCompiler is used to generate additional information for each trace point |
|
111 |
in order for traces to be generated at runtime. |
|
112 |
*/ |
|
113 |
||
114 |
#include <opensystemtrace.inl> |
|
115 |
||
116 |
// Macros |
|
117 |
||
118 |
/** |
|
119 |
Preprocessor category for all traces off. |
|
120 |
This should not be used from traces |
|
121 |
*/ |
|
122 |
#define OST_TRACE_CATEGORY_NONE 0x00000000 |
|
123 |
||
124 |
/** |
|
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
125 |
Preprocessor category for traces that should be compiled |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
into all builds including UREL. As a result these traces |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
127 |
will end up in production images used by consumers. |
| 0 | 128 |
*/ |
129 |
#define OST_TRACE_CATEGORY_PRODUCTION 0x00000001 |
|
130 |
||
131 |
/** |
|
132 |
Preprocessor category for RnD traces |
|
| 289 | 133 |
@deprecated Use OST_TRACE_CATEGORY_PRODUCTION |
| 0 | 134 |
*/ |
| 289 | 135 |
#define OST_TRACE_CATEGORY_RND OST_TRACE_CATEGORY_PRODUCTION |
| 0 | 136 |
|
137 |
/** |
|
138 |
Preprocessor category for performance measurement traces |
|
139 |
*/ |
|
140 |
#define OST_TRACE_CATEGORY_PERFORMANCE_MEASUREMENT 0x00000004 |
|
141 |
||
142 |
/** |
|
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
143 |
Preprocessor category for traces that by default should only |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
144 |
be compiled into UDEB builds. |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
145 |
*/ |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
146 |
#define OST_TRACE_CATEGORY_DEBUG 0x00000008 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
147 |
|
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
148 |
/** |
| 0 | 149 |
Preprocessor level for all traces on. |
150 |
This should not be used from traces |
|
151 |
*/ |
|
152 |
#define OST_TRACE_CATEGORY_ALL 0xFFFFFFFF |
|
153 |
||
154 |
||
155 |
/** |
|
156 |
A flag, which specifies if the compiler has been run for the component |
|
157 |
*/ |
|
158 |
#if defined( OST_TRACE_COMPILER_IN_USE ) |
|
159 |
||
160 |
||
161 |
/** |
|
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
162 |
The default preprocessor categories are defined here. |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
163 |
A component may override this by defining |
| 0 | 164 |
OST_TRACE_CATEGORY before including this file |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
165 |
|
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
166 |
The RND category is defined for UREL and UDEB to |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
167 |
preserve source compatibility. |
| 0 | 168 |
*/ |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
169 |
#ifndef OST_TRACE_CATEGORY |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
170 |
#ifdef _DEBUG |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
171 |
#define OST_TRACE_CATEGORY (OST_TRACE_CATEGORY_RND | \ |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
172 |
OST_TRACE_CATEGORY_PRODUCTION | \ |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
173 |
OST_TRACE_CATEGORY_DEBUG) |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
174 |
#else // _DEBUG |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
175 |
#define OST_TRACE_CATEGORY (OST_TRACE_CATEGORY_RND | \ |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
176 |
OST_TRACE_CATEGORY_PRODUCTION) |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
177 |
#endif // _DEBUG |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
178 |
#endif // OST_TRACE_CATEGORY |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
179 |
|
| 0 | 180 |
|
181 |
/** |
|
182 |
Trace with no parameters |
|
183 |
||
184 |
@param aCategory Preprocessor category for the trace |
|
185 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
186 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
187 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
188 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
189 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
190 |
The text itself is not sent in the trace packet |
|
191 |
*/ |
|
192 |
#define OstTraceDef0( aCategory, aGroupName, aTraceName, aTraceText ) \ |
|
193 |
do {if ( aCategory & OST_TRACE_CATEGORY ) \
|
|
194 |
BTraceFilteredContext8( EXTRACT_GROUP_ID(aTraceName), \ |
|
195 |
EOstTrace, \ |
|
196 |
KOstTraceComponentID, \ |
|
197 |
aTraceName );} while (0) |
|
198 |
||
199 |
||
200 |
/** |
|
201 |
Trace with one 32-bit parameter |
|
202 |
||
203 |
@param aCategory Preprocessor category for the trace |
|
204 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
205 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
206 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
207 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
208 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
209 |
The text itself is not sent in the trace packet |
|
210 |
@param aParam The 32-bit value to be traced |
|
211 |
*/ |
|
212 |
#define OstTraceDef1( aCategory, aGroupName, aTraceName, aTraceText, aParam ) \ |
|
213 |
do {if ( aCategory & OST_TRACE_CATEGORY ) \
|
|
214 |
BTraceFilteredContext12( EXTRACT_GROUP_ID(aTraceName), \ |
|
215 |
EOstTrace, \ |
|
216 |
KOstTraceComponentID, \ |
|
217 |
aTraceName, \ |
|
218 |
aParam );} while (0) |
|
219 |
||
220 |
||
221 |
/** |
|
222 |
Trace with more than 32 bits of data |
|
223 |
||
224 |
@param aCategory Preprocessor category for the trace |
|
225 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
226 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
227 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
228 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
229 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
230 |
The text itself is not sent in the trace packet |
|
231 |
@param aPtr Pointer to the data to be traced |
|
232 |
@param aLength Length of the data to be traced |
|
233 |
*/ |
|
234 |
#define OstTraceDefData( aCategory, aGroupName, aTraceName, aTraceText, aPtr, aLength ) \ |
|
235 |
do {if ( aCategory & OST_TRACE_CATEGORY ) \
|
|
236 |
OstSendNBytes( EXTRACT_GROUP_ID(aTraceName), \ |
|
237 |
EOstTrace, \ |
|
238 |
KOstTraceComponentID, \ |
|
239 |
aTraceName, \ |
|
240 |
aPtr, \ |
|
241 |
aLength );} while (0) |
|
242 |
||
243 |
||
244 |
/** |
|
245 |
Trace with one parameter that is not 32-bit integer. This calls OstTraceGen1, |
|
246 |
which is generated by the trace compiler. The generated function will pack the |
|
247 |
parameter into a stack-allocated buffer and call OstTraceData with the buffer. |
|
248 |
||
249 |
@param aCategory Preprocessor category for the trace |
|
250 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
251 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
252 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
253 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
254 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
255 |
The text itself is not sent in the trace packet |
|
256 |
@param aParam The parameter to be traced |
|
257 |
*/ |
|
258 |
#define OstTraceDefExt1( aCategory, aGroupName, aTraceName, aTraceText, aParam ) \ |
|
259 |
do {if ( aCategory & OST_TRACE_CATEGORY ) \
|
|
260 |
OstTraceGen1( aTraceName, aParam );} while (0) |
|
261 |
||
262 |
||
263 |
/** |
|
264 |
Trace with two parameters. This calls OstTraceGen2, which is generated by trace compiler. |
|
265 |
The generated function will pack the parameters into a stack-allocated buffer and |
|
266 |
call OstTraceData with the buffer. |
|
267 |
||
268 |
@param aCategory Preprocessor category for the trace |
|
269 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
270 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
271 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
272 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
273 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
274 |
The text itself is not sent in the trace packet |
|
275 |
@param aParam1 The first parameter to be traced |
|
276 |
@param aParam2 The second parameter to be traced |
|
277 |
*/ |
|
278 |
#define OstTraceDefExt2( aCategory, aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \ |
|
279 |
do {if ( aCategory & OST_TRACE_CATEGORY ) \
|
|
280 |
OstTraceGen2( aTraceName, aParam1, aParam2 );} while (0) |
|
281 |
||
282 |
||
283 |
/** |
|
284 |
Trace with three parameters. This calls OstTraceGen3, which is generated by trace compiler. |
|
285 |
The generated function will pack the parameters into a stack-allocated buffer and |
|
286 |
call OstTraceData with the buffer. |
|
287 |
||
288 |
@param aCategory Preprocessor category for the trace |
|
289 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
290 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
291 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
292 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
293 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
294 |
The text itself is not sent in the trace packet |
|
295 |
@param aParam1 The first parameter to be traced |
|
296 |
@param aParam2 The second parameter to be traced |
|
297 |
@param aParam3 The third parameter to be traced |
|
298 |
*/ |
|
299 |
#define OstTraceDefExt3( aCategory, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \ |
|
300 |
do {if ( aCategory & OST_TRACE_CATEGORY ) \
|
|
301 |
OstTraceGen3( aTraceName, aParam1, aParam2, aParam3 );} while (0) |
|
302 |
||
303 |
||
304 |
/** |
|
305 |
Trace with four parameters. This calls OstTraceGen4, which is generated by trace compiler. |
|
306 |
The generated function will pack the parameters into a stack-allocated buffer and |
|
307 |
call OstTraceData with the buffer. |
|
308 |
||
309 |
@param aCategory Preprocessor category for the trace |
|
310 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
311 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
312 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
313 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
314 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
315 |
The text itself is not sent in the trace packet |
|
316 |
@param aParam1 The first parameter to be traced |
|
317 |
@param aParam2 The second parameter to be traced |
|
318 |
@param aParam3 The third parameter to be traced |
|
319 |
@param aParam4 The fourth parameter to be traced |
|
320 |
*/ |
|
321 |
#define OstTraceDefExt4( aCategory, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \ |
|
322 |
do {if ( aCategory & OST_TRACE_CATEGORY ) \
|
|
323 |
OstTraceGen4( aTraceName, aParam1, aParam2, aParam3, aParam4 );} while (0) |
|
324 |
||
325 |
||
326 |
/** |
|
327 |
Trace with five parameters. This calls OstTraceGen5, which is generated by trace compiler. |
|
328 |
The generated function will pack the parameters into a stack-allocated buffer and |
|
329 |
call OstTraceData with the buffer. |
|
330 |
||
331 |
@param aCategory Preprocessor category for the trace |
|
332 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
333 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
334 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
335 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
336 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
337 |
The text itself is not sent in the trace packet |
|
338 |
@param aParam1 The first parameter to be traced |
|
339 |
@param aParam2 The second parameter to be traced |
|
340 |
@param aParam3 The third parameter to be traced |
|
341 |
@param aParam4 The fourth parameter to be traced |
|
342 |
@param aParam5 The fifth parameter to be traced |
|
343 |
*/ |
|
344 |
#define OstTraceDefExt5( aCategory, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \ |
|
345 |
do {if ( aCategory & OST_TRACE_CATEGORY ) \
|
|
346 |
OstTraceGen5( aTraceName, aParam1, aParam2, aParam3, aParam4, aParam5 );} while (0) |
|
347 |
||
348 |
||
349 |
/** |
|
350 |
*************** Trace macros which use RnD as default preprocessor category *************** |
|
351 |
*/ |
|
352 |
||
353 |
/** |
|
354 |
RnD trace with no parameters |
|
355 |
||
356 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
357 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
358 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
359 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
360 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
361 |
The text itself is not sent in the trace packet |
|
362 |
*/ |
|
363 |
#define OstTrace0( aGroupName, aTraceName, aTraceText ) \ |
|
| 289 | 364 |
OstTraceDef0( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText ) |
| 0 | 365 |
|
366 |
||
367 |
/** |
|
368 |
RnD trace with one 32-bit parameter |
|
369 |
||
370 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
371 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
372 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
373 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
374 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
375 |
The text itself is not sent in the trace packet |
|
376 |
@param aParam The 32-bit value to be traced |
|
377 |
*/ |
|
378 |
#define OstTrace1( aGroupName, aTraceName, aTraceText, aParam ) \ |
|
| 289 | 379 |
OstTraceDef1( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam ) |
| 0 | 380 |
|
381 |
||
382 |
/** |
|
383 |
RnD trace with more than 32 bits of data |
|
384 |
||
385 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
386 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
387 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
388 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
389 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
390 |
The text itself is not sent in the trace packet |
|
391 |
@param aPtr Pointer to the data to be traced |
|
392 |
@param aLength Length of the data to be traced |
|
393 |
*/ |
|
394 |
#define OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) \ |
|
| 289 | 395 |
OstTraceDefData( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aPtr, aLength ) |
| 0 | 396 |
|
397 |
||
398 |
/** |
|
399 |
RnD trace with one parameter that is not 32-bit integer. This calls OstTraceGen1, |
|
400 |
which is generated by the trace compiler. The generated function will pack the |
|
401 |
parameter into a stack-allocated buffer and call OstTraceData with the buffer. |
|
402 |
||
403 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
404 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
405 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
406 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
407 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
408 |
The text itself is not sent in the trace packet |
|
409 |
@param aParam The parameter to be traced |
|
410 |
*/ |
|
411 |
#define OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \ |
|
| 289 | 412 |
OstTraceDefExt1( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam ) |
| 0 | 413 |
|
414 |
||
415 |
/** |
|
416 |
RnD trace with two parameters. This calls OstTraceGen2, which is generated by trace compiler. |
|
417 |
The generated function will pack the parameters into a stack-allocated buffer and |
|
418 |
call OstTraceData with the buffer. |
|
419 |
||
420 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
421 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
422 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
423 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
424 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
425 |
The text itself is not sent in the trace packet |
|
426 |
@param aParam1 The first parameter to be traced |
|
427 |
@param aParam2 The second parameter to be traced |
|
428 |
*/ |
|
429 |
#define OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \ |
|
| 289 | 430 |
OstTraceDefExt2( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) |
| 0 | 431 |
|
432 |
||
433 |
/** |
|
434 |
RnD trace with three parameters. This calls OstTraceGen3, which is generated by trace compiler. |
|
435 |
The generated function will pack the parameters into a stack-allocated buffer and |
|
436 |
call OstTraceData with the buffer. |
|
437 |
||
438 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
439 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
440 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
441 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
442 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
443 |
The text itself is not sent in the trace packet |
|
444 |
@param aParam1 The first parameter to be traced |
|
445 |
@param aParam2 The second parameter to be traced |
|
446 |
@param aParam3 The third parameter to be traced |
|
447 |
*/ |
|
448 |
#define OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \ |
|
| 289 | 449 |
OstTraceDefExt3( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) |
| 0 | 450 |
|
451 |
||
452 |
/** |
|
453 |
RnD trace with four parameters. This calls OstTraceGen4, which is generated by trace compiler. |
|
454 |
The generated function will pack the parameters into a stack-allocated buffer and |
|
455 |
call OstTraceData with the buffer. |
|
456 |
||
457 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
458 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
459 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
460 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
461 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
462 |
The text itself is not sent in the trace packet |
|
463 |
@param aParam1 The first parameter to be traced |
|
464 |
@param aParam2 The second parameter to be traced |
|
465 |
@param aParam3 The third parameter to be traced |
|
466 |
@param aParam4 The fourth parameter to be traced |
|
467 |
*/ |
|
468 |
#define OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \ |
|
| 289 | 469 |
OstTraceDefExt4( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) |
| 0 | 470 |
|
471 |
||
472 |
/** |
|
473 |
RnD trace with five parameters. This calls OstTraceGen5, which is generated by trace compiler. |
|
474 |
The generated function will pack the parameters into a stack-allocated buffer and |
|
475 |
call OstTraceData with the buffer. |
|
476 |
||
477 |
@param aGroupName Name of the trace group. Trace Compiler associates the group name with a 16-bit integer. |
|
478 |
Then, it combines the group name with a unique trace id (16-bit integer) to produce the trace name |
|
479 |
(aTraceName 32-bit integer). Only the trace name is sent in the trace packet. |
|
480 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
481 |
@param aTraceText The trace text, which is parsed by the trace compiler. |
|
482 |
The text itself is not sent in the trace packet |
|
483 |
@param aParam1 The first parameter to be traced |
|
484 |
@param aParam2 The second parameter to be traced |
|
485 |
@param aParam3 The third parameter to be traced |
|
486 |
@param aParam4 The fourth parameter to be traced |
|
487 |
@param aParam5 The fifth parameter to be traced |
|
488 |
*/ |
|
489 |
#define OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \ |
|
| 289 | 490 |
OstTraceDefExt5( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) |
| 0 | 491 |
|
492 |
||
493 |
/** |
|
494 |
Function entry trace without extra parameters. |
|
495 |
The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler |
|
496 |
||
497 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
498 |
*/ |
|
499 |
#define OstTraceFunctionEntry0( aTraceName ) \ |
|
| 289 | 500 |
do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
|
| 0 | 501 |
BTraceFilteredContext8( EXTRACT_GROUP_ID(aTraceName), \ |
502 |
EOstTrace, \ |
|
503 |
KOstTraceComponentID, \ |
|
504 |
aTraceName );} while (0) |
|
505 |
||
506 |
||
507 |
/** |
|
508 |
Function entry trace with a parameter representing the instance identifier. |
|
509 |
The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler |
|
510 |
||
511 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
512 |
@param aInstance The instance identifier, for example "this" pointer |
|
513 |
*/ |
|
514 |
#define OstTraceFunctionEntry1( aTraceName, aInstance ) \ |
|
| 289 | 515 |
do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
|
| 0 | 516 |
BTraceFilteredContext12( EXTRACT_GROUP_ID(aTraceName), \ |
517 |
EOstTrace, \ |
|
518 |
KOstTraceComponentID, \ |
|
519 |
aTraceName, \ |
|
520 |
(TUint32) aInstance );} while (0) |
|
521 |
||
522 |
||
523 |
/** |
|
524 |
Function entry trace, which traces function parameters. |
|
525 |
The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler |
|
526 |
||
527 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
528 |
@param aInstance Name of the instance identifier |
|
529 |
*/ |
|
530 |
#define OstTraceFunctionEntryExt( aTraceName, aInstance ) \ |
|
| 289 | 531 |
do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
|
| 0 | 532 |
OstTraceGenExt( aTraceName, ( TUint )aInstance );} while (0) |
533 |
||
534 |
||
535 |
/** |
|
536 |
Function exit trace without extra parameters. |
|
537 |
The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler |
|
538 |
||
539 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
540 |
*/ |
|
541 |
#define OstTraceFunctionExit0( aTraceName ) \ |
|
| 289 | 542 |
do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
|
| 0 | 543 |
BTraceFilteredContext8( EXTRACT_GROUP_ID(aTraceName), \ |
544 |
EOstTrace, \ |
|
545 |
KOstTraceComponentID, \ |
|
546 |
aTraceName );} while (0) |
|
547 |
||
548 |
||
549 |
/** |
|
550 |
Function exit trace with a parameter representing the instance identifier. |
|
551 |
The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler |
|
552 |
||
553 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
554 |
@param aInstance The instance identifier, for example "this" pointer |
|
555 |
*/ |
|
556 |
#define OstTraceFunctionExit1( aTraceName, aInstance ) \ |
|
| 289 | 557 |
do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
|
| 0 | 558 |
BTraceFilteredContext12( EXTRACT_GROUP_ID(aTraceName), \ |
559 |
EOstTrace, \ |
|
560 |
KOstTraceComponentID, \ |
|
561 |
aTraceName, \ |
|
562 |
(TUint32) aInstance );} while (0) |
|
563 |
||
564 |
||
565 |
/** |
|
566 |
Function exit trace with a parameters representing the instance identifier and return value. |
|
567 |
The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler |
|
568 |
||
569 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
570 |
@param aInstance The instance identifier, for example "this" pointer |
|
571 |
@param aRetval The function return value |
|
572 |
*/ |
|
573 |
#define OstTraceFunctionExitExt( aTraceName, aInstance, aRetval ) \ |
|
| 289 | 574 |
do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
|
| 0 | 575 |
OstTraceGen2( aTraceName, ( TUint )aInstance, aRetval );} while (0) |
576 |
||
577 |
||
578 |
/** |
|
579 |
Performance measurement event start trace without extra parameters. |
|
580 |
The trace is mapped to TRACE_PERFORMANCE group by the trace compiler |
|
581 |
||
582 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
583 |
@param aEventName The name of the event. A corresponding OstTraceEventStop call must be made later in code |
|
584 |
*/ |
|
585 |
#define OstTraceEventStart0( aTraceName, aEventName ) \ |
|
| 289 | 586 |
OstTraceDef1( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_PERFORMANCE", aTraceName, null, (TInt32)1 ) |
| 0 | 587 |
|
588 |
||
589 |
/** |
|
590 |
Performance measurement event start trace with single 32-bit parameter. |
|
591 |
The trace is mapped to TRACE_PERFORMANCE group by the trace compiler |
|
592 |
||
593 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
594 |
@param aEventName The name of the event. A corresponding OstTraceEventStop call must be made later in code |
|
595 |
@param aParam The parameter to be associated to the event |
|
596 |
*/ |
|
597 |
#define OstTraceEventStart1( aTraceName, aEventName, aParam ) \ |
|
| 289 | 598 |
OstTraceDef1( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_PERFORMANCE", aTraceName, null, aParam ) |
| 0 | 599 |
|
600 |
||
601 |
/** |
|
602 |
Performance measurement event end trace. |
|
603 |
The trace is mapped to TRACE_PERFORMANCE group by the trace compiler |
|
604 |
||
605 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
606 |
@param aEventName The name of the event. Must match a name passed to OstTraceEventStart |
|
607 |
@param aStartTraceName Event start trace name. Must match a Trace Name of OstTraceEventStart trace |
|
608 |
*/ |
|
609 |
#define OstTraceEventStop( aTraceName, aEventName, aStartTraceName ) \ |
|
| 289 | 610 |
OstTraceDefExt2( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_PERFORMANCE", aTraceName, null, (TInt32)0, (TUint32)(aStartTraceName & 0xFFFF) ) |
| 0 | 611 |
|
612 |
||
613 |
/** |
|
614 |
State transition event. |
|
615 |
The trace is mapped to TRACE_STATE group by the trace compiler |
|
616 |
||
617 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
618 |
@param aStateName The name of the state, literal string (for example "name") |
|
619 |
@param aNewState The new value for the state, literal string (for example "value") |
|
620 |
*/ |
|
621 |
#define OstTraceState0( aTraceName, aStateName, aNewState ) \ |
|
| 289 | 622 |
OstTraceDefExt2( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_STATE", aTraceName, null, _L8(aStateName), _L8(aNewState) ) |
| 0 | 623 |
|
624 |
||
625 |
/** |
|
626 |
State transition event with instance identifier. |
|
627 |
The trace is mapped to TRACE_STATE group by the trace compiler |
|
628 |
||
629 |
@param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique |
|
630 |
@param aStateName The name of the state, literal string (for example "name") |
|
631 |
@param aNewState The new value for the state, literal string (for example "value") |
|
632 |
@param aInstance The instance identifier, for example "this" pointer |
|
633 |
*/ |
|
634 |
#define OstTraceState1( aTraceName, aStateName, aNewState, aInstance ) \ |
|
| 289 | 635 |
OstTraceDefExt3( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_STATE", aTraceName, null, _L8(aStateName), _L8(aNewState), (TUint32) aInstance ) |
| 0 | 636 |
|
637 |
#else // OST_TRACE_COMPILER_IN_USE |
|
638 |
||
639 |
/** |
|
640 |
API is defined empty if the trace compiler has not been run |
|
641 |
*/ |
|
642 |
||
643 |
#define OstTraceDef0( aCategory, aGroupName, aTraceName, aTraceText ) |
|
644 |
#define OstTraceDef1( aCategory, aGroupName, aTraceName, aTraceText, aParam ) |
|
645 |
#define OstTraceDefData( aCategory, aGroupName, aTraceName, aTraceText, aPtr, aLength ) |
|
646 |
#define OstTraceDefExt1( aCategory, aGroupName, aTraceName, aTraceText, aParam ) |
|
647 |
#define OstTraceDefExt2( aCategory, aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) |
|
648 |
#define OstTraceDefExt3( aCategory, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) |
|
649 |
#define OstTraceDefExt4( aCategory, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) |
|
650 |
#define OstTraceDefExt5( aCategory, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) |
|
651 |
||
652 |
#define OstTrace0( aGroupName, aTraceName, aTraceText ) |
|
653 |
#define OstTrace1( aGroupName, aTraceName, aTraceText, aParam ) |
|
654 |
#define OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) |
|
655 |
#define OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam ) |
|
656 |
#define OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) |
|
657 |
#define OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) |
|
658 |
#define OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) |
|
659 |
#define OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) |
|
660 |
||
661 |
#define OstTraceFunctionEntry0( aTraceName ) |
|
662 |
#define OstTraceFunctionEntry1( aTraceName, aInstance ) |
|
663 |
#define OstTraceFunctionEntryExt(aTraceName, aInstance) |
|
664 |
#define OstTraceFunctionExit0( aTraceName ) |
|
665 |
#define OstTraceFunctionExit1( aTraceName, aInstance ) |
|
666 |
#define OstTraceEventStart0( aTraceName, aEventName ) |
|
667 |
#define OstTraceEventStart1( aTraceName, aEventName, aParam ) |
|
668 |
#define OstTraceFunctionExitExt(aTraceName, aInstance, aRetval) |
|
669 |
#define OstTraceEventStop( aTraceName, aEventName, aStartTraceName ) |
|
670 |
#define OstTraceState0( aTraceName, aStateName, aNewState ) |
|
671 |
#define OstTraceState1( aTraceName, aStateName, aNewState, aInstance ) |
|
672 |
||
673 |
#endif // OST_TRACE_COMPILER_IN_USE |
|
674 |
||
675 |
||
676 |
// Data types |
|
677 |
||
678 |
/** |
|
679 |
BTrace sub-category IDs for OpenSystemTrace category |
|
680 |
*/ |
|
681 |
enum TSubcategoryOpenSystemTrace |
|
682 |
{
|
|
683 |
/** |
|
684 |
* Normal trace |
|
685 |
*/ |
|
686 |
EOstTrace = 0, |
|
687 |
||
688 |
/** |
|
689 |
* Queries if trace is active without sending it |
|
690 |
*/ |
|
691 |
EOstTraceActivationQuery = 1 |
|
692 |
}; |
|
693 |
||
694 |
// Forward declarations |
|
695 |
||
696 |
/** |
|
697 |
Template class for array parameter types |
|
698 |
For example, to wrap an integer array to a trace: |
|
699 |
TInt arr[5]; |
|
700 |
OstTraceExt( GRP, TRC, "Array: %{int32[]}", TOstArray< TInt >( arr, 5 ) );
|
|
701 |
*/ |
|
702 |
template< class T > |
|
703 |
class TOstArray |
|
704 |
{
|
|
705 |
public: |
|
706 |
/** |
|
707 |
* Constructor |
|
708 |
* |
|
709 |
* @param aArray the array data |
|
710 |
* @param aLength the number of elements in the array |
|
711 |
*/ |
|
712 |
TOstArray( const T* aArray, TInt aLength ) : iArray( aArray ), iLength( aLength ) {}
|
|
713 |
||
714 |
/** |
|
715 |
* Gets the array data pointer. |
|
716 |
* Used from the functions generated by trace compiler |
|
717 |
* |
|
718 |
* @return The array data pointer. |
|
719 |
*/ |
|
720 |
const T* Ptr() const { return iArray; }
|
|
721 |
||
722 |
/** |
|
723 |
* Gets the number of elements in the array. |
|
724 |
* Used from the functions generated by trace compiler |
|
725 |
* |
|
726 |
* @return The number of elements in the array. |
|
727 |
*/ |
|
728 |
TInt Length() const { return iLength; }
|
|
729 |
||
730 |
/** |
|
731 |
* Gets the number of bytes occupied by the array. |
|
732 |
* Used from the functions generated by trace compiler |
|
733 |
* |
|
734 |
* @return The number of bytes occupied by the array. |
|
735 |
*/ |
|
736 |
TInt Size() const { return sizeof( T ) * iLength; }
|
|
737 |
||
738 |
private: |
|
739 |
/** |
|
740 |
* Array data |
|
741 |
*/ |
|
742 |
const T* iArray; |
|
743 |
||
744 |
/** |
|
745 |
* Array length, as number of elements |
|
746 |
*/ |
|
747 |
TInt iLength; |
|
748 |
}; |
|
749 |
||
750 |
||
751 |
// Class declaration |
|
752 |
||
753 |
#endif //OPENSYSTEMTRACEV2_H |