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

  1. Check that your VxWorks Image project has been configured to include wvLib and check that it uses a high-resolution timestamp driver
  2. Include tracealyzer.c and tracealyzer.h from the VxWorks folder in your application

Start Tracing

  1. Enable tracing by adding the call:
    STATUS tzStart(int traceLevel);

     

    The parameter traceLevel decides 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)
  2. 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.

C

Step 2: Configure Tracing

Configure Tracing

No mandatory configuration, as a default the following will be used:

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 socket
  • TZ_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 configuration
    • arg1 should be the path of the target-side tracing file
    • arg2 is the file open attributes/flags, i.e. O_CREAT | O_TRUNC
  • TZ_METHOD_SOCKET – trace is uploaded to host via a TCP socket
    • arg1 should be the address of the host copmuter that is to receive the trace
    • arg2 should be the port number to use on the host computer
C

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.

Troubleshoot Your VxWorks Trace

Resolve common setup and capture issues when using Tracealyzer.

Check the Setup Before Capturing Again

Start with a working target connection, and Tracealyzer installed on your host. Then follow the checks below for the symptom you see.
Trace File Is Empty
Confirm that tzStart is called and that tracing starts successfully. Verify that tzStop is called when using deferred storage. Check that the VxWorks image includes wvLib and the Tracealyzer source files, and verify the configured output path and file permissions.
TCP Stream Data Does Not Arrive
Verify that the host address and port configured in tzConfigStorage match the computer running Tracealyzer, and confirm that the target can reach it over the network. Check that the port is open and not blocked by a firewall, then start Tracealyzer listening before starting the trace. If data still does not arrive, confirm the target and host use the same network interface and review any connection errors reported by VxWorks.

Enhance Your Tracing Skills

Unlock deeper insights by exploring advanced trace analysis techniques and optimize your VxWorks applications.