http://perfinsp.sourceforge.net/swtrace.html

Home

SWTRACE - Software Trace Facility

Contents

General Description

    SWTRACE is a software tracing mechanism that is normally run from a command prompt by issuing the swtrace command with the appropriate arguments.

    swtrace uses software trace hooks to collect data. Trace hooks are identified by both a major code and a minor code. Trace data is collected to a trace buffer that is allocated when swtrace is initialized or when swtrace is turned on. The size of the trace buffer can be set when swtrace is initialized. The swtrace command allows the user to select which major codes are traced, when tracing starts, when tracing stops, when data is transferred from the trace buffer to disk and formatting of the trace data.

swtrace Syntax

Running swtrace

Initializing swtrace

    swtrace must be initialized using the swtrace init command. When swtrace is initialized, the required trace buffers (one per processor) are allocated in the kernel address space. The default buffer size is 3MB per processor. Tracing is started when the swtrace on command is issued.

    To initialize swtrace, enable tracing for major codes 4 (0x04), 16 (0x10) and 18 (0x12), and begin tracing, enter:

            swtrace init
            swtrace enable 4 16 18
            swtrace on

Enabling Trace Hooks (major codes)

    Major codes to be traced are enabled using the swtrace enable command. Although hooks are identified by a major and minor code, they can only be enabled/disabled by major code: all minor codes associated with a specified major code are either enabled or disabled. There is no capability to enable/disable a single hook (that is, a major/minor code combination).

    To enable tracing for major codes 4 (0x04), 16 (0x10) and 18 (0x12), enter:

            swtrace enable 4 16 18

                 - OR -

            swtrace enable 0x04 0x10 0x12

Collecting Trace Data

    After the desired set of major codes has been enabled, tracing is started using the swtrace on command. Tracing starts immediately. Tracing is stopped using the swtrace off command.

    To start/stop tracing, enter:

            swtrace enable [desired major codes]
            swtrace on
            --- run workload to be traced ---
            swtrace off

Capturing and Post-processing Trace Data

    After tracing has completed and swtrace has been turned off, use the swtrace get command to extract the trace data from the trace buffer and copy it to disk. swtrace get copies the data, in binary form, to a filed named swtrace.nrm2 by default. The data in swtrace.nrm2 is then post-processed using the post command. post formats the trace data and produces file post.show.

    To capture the contents of the trace buffer to file swtrace.nrm2 and post-process it, enter:

            swtrace get
            post -showx

swtrace Command Examples

    swtrace enable
    This activates all trace major codes.
     
    swtrace init -s 4
    This will allocate a trace buffer of 4 MB per processor and initialize swtrace.
     
    swtrace on
    This will turn tracing on.
     
    swtrace off
    This will turn tracing off. Once tracing is off, the user may then process the trace data contained in the trace buffer without having additional data written to the buffer.
     
    swtrace get  mytrace.nrm2
    This will extract the trace buffer into the file mytrace.nrm2.
     
    post -r mytrace.nrm2 -showx
    This will process the RAW file mytrace.nrm2 and generate an ASCII version in post.show.
     
    swtrace disable
    This will deactivate all trace major codes.
     
    swtrace free
    This will turn tracing off and free any swtrace buffers.
Home

Reply via email to