# TRACE-CMD-REPORT(1) Manual Page

## NAME

trace-cmd-report - show in ASCII a trace created by trace-cmd record

## SYNOPSIS

trace-cmd report [OPTIONS] [input-file [input-file …]]

## DESCRIPTION

The trace-cmd(1) report command will output a human readable report of a trace created by trace-cmd record.

## OPTIONS

-i input-file

  By default, trace-cmd report will read the file trace.dat. But the -i option open up the given input-file instead. Note, the input file may also be specified as the last item on the command line.

-e

  This outputs the endianess of the file. trace-cmd report is smart enough to be able to read big endian files on little endian machines, and vise versa.

-f

  This outputs the list of all functions that have been mapped in the trace.dat file. Note, this list may contain functions that may not appear in the trace, as it is the list of mappings to translate function addresses into function names.

-P

  This outputs the list of "trace_printk()" data. The raw trace data points to static pointers in the kernel. This must be stored in the trace.dat file.

-E

  This lists the possible events in the file (but this list is not necessarily the list of events in the file).

--events

  This will list the event formats that are stored in the trace.dat file.

--event regex

  This will print events that match the given regex. If a colon is specified, then the characters before the colon will be used to match the system and the characters after the colon will match the event.

      trace-cmd report --event sys:read

      The above will only match events where the system name contains "sys"
      and the event name contains "read".

      trace-cmd report --event read

      The above will match all events that contain "read" in its name. Also it
      may list all events of a system that contains "read" as well.

--check-events

  This will parse the event format strings that are stored in the trace.dat file and return whether the formats can be parsed correctly. It will load plugins unless -N is specified.

-t

  Print the full timestamp. The timestamps in the data file are usually recorded to the nanosecond. But the default display of the timestamp is only to the microsecond. To see the full timestamp, add the -t option.

-F filter

  Add a filter to limit what events are displayed. Filters defined after an input file (specified with -i) only apply to that input file. Filters provided before any input file is given are considered global and apply to all input files.

      The format of the filter is:

    SYSTEM is the name of the system to filter on. If the EVENT is left out,
    then it applies to all events under the SYSTEM. If only one string is used
    without the '/' to deliminate between SYSTEM and EVENT, then the filter
    will be applied to all systems and events that match the given string.

    Whitespace is ignored, such that "sched:next_pid==123" is equivalent to
    "sched : next_pid == 123".

    STRING is defined with single or double quotes (single quote must end with
    single quote, and double with double). Whitespace within quotes are not
    ignored.

    The representation of a SYSTEM or EVENT may also be a regular expression
    as defined by 'regcomp(3)'.

    The EVENT_FIELD is the name of the field of an event that is being
    filtered. If the event does not contain the EVENT_FIELD, that part of the
    equation will be considered false.

    The "bogus == 1" will always evaluate to FALSE because no event has a
    field called "bogus", but the "common_pid == 2" will still be evaluated
    since all events have the field "common_pid". Any "sched" event that was
    traced by the process with the PID of 2 will be shown.

    Note, the EVENT_FIELD is the field name as shown by an events format
    (as displayed with *--events*), and not what is found in the output.
    If the output shows "ID:foo" but the field that "foo" belongs to was
    called "name" in the event format, then "name" must be used in the filter.
    The same is true about values. If the value that is displayed is converted
    by to a string symbol, the filter checks the original value and not the
    value displayed. For example, to filter on all tasks that were in the
    running state at a context switch:

    Although the output displays 'R', having 'prev_stat=="R"' will not work.

    Note: You can also specify 'COMM' as an EVENT_FIELD. This will use the
    task name (or comm) of the record to compare. For example, to filter out
    all of the "trace-cmd" tasks:

-I

  Do not print events where the HARDIRQ latency flag is set. This will filter out most events that are from interrupt context. Note, it may not filter out function traced functions that are in interrupt context but were called before the kernel "in interrupt" flag was set.

-S

  Do not print events where the SOFTIRQ latency flag is set. This will filter out most events that are from soft interrupt context.

-v

  This causes the following filters of -F to filter out the matching events.

    Will not display any sched_switch events that have a prev_state of 0.
    Removing the *-v* will only print out those events.

-T

  Test the filters of -F. After processing a filter string, the resulting filter will be displayed for each event. This is useful for using a filter for more than one event where a field may not exist in all events. Also it can be used to make sure there are no misspelled event field names, as they will simply be ignored. -T is ignored if -F is not specified.

-V

  Show verbose messages (see --verbose but only for the numbers)

-L

  This will not load system wide plugins. It loads "local only". That is what it finds in the ~/.trace-cmd/plugins directory.

-N

  This will not load any plugins.

-n event-re

  This will cause all events that match the option to ignore any registered handler (by the plugins) to print the event. The normal event will be printed instead. The event-re is a regular expression as defined by regcomp(3).

--profile

  With the --profile option, "trace-cmd report" will process all the events first, and then output a format showing where tasks have spent their time in the kernel, as well as where they are blocked the most, and where wake up latencies are.

      See trace-cmd-profile(1) for more details and examples.

-G

  Set interrupt (soft and hard) events as global (associated to CPU instead of tasks). Only works for --profile.

-H event-hooks

  Add custom event matching to connect any two events together.

      See trace-cmd-profile(1) for format.

-R

  This will show the events in "raw" format. That is, it will ignore the event’s print formatting and just print the contents of each field.

-r event-re

  This will cause all events that match the option to print its raw fields. The event-re is a regular expression as defined by regcomp(3).

-l

  This adds a "latency output" format. Information about interrupts being disabled, soft irq being disabled, the "need_resched" flag being set, preempt count, and big kernel lock are all being recorded with every event. But the default display does not show this information. This option will set display this information with 6 characters. When one of the fields is zero or N/A a '.\' is shown.

    The 0d.h1. denotes this information.

    It starts with a number. This represents the CPU number that the event occurred
    on.

    The second character is one of the following:

    'd' - Interrupts are disabled
    '.' - Interrupts are enabled
    'X' - Has flags that are not yet known by trace-cmd

    The third character is the "need rescheduling" flag.

    'N' - A schedule is set to take place
    '.' - No scheduling is set

    The fourth character represents the context the event was in when it triggered

    'h' - Hard interrupt context
    's' - Soft interrupt context
    'H' - Hard interrupt context that interrupted a soft interrupt
    '.' - Normal context

    The next is a number (should be less than 10), that represents the preemption
    depth (the number of times preempt_disable() is called without preempt_enable()).
    '.' means preemption is enabled.

    On some systems, "migrate disable" may exist, in which case a number will be
    shown for that, or '.' meaning migration is enabled.

    If lockdep in enabled on the system, then the number represents the depth of
    locks that are held when the event triggered. '.' means no locks are held.

-w

  If both the sched_switch and sched_wakeup events are enabled, then this option will report the latency between the time the task was first woken, and the time it was scheduled in.

-q

  Quiet non critical warnings.

-O

  Pass options to the trace-cmd plugins that are loaded.

      -O plugin:var=value

      The 'plugin:' and '=value' are optional. Value may be left off for options
      that are boolean. If the 'plugin:' is left off, then any variable that matches
      in all plugins will be set.

      Example:  -O fgraph:tailprint

--cpu <cpu list>

  List of CPUs, separated by "," or ":", used for filtering the events. A range of CPUs can be specified using "cpuX-cpuY" notation, where all CPUs in the range between cpuX and cpuY will be included in the list. The order of CPUs in the list must be from lower to greater.

      Example:  "--cpu 0,3" - show events from CPUs 0 and 3
                "--cpu 2-4" - show events from CPUs 2, 3 and 4

--cpus

  List the CPUs that have data in the trace file then exit.

--first-event

  Show the timestamp of the first event of all CPUs that have data.

--last-event

  Show the timestamp of the last event of all CPUs that have data.

--stat

  If the trace.dat file recorded the final stats (outputed at the end of record) the --stat option can be used to retrieve them.

--uname

  If the trace.dat file recorded uname during the run, this will retrieve that information.

--version

  If the trace.dat file recorded the version of the executable used to create it, report that version.

--ts-offset offset

  Add (or subtract if negative) an offset for all timestamps of the previous data file specified with -i. This is useful to merge sort multiple trace.dat files where the difference in the timestamp is known. For example if a trace is done on a virtual guest, and another trace is done on the host. If the host timestamp is 1000 units ahead of the guest, the following can be done:

      trace-cmd report -i host.dat --ts-offset -1000 -i guest.dat

      This will subtract 1000 timestamp units from all the host events as it merges
      with the guest.dat events. Note, the units is for the raw units recorded in
      the trace. If the units are nanoseconds, the addition (or subtraction) from
      the offset will be nanoseconds even if the displayed units are microseconds.

--ts2secs HZ

  Convert the current clock source into a second (nanosecond resolution) output. When using clocks like x86-tsc, if the frequency is known, by passing in the clock frequency, this will convert the time to seconds.

      This option affects any trace.dat file given with *-i* proceeding it.
      If this option comes before any *-i* option, then that value becomes
      the default conversion for all other trace.dat files. If another
      --ts2secs option appears after a *-i* trace.dat file, than that option
      will override the default value.

      Example: On a 3.4 GHz machine

      trace-cmd record -p function -C x86-tsc

      trace-cmd report --ts2ns 3400000000

      The report will convert the cycles timestamps into a readable second
      display. The default display resolution is microseconds, unless *-t*
      is used.

      The value of --ts-offset must still be in the raw timestamp units, even
      with this option. The offset will be converted as well.

--ts-diff

  Show the time differences between events. The difference will appear in parenthesis just after the timestamp.

--ts-check

  Make sure no timestamp goes backwards, and if it does, print out a warning message of the fact.

--nodate

  Ignore converting the timestamps to the date set by trace-cmd record(3) --date option.

--raw-ts

  Display raw timestamps, without any corrections.

--align-ts

  Display timestamps aligned to the first event.

--verbose[=level]

  Set the log level. Supported log levels are "none", "crit", "err", "warn", "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log level to specific value enables all logs from that and all previous levels. The level will default to "info" if one is not specified.

      Example: enable all critical, error and warning logs

      trace-cmd report --verbose=warning

## EXAMPLES

Using a trace.dat file that was created with:

The default report shows:

The note on the third column:

It follows the same as shown in the Linux kernel `/sys/kernel/tracing/trace` file.

Is the same as explained in the -l option. Where the first position is:

    '.' - means interrupts and bottom halves enabled
    'd' - means interrupts and bottom halves are disabled

The second position:

    'N' - means that the "NEED_RESCHED" flag is set and the kernel should try to
          schedule as soon as possible.

The third position:

    '.' - In normal/schedulable context
    's' - In soft interrupt context
    'h' - In hard interrupt context
    'H' - in hard interrupt context that interrupted a soft interrupt

The forth position is the preempt count depth:

    'pass:[.]' - preemption is enabled
    '#' - the depth of preemption disabled (nested)

The fifth column is the migration disabled counter:

    '.' - migration is enabled
    '#' - the depth of migration being disabled (nested)

To see everything but the function traces:

To see only the kmalloc calls that were greater than 1000 bytes:

To see wakeups and sched switches that left the previous task in the running state:

The above needs a little explanation. The filter specifies the "sched" subsystem, which includes all scheduling events. Any event that does not have the format field "prev_state", will evaluate those expressions as FALSE, and will not produce a match. Only the sched_switch event will match that. The second "-F" will include the sched_waking event.

The above trace produces the wakeup latencies of the tasks. The "sched_switch" event reports each individual latency after writing the event information. At the end of the report, the average wakeup latency is reported, as well as the maxim and minimum latency and the timestamp they happened at. It does this for both normal tasks as well as real-time tasks.

The above version will only show the wakeups and context switches of Real Time tasks. The prio used inside the kernel starts at 0 for highest priority. That is prio 0 is equivalent to user space real time priority 99, and priority 98 is equivalent to user space real time priority 1. Prios less than 100 represent Real Time tasks. Notice that the total wake up timings are identical to the RT task timings.

An example of the profile:

## SEE ALSO

trace-cmd(1), trace-cmd-record(1), trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1), trace-cmd-profile(1)

## AUTHOR

Written by Steven Rostedt, <rostedt@goodmis.org>

## RESOURCES

https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/

## COPYING

Copyright (C) 2010 Red Hat, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL).