Chime Non-Repeating Keys

Someone recently asked me if there was a way to make DTrace display non-repeating aggregation keys. He wanted something like this:

% dtrace -qn 'syscall:::entry { @[execname, probefunc] = count(); }' -n \\
'tick-1sec { printf("\\n%25s %25s %12s\\n", "Executable", "Function", \\
"Count"); printf("%25s %25s %12s\\n", "----------", "--------", "-----"); \\
printa("%25s %25s %@12d\\n", @); }' -xaggsortkey

               Executable                  Function        Count
               ----------                  --------        -----
                     Xorg             clock_gettime           18
                                        lwp_sigmask            4
                                            pollsys            9
                                               read            8
                                         setcontext            4
                                          setitimer            8
                                             writev            1
                   dtrace                       brk            6
                                              ioctl           77
                                           lwp_park            1
                                               mmap            1
                                           p_online           64
                                           schedctl            1
                                          sigaction            4
                                          sysconfig            3
              firefox-bin                  lwp_park            8
         gnome-netstatus-                     ioctl           11
                                            pollsys            5
                                               read            2
                                              write            2
           gnome-terminal                     ioctl            4
                                            pollsys            4
                                              write            2
         gnome-vfs-daemon                   pollsys            1
                                             stat64            2
                    inetd                  lwp_park            1
                     java                     ioctl           22
                                      lwp_cond_wait            2
                                            pollsys           45
                                              yield            9
            mixer_applet2                     ioctl           27
                                            pollsys           17


I told him I didn't think so. (It might make a nice option for dtrace(1M).) I also told him that Chime can display non-repeating keys. I wanted to demonstrate using his DTrace script, but I realized he would have to sit patiently while I opened the wizard and fiddled with display properties, so I didn't bother. Later it occurred to me that a command line option for non-repeating keys would have made the demonstration simple. Hence -g (for group):

% /opt/OSOL0chime/bin/chime -n 'syscall:::entry { \\
@[execname, probefunc] = count(); }' -g


Chime non-repeating keys

I was pretty happy about that. For one thing, the wizard makes non-repeating keys a little tricky to specify, since you have to list two columns, one for the data and another for a non-repeating view of that data. The -g option does this for you, giving you one less thing to worry about in the wizard later on if you do decide to make further improvements.

In case you want lines to separate your non-repeating groups, you can use -G instead of -g:

% /opt/OSOL0chime/bin/chime -n 'syscall:::entry { \\
@[execname, probefunc] = count(); }' -G


Chime key separator lines

Anything you specify on the command line can be saved using -w. So the more you can specify directly on the command line (thanks to new options like -g and -G), the more -w can do for you. Other things you can specify on the command line include the title and column headers (with -t and -h respectively); see Chime's Command Line page for details. For this example just save the display with non-repeating keys:

% /opt/OSOL0chime/bin/chime -n 'syscall:::entry { \\
@[execname, probefunc] = count(); }' -gw
Wrote /opt/OSOL0chime/displays/new/display.xml
To run, enter "/opt/OSOL0chime/bin/chime -C
/opt/OSOL0chime/displays/new/display.xml".


Then you can tweak things in the wizard:

/opt/OSOL0chime/bin/chime -C /opt/OSOL0chime/displays/new/display.xml -W


The -C option (to specify a saved Chime display) works in combination with the -W option (for Wizard) on or after version 1.4.28 (29 Sep 2007). This lets you cut and paste from the "To run..." message in the command output above and simply tack on a -W. Before 1.4.29 the wizard came up in its initial state, requiring you to find the display with the Browse ... button.

Chime Wizard

Pretty convenient, so I thought why stop there? It might be nice if a total row could be specified just as easily. (All these things you can do in the wizard, but you can't beat the command line for instant gratification.) The result is the -T option, which generates a total for every column in your display:

% /opt/OSOL0chime/bin/chime -n 'syscall:::entry { \\
@[execname, probefunc] = count(); }' -gT


Chime Totals

If you want nicer labels like "23 executables" rather than the generic "23 keys", you can specify that in the wizard, but for a one-off, it's nice just to have the numbers without any fuss.

Again, you can rerun the command with -w to save the display, then tweak it in the wizard with -W. If you click the Next button in the wizard, you'll find your DTrace program already specified in step 2. If you continue to step 4, you can see the hidden column and the non-repeating view of the execname:

Chime Wizard Columns

The green check marks indicate that all the required column properties are already specified (although you might wish to specify others, such as alignment, thousands separator, etc). For more information about what you can do in the wizard, see Chime's New Display Wizard page.
Comments:

Post a Comment:
Comments are closed for this entry.
About

tomee

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Blogs
Other

No bookmarks in folder