config IUIATraceSyncClient.injectIntoTraceFxn // module-wide |
 |
Callback function that handles injection of info such as serial numbers
of sync point events, context change events or snapshot events into a
hardware trace stream. (e.g. GEM CPU Trace, System Trace, etc.)
DETAILS
Users can provide their own custom injectIntoTraceFxn to log whatever
additional information they wish to record when the hook function is called.
For example, event serial numbers can be injected into the CPU
trace stream and / or STM trace stream in order to enable correlation
of information logged in these streams with UIA software events.
EXAMPLES
Example 1: Correlating events with C64X+ and C66 CPU Trace
The following is an example of the configuration script used
to inject serial numbers of sync point events or context change events or
snapshot Ids associated with snapshot events.
Note that the GemTraceSync module's .xs script takes care of finding
all modules that implement the IUIATraceSyncClient and assigning the
GemTraceSync_injectIntoTrace function pointer to those modules'
injectIntoTraceFxn config option.
//The following 3 modules all implement the IUIATraceSyncClient interface
var LogSnapshot = xdc.useModule('ti.uia.runtime.LogSnapshot');
var LogCtxChg = xdc.useModule('ti.uia.runtime.LogCtxChg');
var LogSync = xdc.useModule('ti.uia.runtime.LogSync');
//For C66 devices, replace the following line with
// var GemTraceSync = xdc.useModule('ti.uia.family.c66.GemTraceSync');
var GemTraceSync = xdc.useModule('ti.uia.family.c64p.GemTraceSync');
Example 2: How to create a custom hook function
and assign it to the LogSnapshot module
The following is an example of a 'C' code program that implements
a hook function that prints out the snapshot ID that is passed in
as the serialNumber
#include <xdc/std.h>
#include <xdc/runtime/Gate.h>
#include <ti/uia/runtime/IUIATraceSyncProvider.h>
#include <ti/uia/runtime/LogSnapshot.h>
#include <stdio.h>
#include <string.h>
extern Void myHookFxn(UInt32 serialNumber, IUIATraceSyncProvider_ContextType ctxType);
Void Test();
char name[32]={"Bob"};
UInt32 newAppId = 0;
Void myHookFxn(UInt32 serialNumber, IUIATraceSyncProvider_ContextType ctxType){
volatile UInt32 syncWord;
IArg key = Gate_enterSystem();
printf("newAppId written with serialNumber %d and ctxType = %d\n",serialNumber,ctxType);
Gate_leaveSystem(key);
}
Void Test(){
// note that the hook function is triggered by calling LogSnapshot_getSnapshotId()
// since that is where the unique snapshot ID that is passed to the
// hook function is generated.
Int snapshotId = LogSnapshot_getSnapshotId();
LogSnapshot_writeString(snapshotId,"User-defined name=%s.",name, strlen(name));
}
Void main(){
while(TRUE){ Test(); }
}
In order to have the above user-defined function called by the LogSnapshot
module whenever it writes an event, the following configuration script
is needed:
var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
var LogSnapshot = xdc.useModule('ti.uia.runtime.LogSnapshot');
var IUIATraceSyncClient = xdc.useModule('ti.uia.runtime.IUIATraceSyncClient');
LogSnapshot.injectIntoTraceFxn = $externFxn('myHookFxn');
SEE
metaonly config IUIATraceSyncClient.common$ // module-wide |
 |
Common module configuration parameters
DETAILS
All modules have this configuration parameter. Its name
contains the '$' character to ensure it does not conflict with
configuration parameters declared by the module. This allows
new configuration parameters to be added in the future without
any chance of breaking existing modules.
metaonly config IUIATraceSyncClient.isInjectIntoTraceEnabled // module-wide |
 |
set false to turn off injection of sync point info into trace even
if a module that implements IUIATraceSyncProvider is configured
metaonly config Bool isInjectIntoTraceEnabled = true;
DETAILS
The XDCScript associated with a module that implements IUIATraceSyncProvider
is responsible for checking this config option for all IUIATraceSyncClient
modules before automatically configuring the client callback function.
This allows users to control which features have sync points injected
into the trace stream. For example, a user may wish to configure
LogSync.isInjectIntoTraceEnabled = true and
LogCtxChg.isInjectIntoTraceEnabled = false in order to reduce the number
of sync point events injected into the trace stream.