Go to main content

Oracle® Solaris 11.3 DTrace (Dynamic Tracing) Guide

Exit Print View

Updated: July 2018
 
 

Use Aggregations

DTrace's aggregations enable 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. For more information, see DTrace Aggregations.

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);
}