JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris Dynamic Tracing Guide
search filter icon
search icon

Document Information

Preface

1.  Introduction

2.  Types, Operators, and Expressions

3.  Variables

4.  D Program Structure

5.  Pointers and Arrays

6.  Strings

7.  Structs and Unions

8.  Type and Constant Definitions

9.  Aggregations

10.  Actions and Subroutines

11.  Buffers and Buffering

12.  Output Formatting

13.  Speculative Tracing

14.  dtrace(1M) Utility

15.  Scripting

16.  Options and Tunables

17.  dtrace Provider

18.  lockstat Provider

19.  profile Provider

20.  fbt Provider

21.  syscall Provider

22.  sdt Provider

23.  sysinfo Provider

24.  vminfo Provider

25.  proc Provider

26.  sched Provider

27.  io Provider

28.  mib Provider

29.  fpuinfo Provider

30.  pid Provider

31.  plockstat Provider

32.  fasttrap Provider

33.  User Process Tracing

34.  Statically Defined Tracing for User Applications

35.  Security

36.  Anonymous Tracing

Anonymous Enablings

Claiming Anonymous State

Anonymous Tracing Examples

37.  Postmortem Tracing

38.  Performance Considerations

39.  Stability

40.  Translators

41.  Versioning

Glossary

Index

Anonymous Tracing Examples

The following example shows an anonymous DTrace enabling for every probe in the iprb(7D) module:

# dtrace -A -m iprb
dtrace: saved anonymous enabling in /kernel/drv/dtrace.conf
dtrace: added forceload directives to /etc/system
dtrace: run update_drv(1M) or reboot to enable changes
# reboot

After rebooting, dtrace(7D) prints a message on the console to indicate that it is enabling the specified probes:

  ...
  Copyright 1983-2003 Sun Microsystems, Inc.  All rights reserved.
  Use is subject to license terms.
  NOTICE: enabling probe 0 (:iprb::)
  NOTICE: enabling probe 1 (dtrace:::ERROR)
  configuring IPv4 interfaces: iprb0.
  ...

When the machine has rebooted, the anonymous state may be consumed by specifying the -a option with dtrace:

# dtrace -a
  CPU     ID                    FUNCTION:NAME
    0  22954                      _init:entry 
    0  22955                     _init:return 
    0  22800                  iprbprobe:entry 
    0  22934          iprb_get_dev_type:entry 
    0  22935         iprb_get_dev_type:return 
    0  22801                 iprbprobe:return 
    0  22802                 iprbattach:entry 
    0  22874               iprb_getprop:entry 
    0  22875              iprb_getprop:return 
    0  22934          iprb_get_dev_type:entry 
    0  22935         iprb_get_dev_type:return 
    0  22870             iprb_self_test:entry 
    0  22871            iprb_self_test:return 
    0  22958            iprb_hard_reset:entry 
    0  22959           iprb_hard_reset:return 
    0  22862       iprb_get_eeprom_size:entry 
    0  22826              iprb_shiftout:entry 
    0  22828            iprb_raiseclock:entry 
    0  22829           iprb_raiseclock:return 
  ...

The following example focuses only on those functions called from iprbattach(). In an editor, type the following script and save it in a file named iprb.d.

fbt::iprbattach:entry
{
    self->trace = 1;
}

fbt:::
/self->trace/
{}

fbt::iprbattach:return
{
    self->trace = 0;
}

Run the following commands to clear the previous settings from the driver configuration file, install the new anonymous tracing request, and reboot:

# dtrace -AFs iprb.d
dtrace: cleaned up old anonymous enabling in /kernel/drv/dtrace.conf
dtrace: cleaned up forceload directives in /etc/system
dtrace: saved anonymous enabling in /kernel/drv/dtrace.conf
dtrace: added forceload directives to /etc/system
dtrace: run update_drv(1M) or reboot to enable changes
# reboot

After rebooting, dtrace(7D) prints a different message on the console to indicate the slightly different enabling:

  ...
  Copyright 1983-2003 Sun Microsystems, Inc.  All rights reserved.
  Use is subject to license terms.
  NOTICE: enabling probe 0 (fbt::iprbattach:entry)
  NOTICE: enabling probe 1 (fbt:::)
  NOTICE: enabling probe 2 (fbt::iprbattach:return)
  NOTICE: enabling probe 3 (dtrace:::ERROR)
  configuring IPv4 interfaces: iprb0.
  ...

After the machine has completely booted, run the dtrace with the -a option and the -e option to consume the anonymous data and then exit.

# dtrace -ae
  CPU FUNCTION                                 
    0  -> iprbattach                            
    0    -> gld_mac_alloc                       
    0      -> kmem_zalloc                       
    0        -> kmem_cache_alloc                
    0          -> kmem_cache_alloc_debug        
    0            -> verify_and_copy_pattern     
    0            <- verify_and_copy_pattern     
    0            -> tsc_gethrtime               
    0            <- tsc_gethrtime               
    0            -> getpcstack                  
    0            <- getpcstack                  
    0            -> kmem_log_enter              
    0            <- kmem_log_enter              
    0          <- kmem_cache_alloc_debug        
    0        <- kmem_cache_alloc                
    0      <- kmem_zalloc                       
    0    <- gld_mac_alloc                       
    0    -> kmem_zalloc                         
    0      -> kmem_alloc                        
    0        -> vmem_alloc                      
    0          -> highbit                       
    0          <- highbit                       
    0          -> lowbit                        
    0          <- lowbit                        
    0          -> vmem_xalloc                   
    0            -> highbit                     
    0            <- highbit                     
    0            -> lowbit                      
    0            <- lowbit                      
    0            -> segkmem_alloc               
    0              -> segkmem_xalloc            
    0                -> vmem_alloc              
    0                  -> highbit               
    0                  <- highbit               
    0                  -> lowbit                
    0                  <- lowbit                
    0                  -> vmem_seg_alloc        
    0                    -> highbit             
    0                    <- highbit             
    0                    -> highbit             
    0                    <- highbit             
    0                    -> vmem_seg_create     
  ...