kernel/eka/include/opensystemtrace.h
changeset 289 55a0a1279a7e
parent 90 947f0dc9f7a8
equal deleted inserted replaced
287:ddfd5aa0d58f 289:55a0a1279a7e
    20 #include <opensystemtrace_types.h>
    20 #include <opensystemtrace_types.h>
    21 
    21 
    22 /**
    22 /**
    23 This macro defines the version of the Open System Trace instrumentation API.
    23 This macro defines the version of the Open System Trace instrumentation API.
    24 */
    24 */
    25 #define OST_INSTRUMENTATION_API_VERSION 2.1.0
    25 #define OST_INSTRUMENTATION_API_VERSION 2.2.0
    26 
    26 
    27 
    27 
    28 /**
    28 /**
    29 Methods for tracing from user side.
    29 Methods for tracing from user side.
    30 
    30 
   128 */
   128 */
   129 #define OST_TRACE_CATEGORY_PRODUCTION 0x00000001
   129 #define OST_TRACE_CATEGORY_PRODUCTION 0x00000001
   130 
   130 
   131 /**
   131 /**
   132 Preprocessor category for RnD traces
   132 Preprocessor category for RnD traces
   133 */
   133 @deprecated Use OST_TRACE_CATEGORY_PRODUCTION
   134 #define OST_TRACE_CATEGORY_RND 0x00000002
   134 */
       
   135 #define OST_TRACE_CATEGORY_RND OST_TRACE_CATEGORY_PRODUCTION
   135 
   136 
   136 /**
   137 /**
   137 Preprocessor category for performance measurement traces
   138 Preprocessor category for performance measurement traces
   138 */
   139 */
   139 #define OST_TRACE_CATEGORY_PERFORMANCE_MEASUREMENT 0x00000004
   140 #define OST_TRACE_CATEGORY_PERFORMANCE_MEASUREMENT 0x00000004
   358 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   359 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   359 @param aTraceText The trace text, which is parsed by the trace compiler.
   360 @param aTraceText The trace text, which is parsed by the trace compiler.
   360                   The text itself is not sent in the trace packet
   361                   The text itself is not sent in the trace packet
   361 */
   362 */
   362 #define OstTrace0( aGroupName, aTraceName, aTraceText ) \
   363 #define OstTrace0( aGroupName, aTraceName, aTraceText ) \
   363     OstTraceDef0( OST_TRACE_CATEGORY_RND, aGroupName, aTraceName, aTraceText )
   364     OstTraceDef0( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText )
   364 
   365 
   365 
   366 
   366 /**
   367 /**
   367 RnD trace with one 32-bit parameter
   368 RnD trace with one 32-bit parameter
   368 
   369 
   373 @param aTraceText The trace text, which is parsed by the trace compiler.
   374 @param aTraceText The trace text, which is parsed by the trace compiler.
   374                   The text itself is not sent in the trace packet
   375                   The text itself is not sent in the trace packet
   375 @param aParam The 32-bit value to be traced
   376 @param aParam The 32-bit value to be traced
   376 */
   377 */
   377 #define OstTrace1( aGroupName, aTraceName, aTraceText, aParam ) \
   378 #define OstTrace1( aGroupName, aTraceName, aTraceText, aParam ) \
   378     OstTraceDef1( OST_TRACE_CATEGORY_RND, aGroupName, aTraceName, aTraceText, aParam )
   379     OstTraceDef1( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam )
   379 
   380 
   380 
   381 
   381 /**
   382 /**
   382 RnD trace with more than 32 bits of data
   383 RnD trace with more than 32 bits of data
   383 
   384 
   389                   The text itself is not sent in the trace packet
   390                   The text itself is not sent in the trace packet
   390 @param aPtr Pointer to the data to be traced
   391 @param aPtr Pointer to the data to be traced
   391 @param aLength Length of the data to be traced
   392 @param aLength Length of the data to be traced
   392 */
   393 */
   393 #define OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) \
   394 #define OstTraceData( aGroupName, aTraceName, aTraceText, aPtr, aLength ) \
   394     OstTraceDefData( OST_TRACE_CATEGORY_RND, aGroupName, aTraceName, aTraceText, aPtr, aLength )
   395     OstTraceDefData( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aPtr, aLength )
   395 
   396 
   396 
   397 
   397 /**
   398 /**
   398 RnD trace with one parameter that is not 32-bit integer. This calls OstTraceGen1,
   399 RnD trace with one parameter that is not 32-bit integer. This calls OstTraceGen1,
   399 which is generated by the trace compiler. The generated function will pack the
   400 which is generated by the trace compiler. The generated function will pack the
   406 @param aTraceText The trace text, which is parsed by the trace compiler.
   407 @param aTraceText The trace text, which is parsed by the trace compiler.
   407                   The text itself is not sent in the trace packet
   408                   The text itself is not sent in the trace packet
   408 @param aParam The parameter to be traced
   409 @param aParam The parameter to be traced
   409 */
   410 */
   410 #define OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \
   411 #define OstTraceExt1( aGroupName, aTraceName, aTraceText, aParam ) \
   411     OstTraceDefExt1( OST_TRACE_CATEGORY_RND, aGroupName, aTraceName, aTraceText, aParam )
   412     OstTraceDefExt1( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam )
   412 
   413 
   413 
   414 
   414 /**
   415 /**
   415 RnD trace with two parameters. This calls OstTraceGen2, which is generated by trace compiler.
   416 RnD trace with two parameters. This calls OstTraceGen2, which is generated by trace compiler.
   416 The generated function will pack the parameters into a stack-allocated buffer and
   417 The generated function will pack the parameters into a stack-allocated buffer and
   424                   The text itself is not sent in the trace packet
   425                   The text itself is not sent in the trace packet
   425 @param aParam1 The first parameter to be traced
   426 @param aParam1 The first parameter to be traced
   426 @param aParam2 The second parameter to be traced
   427 @param aParam2 The second parameter to be traced
   427 */
   428 */
   428 #define OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \
   429 #define OstTraceExt2( aGroupName, aTraceName, aTraceText, aParam1, aParam2 ) \
   429     OstTraceDefExt2( OST_TRACE_CATEGORY_RND, aGroupName, aTraceName, aTraceText, aParam1, aParam2 )
   430     OstTraceDefExt2( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam1, aParam2 )
   430 
   431 
   431 
   432 
   432 /**
   433 /**
   433 RnD trace with three parameters. This calls OstTraceGen3, which is generated by trace compiler.
   434 RnD trace with three parameters. This calls OstTraceGen3, which is generated by trace compiler.
   434 The generated function will pack the parameters into a stack-allocated buffer and
   435 The generated function will pack the parameters into a stack-allocated buffer and
   443 @param aParam1 The first parameter to be traced
   444 @param aParam1 The first parameter to be traced
   444 @param aParam2 The second parameter to be traced
   445 @param aParam2 The second parameter to be traced
   445 @param aParam3 The third parameter to be traced
   446 @param aParam3 The third parameter to be traced
   446 */
   447 */
   447 #define OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \
   448 #define OstTraceExt3( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 ) \
   448     OstTraceDefExt3( OST_TRACE_CATEGORY_RND, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 )
   449     OstTraceDefExt3( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3 )
   449 
   450 
   450 
   451 
   451 /**
   452 /**
   452 RnD trace with four parameters. This calls OstTraceGen4, which is generated by trace compiler.
   453 RnD trace with four parameters. This calls OstTraceGen4, which is generated by trace compiler.
   453 The generated function will pack the parameters into a stack-allocated buffer and
   454 The generated function will pack the parameters into a stack-allocated buffer and
   463 @param aParam2 The second parameter to be traced
   464 @param aParam2 The second parameter to be traced
   464 @param aParam3 The third parameter to be traced
   465 @param aParam3 The third parameter to be traced
   465 @param aParam4 The fourth parameter to be traced
   466 @param aParam4 The fourth parameter to be traced
   466 */
   467 */
   467 #define OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \
   468 #define OstTraceExt4( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 ) \
   468     OstTraceDefExt4( OST_TRACE_CATEGORY_RND, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 )
   469     OstTraceDefExt4( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4 )
   469 
   470 
   470 
   471 
   471 /**
   472 /**
   472 RnD trace with five parameters. This calls OstTraceGen5, which is generated by trace compiler.
   473 RnD trace with five parameters. This calls OstTraceGen5, which is generated by trace compiler.
   473 The generated function will pack the parameters into a stack-allocated buffer and
   474 The generated function will pack the parameters into a stack-allocated buffer and
   484 @param aParam3 The third parameter to be traced
   485 @param aParam3 The third parameter to be traced
   485 @param aParam4 The fourth parameter to be traced
   486 @param aParam4 The fourth parameter to be traced
   486 @param aParam5 The fifth parameter to be traced
   487 @param aParam5 The fifth parameter to be traced
   487 */
   488 */
   488 #define OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \
   489 #define OstTraceExt5( aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 ) \
   489     OstTraceDefExt5( OST_TRACE_CATEGORY_RND, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 )
   490     OstTraceDefExt5( OST_TRACE_CATEGORY_PRODUCTION, aGroupName, aTraceName, aTraceText, aParam1, aParam2, aParam3, aParam4, aParam5 )
   490 
   491 
   491 
   492 
   492 /**
   493 /**
   493 Function entry trace without extra parameters.
   494 Function entry trace without extra parameters.
   494 The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler
   495 The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler
   495 
   496 
   496 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   497 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   497 */
   498 */
   498 #define OstTraceFunctionEntry0( aTraceName ) \
   499 #define OstTraceFunctionEntry0( aTraceName ) \
   499     do {if ( OST_TRACE_CATEGORY_RND & OST_TRACE_CATEGORY ) \
   500     do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
   500     BTraceFilteredContext8( EXTRACT_GROUP_ID(aTraceName), \
   501     BTraceFilteredContext8( EXTRACT_GROUP_ID(aTraceName), \
   501                         EOstTrace, \
   502                         EOstTrace, \
   502                         KOstTraceComponentID, \
   503                         KOstTraceComponentID, \
   503                         aTraceName );} while (0)
   504                         aTraceName );} while (0)
   504 
   505 
   509 
   510 
   510 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   511 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   511 @param aInstance The instance identifier, for example "this" pointer
   512 @param aInstance The instance identifier, for example "this" pointer
   512 */
   513 */
   513 #define OstTraceFunctionEntry1( aTraceName, aInstance ) \
   514 #define OstTraceFunctionEntry1( aTraceName, aInstance ) \
   514     do {if ( OST_TRACE_CATEGORY_RND & OST_TRACE_CATEGORY ) \
   515     do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
   515     BTraceFilteredContext12( EXTRACT_GROUP_ID(aTraceName), \
   516     BTraceFilteredContext12( EXTRACT_GROUP_ID(aTraceName), \
   516                          EOstTrace, \
   517                          EOstTrace, \
   517                          KOstTraceComponentID, \
   518                          KOstTraceComponentID, \
   518                          aTraceName, \
   519                          aTraceName, \
   519                          (TUint32) aInstance );} while (0)
   520                          (TUint32) aInstance );} while (0)
   525 
   526 
   526 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   527 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   527 @param aInstance Name of the instance identifier
   528 @param aInstance Name of the instance identifier
   528 */
   529 */
   529 #define OstTraceFunctionEntryExt( aTraceName, aInstance ) \
   530 #define OstTraceFunctionEntryExt( aTraceName, aInstance ) \
   530     do {if ( OST_TRACE_CATEGORY_RND & OST_TRACE_CATEGORY ) \
   531     do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
   531         OstTraceGenExt( aTraceName, ( TUint )aInstance );} while (0)
   532         OstTraceGenExt( aTraceName, ( TUint )aInstance );} while (0)
   532 
   533 
   533 
   534 
   534 /**
   535 /**
   535 Function exit trace without extra parameters.
   536 Function exit trace without extra parameters.
   536 The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler
   537 The trace is mapped to TRACE_FLOW or TRACE_API group by the trace compiler
   537 
   538 
   538 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   539 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   539 */
   540 */
   540 #define OstTraceFunctionExit0( aTraceName ) \
   541 #define OstTraceFunctionExit0( aTraceName ) \
   541     do {if ( OST_TRACE_CATEGORY_RND & OST_TRACE_CATEGORY ) \
   542     do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
   542     BTraceFilteredContext8( EXTRACT_GROUP_ID(aTraceName), \
   543     BTraceFilteredContext8( EXTRACT_GROUP_ID(aTraceName), \
   543                         EOstTrace, \
   544                         EOstTrace, \
   544                         KOstTraceComponentID, \
   545                         KOstTraceComponentID, \
   545                         aTraceName );} while (0)
   546                         aTraceName );} while (0)
   546 
   547 
   551 
   552 
   552 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   553 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   553 @param aInstance The instance identifier, for example "this" pointer
   554 @param aInstance The instance identifier, for example "this" pointer
   554 */
   555 */
   555 #define OstTraceFunctionExit1( aTraceName, aInstance ) \
   556 #define OstTraceFunctionExit1( aTraceName, aInstance ) \
   556     do {if ( OST_TRACE_CATEGORY_RND & OST_TRACE_CATEGORY ) \
   557     do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
   557     BTraceFilteredContext12( EXTRACT_GROUP_ID(aTraceName), \
   558     BTraceFilteredContext12( EXTRACT_GROUP_ID(aTraceName), \
   558                          EOstTrace, \
   559                          EOstTrace, \
   559                          KOstTraceComponentID, \
   560                          KOstTraceComponentID, \
   560                          aTraceName, \
   561                          aTraceName, \
   561                          (TUint32) aInstance );} while (0)
   562                          (TUint32) aInstance );} while (0)
   568 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   569 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   569 @param aInstance The instance identifier, for example "this" pointer
   570 @param aInstance The instance identifier, for example "this" pointer
   570 @param aRetval The function return value
   571 @param aRetval The function return value
   571 */
   572 */
   572 #define OstTraceFunctionExitExt( aTraceName, aInstance, aRetval ) \
   573 #define OstTraceFunctionExitExt( aTraceName, aInstance, aRetval ) \
   573     do {if ( OST_TRACE_CATEGORY_RND & OST_TRACE_CATEGORY ) \
   574     do {if ( OST_TRACE_CATEGORY_PRODUCTION & OST_TRACE_CATEGORY ) \
   574         OstTraceGen2( aTraceName, ( TUint )aInstance, aRetval );} while (0)
   575         OstTraceGen2( aTraceName, ( TUint )aInstance, aRetval );} while (0)
   575 
   576 
   576 
   577 
   577 /**
   578 /**
   578 Performance measurement event start trace without extra parameters.
   579 Performance measurement event start trace without extra parameters.
   580 
   581 
   581 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   582 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   582 @param aEventName The name of the event. A corresponding OstTraceEventStop call must be made later in code
   583 @param aEventName The name of the event. A corresponding OstTraceEventStop call must be made later in code
   583 */
   584 */
   584 #define OstTraceEventStart0( aTraceName, aEventName ) \
   585 #define OstTraceEventStart0( aTraceName, aEventName ) \
   585         OstTraceDef1( OST_TRACE_CATEGORY_RND, "TRACE_PERFORMANCE", aTraceName, null, (TInt32)1 )
   586         OstTraceDef1( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_PERFORMANCE", aTraceName, null, (TInt32)1 )
   586 
   587 
   587 
   588 
   588 /**
   589 /**
   589 Performance measurement event start trace with single 32-bit parameter.
   590 Performance measurement event start trace with single 32-bit parameter.
   590 The trace is mapped to TRACE_PERFORMANCE group by the trace compiler
   591 The trace is mapped to TRACE_PERFORMANCE group by the trace compiler
   592 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   593 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   593 @param aEventName The name of the event. A corresponding OstTraceEventStop call must be made later in code
   594 @param aEventName The name of the event. A corresponding OstTraceEventStop call must be made later in code
   594 @param aParam The parameter to be associated to the event
   595 @param aParam The parameter to be associated to the event
   595 */
   596 */
   596 #define OstTraceEventStart1( aTraceName, aEventName, aParam ) \
   597 #define OstTraceEventStart1( aTraceName, aEventName, aParam ) \
   597         OstTraceDef1( OST_TRACE_CATEGORY_RND, "TRACE_PERFORMANCE", aTraceName, null, aParam )
   598         OstTraceDef1( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_PERFORMANCE", aTraceName, null, aParam )
   598 
   599 
   599 
   600 
   600 /**
   601 /**
   601 Performance measurement event end trace.
   602 Performance measurement event end trace.
   602 The trace is mapped to TRACE_PERFORMANCE group by the trace compiler
   603 The trace is mapped to TRACE_PERFORMANCE group by the trace compiler
   604 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   605 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   605 @param aEventName The name of the event. Must match a name passed to OstTraceEventStart
   606 @param aEventName The name of the event. Must match a name passed to OstTraceEventStart
   606 @param aStartTraceName Event start trace name. Must match a Trace Name of OstTraceEventStart trace
   607 @param aStartTraceName Event start trace name. Must match a Trace Name of OstTraceEventStart trace
   607 */
   608 */
   608 #define OstTraceEventStop( aTraceName, aEventName, aStartTraceName ) \
   609 #define OstTraceEventStop( aTraceName, aEventName, aStartTraceName ) \
   609         OstTraceDefExt2( OST_TRACE_CATEGORY_RND, "TRACE_PERFORMANCE", aTraceName, null, (TInt32)0, (TUint32)(aStartTraceName & 0xFFFF) ) 
   610         OstTraceDefExt2( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_PERFORMANCE", aTraceName, null, (TInt32)0, (TUint32)(aStartTraceName & 0xFFFF) ) 
   610 
   611 
   611 
   612 
   612 /**
   613 /**
   613 State transition event.
   614 State transition event.
   614 The trace is mapped to TRACE_STATE group by the trace compiler
   615 The trace is mapped to TRACE_STATE group by the trace compiler
   616 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   617 @param aTraceName Name of the trace. The name is mapped to a 32-bit identifier and thus must be unique
   617 @param aStateName The name of the state, literal string (for example "name")
   618 @param aStateName The name of the state, literal string (for example "name")
   618 @param aNewState The new value for the state, literal string (for example "value")
   619 @param aNewState The new value for the state, literal string (for example "value")
   619 */
   620 */
   620 #define OstTraceState0( aTraceName, aStateName, aNewState ) \
   621 #define OstTraceState0( aTraceName, aStateName, aNewState ) \
   621         OstTraceDefExt2( OST_TRACE_CATEGORY_RND, "TRACE_STATE", aTraceName, null, _L8(aStateName), _L8(aNewState) ) 
   622         OstTraceDefExt2( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_STATE", aTraceName, null, _L8(aStateName), _L8(aNewState) ) 
   622 
   623 
   623 
   624 
   624 /**
   625 /**
   625 State transition event with instance identifier.
   626 State transition event with instance identifier.
   626 The trace is mapped to TRACE_STATE group by the trace compiler
   627 The trace is mapped to TRACE_STATE group by the trace compiler
   629 @param aStateName The name of the state, literal string (for example "name")
   630 @param aStateName The name of the state, literal string (for example "name")
   630 @param aNewState The new value for the state, literal string (for example "value")
   631 @param aNewState The new value for the state, literal string (for example "value")
   631 @param aInstance The instance identifier, for example "this" pointer
   632 @param aInstance The instance identifier, for example "this" pointer
   632 */
   633 */
   633 #define OstTraceState1( aTraceName, aStateName, aNewState, aInstance ) \
   634 #define OstTraceState1( aTraceName, aStateName, aNewState, aInstance ) \
   634         OstTraceDefExt3( OST_TRACE_CATEGORY_RND, "TRACE_STATE", aTraceName, null, _L8(aStateName), _L8(aNewState), (TUint32) aInstance ) 
   635         OstTraceDefExt3( OST_TRACE_CATEGORY_PRODUCTION, "TRACE_STATE", aTraceName, null, _L8(aStateName), _L8(aNewState), (TUint32) aInstance ) 
   635        
   636        
   636 #else // OST_TRACE_COMPILER_IN_USE
   637 #else // OST_TRACE_COMPILER_IN_USE
   637 
   638 
   638 /**
   639 /**
   639 API is defined empty if the trace compiler has not been run
   640 API is defined empty if the trace compiler has not been run