Go to main content

Oracle® Solaris 11.4 DTrace (Dynamic Tracing) Guide

Exit Print View

Updated: September 2020
 
 

sysinfo Provider

The sysinfo provider include probes that correspond to kernel statistics classified by the name sys. Because these statistics provide the input for system monitoring utilities like mpstat, the sysinfo provider enables quick exploration of observed aberrant behavior.

sysinfo Probes

The sysinfo provider makes available probes that correspond to the fields in the sys named kernel statistic: a probe provided by sysinfo fires immediately before the corresponding sys value is incremented. The following example shows how to display both the names and the current values of the sys named kernel statistic using the kstat2 command. For more information about the kstat command, see the kstat2(8) man page.

$ kstat2 -g '/system/cpu/*/sys'
kstat:/system/cpu/0/sys
        bawrite                         0
        bread                           0
        bwrite                          0
        canch                           9
        cpu_load_intr                   0%
        cpu_nsec_idle                   944039523309871ns elapsed
        cpu_nsec_intr                   3400721873472ns elapsed
        cpu_nsec_kernel                 14270503585569ns elapsed
        cpu_nsec_stolen                 0ns elapsed
        cpu_nsec_user                   10374706268624ns elapsed

The sysinfo probes are described in the following table.

Table 58  sysinfo Probes
Probe
Description
bawrite
Fires whenever a buffer is about to be asynchronously written out to a device.
bread
Fires whenever a buffer is physically read from a device. bread fires after the buffer has been requested from the device, but before blocking pending its completion.
bwrite
Fires whenever a buffer is about to be written out to a device, whether synchronously or asynchronously.
idlethread
Fires whenever a CPU enters the idle loop.
intrblk
Fires whenever an interrupt thread blocks.
inv_swtch
Fires whenever a running thread is forced to involuntarily give up the CPU.
lread
Fires whenever a buffer is logically read from a device.
lwrite
Fires whenever a buffer is logically written to a device.
modload
Fires whenever a kernel module is loaded.
modunload
Fires whenever a kernel module is unloaded.
msg
Fires whenever a msgsnd or msgrcv system call is made, but before the message queue operations are performed.
mutex_adenters
Fires whenever an attempt is made to acquire an owned adaptive lock. If this probe fires, one of the lockstat provider's adaptive-block or adaptive-spin probes will also fire. For more information, see lockstat Stability.
namei
Fires whenever a name lookup is attempted in the filesystem.
nthreads
Fires whenever a thread is created.
phread
Fires whenever a raw I/O read is about to be performed.
phwrite
Fires whenever a raw I/O write is about to be performed.
procovf
Fires whenever a new process cannot be created because the system is out of process table entries.
pswitch
Fires whenever a CPU switches from executing one thread to executing another.
readch
Fires after each successful read, but before control is returned to the thread performing the read. A read may occur through the read, readv, or pread system calls. arg0 contains the number of bytes that were successfully read.
rw_rdfails
Fires whenever an attempt is made to read-lock a readers/writer when the lock is either held by a writer, or desired by a writer. If this probe fires, the lockstat provider's rw-block probe will also fire. For more information, see lockstat Stability.
rw_wrfails
Fires whenever an attempt is made to write-lock a readers/writer lock when the lock is held either by some number of readers or by another writer. If this probe fires, the lockstat provider's rw-block probe will also fire. For more information, see lockstat Stability.
sema
Fires whenever a semop system call is made, but before any semaphore operations have been performed.
sysexec
Fires whenever an exec system call is made.
sysfork
Fires whenever a fork system call is made.
sysread
Fires whenever a read, readv, or pread system call is made.
sysvfork
Fires whenever a vfork system call is made.
syswrite
Fires whenever a write, writev, or pwrite system call is made.
trap
Fires whenever a processor trap occurs. Note that some processors, in particular UltraSPARC variants, handle some light-weight traps through a mechanism that does not cause this probe to fire.
ufsdirblk
Fires whenever a directory block is read from the UFS file system. For more information, see the ufs(4FS) man page.
ufsiget
Fires whenever an inode is retrieved.
ufsinopage.
Fires after an in-core inode without any associated data pages has been made available for reuse.
ufsipage
Fires after an in-core inode with associated data pages has been made available for reuse. This probe fires after the associated data pages have been flushed to disk.
wait_ticks_io
Fires when the periodic system clock has made the determination that a CPU is otherwise idle but some threads are waiting for I/O on the CPU. This probe fires in the context of the system clock and therefore fires on the CPU running the system clock. The cpu_t argument (arg2) indicates the CPU that is described as waiting for I/O. For more information about arg2, see sysinfo Probe Arguments. wait_ticks_io exists solely for historical reasons.
writech
Fires after each successful write, but before control is returned to the thread performing the write. A write may occur through the write, writev, or pwrite system calls. arg0 contains the number of bytes that were successfully written.
xcalls
Fires whenever a cross-call is about to be made. A cross-call is the operating system's mechanism for one CPU to request immediate work of another CPU.

sysinfo Probe Arguments

The following list describes the arguments to sysinfo probes.

arg0

The value by which the statistic is to be incremented. For most probes, this argument is always 1, but for some probes this argument may take other values.

arg1

A pointer to the current value of the statistic to be incremented. This value is a 64-bit quantity that will be incremented by the value in arg0. Dereferencing this pointer enables consumers to determine the current count of the statistic corresponding to the probe.

arg2

A pointer to the cpu_t structure that corresponds to the CPU on which the statistic is to be incremented. This structure is defined in <sys/cpuvar.h>, but it is part of the kernel implementation and should be considered Private.

The value of arg0 is 1 for most sysinfo probes. However, the readch and writech probes set arg0 to the number of bytes read or written, respectively. This features permits you to determine the size of reads by executable name, as shown in the following example:

# dtrace -n readch'{@[execname] = quantize(arg0)}'
dtrace: description 'readch' matched 4 probes
^C
  xclock                                            
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
              64 |                                         0        

  acroread                                          
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
              64 |                                         0        

  FvwmAuto                                          
           value  ------------- Distribution ------------- count    
               2 |                                         0        
               4 |@@@@@@@@@@@@@                            13       
               8 |@@@@@@@@@@@@@@@@@@@@@                    21       
              16 |@@@@@                                    5        
              32 |                                         0        

  xterm                                             
           value  ------------- Distribution ------------- count    
              16 |                                         0        
              32 |@@@@@@@@@@@@@@@@@@@@@@@@                 19       
              64 |@@@@@@@@@                                7        
             128 |@@@@@@                                   5        
             256 |                                         0        

  fvwm2                                             
           value  ------------- Distribution ------------- count    
              -1 |                                         0        
               0 |@@@@@@@@@                                186      
               1 |                                         0        
               2 |                                         0        
               4 |@@                                       51       
               8 |                                         17       
              16 |                                         0        
              32 |@@@@@@@@@@@@@@@@@@@@@@@@@@               503      
              64 |                                         9        
             128 |                                         0        

  Xsun                                              
           value  ------------- Distribution ------------- count    
              -1 |                                         0        
               0 |@@@@@@@@@@@                              269      
               1 |                                         0        
               2 |                                         0        
               4 |                                         2        
               8 |@                                        31       
              16 |@@@@@                                    128      
              32 |@@@@@@@                                  171      
              64 |@                                        33       
             128 |@@@                                      85       
             256 |@                                        24       
             512 |                                         8        
            1024 |                                         21       
            2048 |@                                        26       
            4096 |                                         21       
            8192 |@@@@                                     94       
           16384 |                                         0

Using sysinfo mpstat

Examine the following output from mpstat:

CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl
 12   90  22 5760   422  299  435   26   71  116   11  1372    5  19  17  60
 13   46  18 4585   193  162  431   25   69  117   12  1039    3  17  14  66
 14   33  13 3186   405  381  397   21   58  105   10   770    2  17  11  70
 15   34  19 4769   109   78  417   23   57  115   13   962    3  14  14  69
 16   74  16 4421   437  406  448   29   77  111    8  1020    4  23  14  59
 17   51  15 4493   139  110  378   23   62  109    9   928    4  18  14  65
 18   41  14 4204   494  468  360   23   56  102    9   849    4  17  12  68
 19   37  14 4229   115   87  363   22   50  106   10   845    3  15  14  67
 20   78  17 5170   200  169  456   26   69  108    9  1119    5  21  25  49
 21   53  16 4817    78   51  394   22   56  106    9   978    4  17  22  57
 22   32  13 3474   486  463  347   22   48  106    9   769    3  17  17  63
 23   43  15 4572    59   34  361   21   46  102   10   947    4  15  22  59

From the preceding output, you might conclude that the xcal field seems too high, especially given the relative idleness of the system. mpstat determines the value in the xcal field by examining the xcalls field of the sys kernel statistic. This aberration can therefore be explored easily by enabling the xcalls sysinfo probe, as shown in the following example:

# dtrace -n xcalls'{@[execname] = count()}'
dtrace: description 'xcalls' matched 4 probes
^C
  dtterm                                                            1
  nsrd                                                              1
  in.mpathd                                                         2
  top                                                               3
  lockd                                                             4
  java_vm                                                          10
  ksh                                                              19
  iCald.pl6+RPATH                                                  28
  nwadmin                                                          30
  fsflush                                                          34
  nsrindexd                                                        45
  in.rlogind                                                       56
  in.routed                                                       100
  dtrace                                                          153
  rpc.rstatd                                                      246
  imapd                                                           377
  sched                                                           431
  nfsd                                                           1227
  find                                                           3767

The output shows where to look for the source of the cross-calls. Some number of find processes are causing the majority of the cross-calls. The following D script can be used to understand the problem in further detail:

syscall:::entry
/execname == "find"/
{
        self->syscall = probefunc;
        self->insys = 1;
}

sysinfo:::xcalls
/execname == "find"/
{
        @[self->insys ? self->syscall : "<none>"] = count();
}

syscall:::return
/self->insys/
{
        self->insys = 0;
        self->syscall = NULL;
}

This script uses the syscall provider to attribute cross-calls from find to a particular system call. Some cross-calls, such as those resulting from page faults, might not emanate from system calls. The script prints <none> in these cases. Running the script results in output similar to the following example:

# dtrace -s ./find.d
 dtrace: script './find.d' matched 444 probes
^C
  <none>                                                            2
  lstat64                                                        2433
  getdents64                                                    14873

This output indicates that the majority of cross-calls induced by find are in turn induced by getdents system calls. Further exploration would depend on the direction you want to explore. To understand why find processes are making calls to getdents, you can write a D script to aggregate on ustack when find induces a cross-call. To understand why calls to getdents are inducing cross-calls, you can write a D script to aggregate on stack when find induces a cross-call. Whatever your next step, the presence of the xcalls probe has enabled you to quickly discover the root cause of the unusual monitoring output.

sysinfo Stability

The sysinfo provider uses stability mechanism of DTrace to describe its stabilities, as shown in the following table. For more information about the stability mechanism, see DTrace Stability Mechanisms.

Table 59  Stability Mechanism for the sysinfo Provider
Element
Name Stability
Data Stability
Dependency Class
Provider
Evolving
Evolving
ISA
Module
Private
Private
Unknown
Function
Private
Private
Unknown
Name
Evolving
Evolving
ISA
Arguments
Private
Private
ISA