O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Aggregates

Aggregates are DTrace’s way of accumulating a lot of individual pieces of data into a more useful overall view. Seeing individual read() times can be useful, if a bit voluminous. Having a min / max / average of read times may be much more interesting.

The syntax for using a DTrace aggregate looks a bit like using array.

@​n​a​m​e​[​k​e​y​]​ ​=​ ​a​g​g​f​u​n​c​(​)​;​

The leading at-sign means that an aggregate is being used, and the assignment is a function rather than an expression. There are a number of aggregating functions:

count()

Keeps count of the number of times it is called.

sum(expression)

Accumulates the total value of the expression over time.

avg(expression)

Accumulates the arithmetic average of the expression over time. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required