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

Document Information

Preface

1.  About DTrace

2.  D Programming Language

3.  Aggregations

4.  Actions and Subroutines

5.  Buffers and Buffering

6.  Output Formatting

7.  Speculative Tracing

8.  dtrace(1M) Utility

9.  Scripting

10.  Options and Tunables

11.  Providers

12.  User Process Tracing

13.  Statically Defined Tracing for User Applications

14.  Security

15.  Anonymous Tracing

16.  Postmortem Tracing

17.  Performance Considerations

Limit Enabled Probes

Use Aggregations

Use Cacheable Predicates

18.  Stability

19.  Translators

20.  Versioning

Index

Use Aggregations

As discussed in Chapter 3, Aggregations, DTrace's aggregations allow for a scalable way of aggregating data. Associative arrays might appear to offer similar functionality to aggregations. However, by nature of being global, general-purpose variables, they cannot offer the linear scalability of aggregations. You should therefore prefer to use aggregations over associative arrays when possible. The following example is not recommended:

syscall:::entry
{
        totals[execname]++;
}

syscall::rexit:entry
{
        printf("%40s %d\n", execname, totals[execname]);
        totals[execname] = 0;
}

The following example is preferable:

syscall:::entry
{
        @totals[execname] = count();
}

END
{
        printa("%40s %@d\n", @totals);
}