|
|
You can generate a trace directly from the command line. For example, to run the following one-liner from Brendan Gregg's DTrace Tools:
# Read bytes by process,
dtrace -n 'sysinfo:::readch { @bytes[execname] = sum(arg0); }'
you would simply replace "dtrace" with the "chime" command:
/opt/OSOL0chime/bin/chime -n 'sysinfo:::readch { @bytes[execname] = sum(arg0); }'

You can use -n to specify a program string and -s to specify a program file, just as you would with dtrace(1M). Similarly, you can specify DTrace options using -x option=value and -Z. The generated trace automatically supports drilldown:

You can break down selected values by any of the variables in the popup list pictured above. For example, if you right click on "Xorg" and select Xorg by CPU:

To see how Chime modified the DTrace program specified on the command line, right click the drilldown trace and select Look at DTrace Program:

To see the placeholders that Chime inserted into the DTrace program behind the scenes to support drilldown, you can run the above command with the -U option:
% /opt/OSOL0chime/bin/chime -Un 'sysinfo:::readch { @bytes[execname] = sum(arg0); }'
sysinfo:::readch
??P0??
{ @bytes[??T??] = sum(arg0); }
??T0 execname
??P0
%
The -W option opens a wizard to help you modify the generated trace:
% /opt/OSOL0chime/bin/chime -Wn 'sysinfo:::readch { @bytes[execname] = sum(arg0); }'

In Step 2 of the wizard, we also see the placeholders that Chime inserted behind the scenes to support drilldown. For more information about how to modify the trace in the wizard, see the New Trace Wizard page.
Some of the properties supported by the wizard can be set directly from the command line, such as -T to specify a title for the title bar and -H to specify column headers (as a quoted, comma-separated list). The following blog entries describe -g and -G to specify non-repeating aggregation keys, -t to add column totals, and -k to add sparklines:
Chime Non-Repeating Keys
Chime Sparklines
For example, we could specify a title and column headers for our trace, plus add sparklines and a total row, by modifying our command with these options:
% /opt/OSOL0chime/bin/chime -tkn 'sysinfo:::readch { @bytes[execname] = sum(arg0); }' -T "procbytes" -H "Executable,History,Bytes Read"

See the following blog entries for discussion of how the bitesize.d and procsystime scripts from the DTraceToolkit were adapted for Chime:
Chime and the DTraceToolkit
Chime and the DTraceToolkit Part 2
To save your trace so you can easily run it later, use the -w option to generate XML. This automatically adds the generated trace to the "My Traces" list selectable from the "Category" pulldown in the main Chime window. For example:
% /opt/OSOL0chime/bin/chime -tkn 'sysinfo:::readch { @byteexecname] = sum(arg0); }' -T "procbytes" -H "Executable,History,Bytes Read" -w
Wrote /opt/OSOL0chime/displays/new/procbytes.xml
To run, enter "/opt/OSOL0chime/bin/chime -C /opt/OSOL0chime/displays/new/procbytes.xml".
Or copy /opt/OSOL0chime/displays/new/procbytes.xml to any subdirectory of /opt/OSOL0chime/displays and Chime will load it automatically.
% /opt/OSOL0chime/bin/chime
%
Then select My Traces from the Category pulldown:

Using "chime" on the command line rather than "dtrace" has other benefits. For example, you can click on column headers to control how data is sorted:

(Hold down the Ctrl key to click on multiple columns.) You can also right click selected rows to plot values over time:
Terms of Use
|
Privacy
|
Trademarks
|
Copyright Policy
|
Site Guidelines
|
Site Map
|
Help
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Use.
© 2012, Oracle Corporation and/or its affiliates.