189 /* |
179 /* |
190 * trace with two parameters. |
180 * trace with two parameters. |
191 */ |
181 */ |
192 #define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \ |
182 #define BOstraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \ |
193 {\ |
183 {\ |
194 _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ |
184 TBuf<200> buf; TBtTraceOflowTruncate16 overflow; \ |
195 TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ |
185 buf.AppendFormat(aTraceText, &overflow, aParam1, aParam2); \ |
196 buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2); \ |
186 Trace( aGroupName, buf ); \ |
197 Trace( TrGrp, buf ); \ |
|
198 } |
187 } |
199 |
188 |
200 /* |
189 /* |
201 * trace with three parameters. |
190 * trace with three parameters. |
202 */ |
191 */ |
203 #define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \ |
192 #define BOstraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \ |
204 {\ |
193 {\ |
205 _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ |
194 TBuf<200> buf; TBtTraceOflowTruncate16 overflow; \ |
206 TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ |
195 buf.AppendFormat(aTraceText, &overflow, aParam1, aParam2, aParam3); \ |
207 buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3); \ |
196 Trace( aGroupName, buf ); \ |
208 Trace( TrGrp, buf ); \ |
|
209 } |
197 } |
210 |
198 |
211 /* |
199 /* |
212 * trace with four parameters |
200 * trace with four parameters |
213 */ |
201 */ |
214 #define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \ |
202 #define BOstraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \ |
215 {\ |
203 {\ |
216 _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ |
204 TBuf<200> buf; TBtTraceOflowTruncate16 overflow; \ |
217 TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ |
205 buf.AppendFormat(aTraceText, &overflow, aParam1, aParam2, aParam3, aParam4); \ |
218 buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4); \ |
206 Trace( aGroupName, buf ); \ |
219 Trace( TrGrp, buf ); \ |
|
220 } |
207 } |
221 |
208 |
222 /* |
209 /* |
223 * trace with five parameters |
210 * trace with five parameters |
224 */ |
211 */ |
225 #define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \ |
212 #define BOstraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \ |
226 {\ |
213 {\ |
227 _LIT(TrGrp, aGroupName); _LIT(TrTxt, aTraceText); \ |
214 TBuf<200> buf; TBtTraceOflowTruncate16 overflow; \ |
228 TBuf<512> buf; TBtTraceOflowTruncate16 overflow; \ |
215 buf.AppendFormat(aTraceText, &overflow, aParam1, aParam2, aParam3, aParam4, aParam5); \ |
229 buf.AppendFormat(TrTxt, &overflow, aParam1, aParam2, aParam3, aParam4, aParam5); \ |
216 Trace( aGroupName, buf ); \ |
230 Trace( TrGrp, buf ); \ |
|
231 } |
217 } |
232 |
218 |
233 /* |
219 /* |
234 * Function entry trace without extra parameters. |
220 * Function entry trace without extra parameters. |
235 * The trace is mapped to TRACE_API group. |
221 * The trace is mapped to TRACE_API group. |
236 */ |
222 */ |
237 #define BOstraceFunctionEntry0( aTraceName ) \ |
223 #define BOstraceFunctionEntry0( aTraceName ) \ |
238 {\ |
224 {\ |
239 _LIT(TrGrp, "[ API ]"); \ |
225 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
240 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
226 TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L(">> ") );\ |
241 _LIT(Entry, ">> "); \ |
227 Trace( _L("[ API ]"), buf ); \ |
242 TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry );\ |
|
243 Trace( TrGrp, buf ); \ |
|
244 } |
228 } |
245 |
229 |
246 /* |
230 /* |
247 * Function entry trace with a parameter representing the instance identifier, e.g. |
231 * Function entry trace with a parameter representing the instance identifier, e.g. |
248 * "this" pointer. |
232 * "this" pointer. |
249 * The trace is mapped to TRACE_API group. |
233 * The trace is mapped to TRACE_API group. |
250 */ |
234 */ |
251 #define BOstraceFunctionEntry1( aTraceName, aInstance ) \ |
235 #define BOstraceFunctionEntry1( aTraceName, aInstance ) \ |
252 {\ |
236 {\ |
253 _LIT(TrGrp, "[ API ]");\ |
237 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
254 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
238 TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L(">> ") ); \ |
255 _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d)"); \ |
239 TBtTraceOflowTruncate16 overflow; \ |
256 TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ |
240 buf.AppendFormat(_L(" 0x%X(%d)"), &overflow, aInstance, aInstance); \ |
257 TBtTraceOflowTruncate16 overflow; \ |
241 Trace( _L("[ API ]"), buf ); \ |
258 buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \ |
|
259 Trace( TrGrp, buf ); \ |
|
260 } |
242 } |
261 |
243 |
262 /* |
244 /* |
263 * Function entry trace, which traces function parameters. |
245 * Function entry trace, which traces function parameters. |
264 * The trace is mapped to TRACE_API group. |
246 * The trace is mapped to TRACE_API group. |
265 */ |
247 */ |
266 #define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \ |
248 #define BOstraceFunctionEntryExt(aTraceName, aInstance, aArg) \ |
267 { \ |
249 { \ |
268 _LIT(TrGrp, "[ API ]");\ |
250 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
269 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
251 TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L(">> ")); \ |
270 _LIT(Entry, ">> "); _LIT(Fmt, " 0x%X(%d) arg %d"); \ |
252 TBtTraceOflowTruncate16 overflow; \ |
271 TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ |
253 buf.AppendFormat(_L(" 0x%X(%d) arg %d"), &overflow, aInstance, aInstance, aArg); \ |
272 TBtTraceOflowTruncate16 overflow; \ |
254 Trace( _L("[ API ]"), buf ); \ |
273 buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aArg); \ |
|
274 Trace( TrGrp, buf ); \ |
|
275 } |
255 } |
276 /* |
256 /* |
277 * Function exit trace without extra parameters. |
257 * Function exit trace without extra parameters. |
278 * The trace is mapped to TRACE_API group. |
258 * The trace is mapped to TRACE_API group. |
279 */ |
259 */ |
280 #define BOstraceFunctionExit0( aTraceName ) \ |
260 #define BOstraceFunctionExit0( aTraceName ) \ |
281 {\ |
261 {\ |
282 _LIT(TrGrp, "[ API ]"); \ |
262 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
283 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
263 TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L("<< ")); \ |
284 _LIT(Entry, "<< "); \ |
264 Trace( _L("[ API ]"), buf ); \ |
285 TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ |
|
286 Trace( TrGrp, buf ); \ |
|
287 } |
265 } |
288 |
266 |
289 /* |
267 /* |
290 * Function exit trace with a parameter representing the instance identifier |
268 * Function exit trace with a parameter representing the instance identifier |
291 * for example "this" pointer. |
269 * for example "this" pointer. |
292 * The trace is mapped to TRACE_API group. |
270 * The trace is mapped to TRACE_API group. |
293 */ |
271 */ |
294 #define BOstraceFunctionExit1( aTraceName, aInstance ) \ |
272 #define BOstraceFunctionExit1( aTraceName, aInstance ) \ |
295 {\ |
273 {\ |
296 _LIT(TrGrp, "[ API ]"); \ |
274 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
297 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
275 TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L("<< ")); \ |
298 _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d)"); \ |
276 TBtTraceOflowTruncate16 overflow; \ |
299 TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ |
277 buf.AppendFormat(_L(" 0x%X(%d)"), &overflow, aInstance, aInstance); \ |
300 TBtTraceOflowTruncate16 overflow; \ |
278 Trace( _L("[ API ]"), buf ); \ |
301 buf.AppendFormat(Fmt, &overflow, aInstance, aInstance); \ |
|
302 Trace( TrGrp, buf ); \ |
|
303 } |
279 } |
304 |
280 |
305 /* |
281 /* |
306 * Function exit trace with parameters representing the instance identifier, |
282 * Function exit trace with parameters representing the instance identifier, |
307 * for example "this" pointer, and return value. |
283 * for example "this" pointer, and return value. |
308 * The trace is mapped to TRACE_API group. |
284 * The trace is mapped to TRACE_API group. |
309 */ |
285 */ |
310 #define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \ |
286 #define BOstraceFunctionExitExt(aTraceName, aInstance, aRetval) \ |
311 {\ |
287 {\ |
312 _LIT(TrGrp, "[ API ]");\ |
288 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
313 TPtrC8 func( (TUint8*) __PRETTY_FUNCTION__ ); \ |
289 TBuf<200> buf; buf.Copy( func.Left(150) ); buf.Insert(0, _L("<< ")); \ |
314 _LIT(Entry, "<< "); _LIT(Fmt, " 0x%X(%d) ret %d"); \ |
290 TBtTraceOflowTruncate16 overflow; \ |
315 TBuf<512> buf; buf.Copy( func ); buf.Insert(0, Entry); \ |
291 buf.AppendFormat(_L(" 0x%X(%d) ret %d"), &overflow, aInstance, aInstance, aRetval); \ |
316 TBtTraceOflowTruncate16 overflow; \ |
292 Trace( _L("[ API ]"), buf ); \ |
317 buf.AppendFormat(Fmt, &overflow, aInstance, aInstance, aRetval); \ |
|
318 Trace( TrGrp, buf ); \ |
|
319 } |
293 } |
320 |
294 |
321 /* |
295 /* |
322 * Performance measurement event start trace without extra parameters. |
296 * Performance measurement event start trace without extra parameters. |
323 * The trace is mapped to TRACE_PERFORMANCE group. |
297 * The trace is mapped to TRACE_PERFORMANCE group. |
324 */ |
298 */ |
325 #define BOstraceEventStart0( aTraceName, aEventName ) \ |
299 #define BOstraceEventStart0( aTraceName, aEventName ) \ |
326 {\ |
300 {\ |
327 _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ |
301 TBuf<200> buf(_L("[Start] ")); buf.Append( aEventName ); \ |
328 _LIT(Entry, "[Start] "); \ |
302 Trace( _L("[PFMAN]"), buf ); \ |
329 TBuf<512> buf(Entry); buf.Append( EvName ); \ |
|
330 Trace( TrGrp, buf ); \ |
|
331 } |
303 } |
332 |
304 |
333 /* |
305 /* |
334 * Performance measurement event start trace with single 32-bit parameter. |
306 * Performance measurement event start trace with single 32-bit parameter. |
335 * The trace is mapped to TRACE_PERFORMANCE group. |
307 * The trace is mapped to TRACE_PERFORMANCE group. |
336 */ |
308 */ |
337 #define BOstraceEventStart1( aTraceName, aEventName, aParam ) \ |
309 #define BOstraceEventStart1( aTraceName, aEventName, aParam ) \ |
338 {\ |
310 {\ |
339 _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ |
311 TPtrC evt(aEventName); TBuf<200> buf; \ |
340 _LIT(Entry, "[Start] %S 0x%X(%d)"); \ |
312 TBtTraceOflowTruncate16 overflow; \ |
341 TPtrC evt(EvName); TBuf<512> buf; \ |
313 buf.AppendFormat(_L("[Start] %S 0x%X(%d)"), &overflow, &evt, aParam, aParam ); \ |
342 TBtTraceOflowTruncate16 overflow; \ |
314 Trace( _L("[PFMAN]"), buf ); \ |
343 buf.AppendFormat(Entry, &overflow, &evt, aParam, aParam ); \ |
|
344 Trace( TrGrp, buf ); \ |
|
345 } |
315 } |
346 |
316 |
347 /* |
317 /* |
348 * Performance measurement event end trace. |
318 * Performance measurement event end trace. |
349 * The trace is mapped to TRACE_PERFORMANCE group. |
319 * The trace is mapped to TRACE_PERFORMANCE group. |
350 */ |
320 */ |
351 #define BOstraceEventStop( aTraceName, aEventName ) \ |
321 #define BOstraceEventStop( aTraceName, aEventName ) \ |
352 {\ |
322 {\ |
353 _LIT(TrGrp, "[PFMAN]"); _LIT(EvName, aEventName); \ |
323 TBuf<200> buf(_L("[Stop] ")); buf.Append( aEventName ); \ |
354 _LIT(Entry, "[Stop] "); \ |
324 Trace( _L("[PFMAN]"), buf ); \ |
355 TBuf<512> buf(Entry); buf.Append( EvName ); \ |
|
356 Trace( TrGrp, buf ); \ |
|
357 } |
325 } |
358 |
326 |
359 /* |
327 /* |
360 * State transition event. |
328 * State transition event. |
361 * The trace is mapped to TRACE_STATE group. |
329 * The trace is mapped to TRACE_STATE group. |
362 */ |
330 */ |
363 #define BOstraceState0( aTraceName, aStateName, aNewState ) \ |
331 #define BOstraceState0( aTraceName, aStateName, aNewState ) \ |
364 {\ |
332 {\ |
365 _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \ |
333 TPtrC evt(aStateName); TBuf<200> buf; \ |
366 _LIT(Entry, "%S 0x%X(%d)"); \ |
334 TBtTraceOflowTruncate16 overflow; \ |
367 TPtrC evt(StName); TBuf<512> buf; \ |
335 buf.AppendFormat(_L("%S 0x%X(%d)"), &overflow, &evt, aNewState, aNewState ); \ |
368 TBtTraceOflowTruncate16 overflow; \ |
336 Trace( _L("[STATE]"), buf ); \ |
369 buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState ); \ |
|
370 Trace( TrGrp, buf ); \ |
|
371 } |
337 } |
372 |
338 |
373 /* |
339 /* |
374 * State transition event with instance identifier. |
340 * State transition event with instance identifier. |
375 * The trace is mapped to TRACE_STATE group. |
341 * The trace is mapped to TRACE_STATE group. |
376 */ |
342 */ |
377 #define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \ |
343 #define BOstraceState1( aTraceName, aStateName, aNewState, aInstance ) \ |
378 {\ |
344 {\ |
379 _LIT(TrGrp, "[STATE]"); _LIT(StName, aStateName); \ |
345 TPtrC evt(aStateName); TBuf<200> buf; \ |
380 _LIT(Entry, "%S 0x%X(%d) instance=0x%X(%d)"); \ |
346 TBtTraceOflowTruncate16 overflow; \ |
381 TPtrC evt(StName); TBuf<512> buf; \ |
347 buf.AppendFormat(_L("%S 0x%X(%d) instance=0x%X(%d)"), &overflow, &evt, aNewState, aNewState, aInstance, aInstance ); \ |
382 TBtTraceOflowTruncate16 overflow; \ |
348 Trace( _L("[STATE]"), buf ); \ |
383 buf.AppendFormat(Entry, &overflow, &evt, aNewState, aNewState, aInstance, aInstance ); \ |
|
384 Trace( TrGrp, buf ); \ |
|
385 } |
349 } |
386 |
350 |
387 #endif // BLUETOOTHTRACE_MEDIA_OST |
351 #endif // BLUETOOTHTRACE_MEDIA_OST |
388 |
352 |
389 // Extended tracing macros facilitating domain specific tracing needs: |
353 // Extended tracing macros facilitating domain specific tracing needs: |