Master Tracealyzer with VxWorks
Getting Started with Tracealyzer on VxWorks
Integrate wvLib, capture your first VxWorks trace, and analyze it in Tracealyzer.
Step 1
Integrate wvLib
Integrate wvLib into your project, enabling detailed trace analysis.
Step 2
Configure Tracing
Optional trace configurations to ensure accurate and efficient trace data capture.
Step 3
Capture Your First Trace
Capture your first trace and see how your VxWorks application executes.
Prerequisites
Before you begin
- Install Tracealyzer. If you haven’t done so, see detailed instructions here
- Existing VxWorks application
- VxWorks application builds and runs
- Target/debug connection available
Step 1: Add Tracing Capability
Integrate wvLib into Your Project
Add Tracing Capability
- Check that your VxWorks Image project has been configured to include wvLib and check that it uses a high-resolution timestamp driver
- Include tracealyzer.c and tracealyzer.h from the VxWorks folder in your application
Start Tracing
- Enable tracing by adding the call:
STATUS tzStart(int traceLevel);The parameter
traceLeveldecides the level of details, valid options are:TZ_TRACE_LEVEL_CONTEXT_SWITCH– only trace context switches (tasks and ISRs)TZ_TRACE_LEVEL_TASK_STATE– adds task state changes (ready, etc.)TZ_TRACE_LEVEL_OBJECT_AND_SYSTEM– all details (recomended)
- When you like to stop tracing, add the call:
STATUS tzStop();
Depending upon your configuration, this might also store the trace
For complete details and advanced configuration, see the detailed Tracing for VxWorks reference guide.
Step 2: Configure Tracing
Configure Tracing
tzConfigStorage(
TZ_MODE_DEFERRED,
TZ_METHOD_FILE,
"tz.wvr",
O_CREAT | O_TRUNC,
1
)
Optional configurations
The functions tzConfigStorage() and tzConfigBuffer() may be called prior tzStart to apply a custom tracing configuration:STATUS tzConfigStorage(
int storageMode,
int storageMethod,
char* arg1,
int arg2,
int storeOnStop
)
Valid options for storageMode are:
TZ_MODE_CONTINUOUS– trace is continuously written to a file or socketTZ_MODE_DEFERRED– trace is stored on command (tzStop), Default configuration
Valid options for storageMethod are:
TZ_METHOD_FILE– trace is stored on the target filesystem, Default configurationarg1should be the path of the target-side tracing filearg2is the file open attributes/flags, i.e.O_CREAT | O_TRUNC
TZ_METHOD_SOCKET– trace is uploaded to host via a TCP socketarg1should be the address of the host copmuter that is to receive the tracearg2should be the port number to use on the host computer
Step 3: Trace Capture
Capture Your First Trace
Simply transfer the captured trace file to your host by any connection means, or, in case of TCP streaming, the file will already be located at your host.
Opening the Trace
Open the captured trace file in Tracealyzer
A successful trace should show recorded task execution and other system events in the timeline.
If the trace is empty or doesn’t open correctly, see Troubleshooting.
Using Your Trace
Start by looking at:
-
Task scheduling — See when tasks execute, block and resume.
-
CPU usage — Identify tasks consuming significant CPU time.
-
Timing — Find long execution times and unexpected delays.
-
User events — Correlate trace data with application-specific behavior and custom events/logs. All synchronized into one execution timeline. Created by the call
STATUS tzEvent(char* channelName, char* formatStr, ...)
To learn more about using Tracealyzer, see Tracealyzer Features and Capabilities.