/* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * This D script is used as an example in the Solaris Dynamic Tracing Guide * wiki in the "sdt Provider" Chapter. * * The full text of the this chapter may be found here: * * http://docs.oracle.com/cd/E36784_01/html/E36846/gkzik.html#scrolltoc * * On machines that have DTrace installed, this script is available as * interval.d in /usr/demo/dtrace, a directory that contains all D scripts * used in the Solaris Dynamic Tracing Guide. A table of the scripts and their * corresponding chapters may be found here: * * file:///usr/demo/dtrace/index.html */ #pragma D option quiet sdt:::callout-start { self->callout = ((callout_t *)arg0)->c_func; } fbt::timeout:entry /self->callout && arg2 <= 100/ { /* * In this case, we are most interested in interval timeout(9F)s that * are short. We therefore do a linear quantization from 0 ticks to * 100 ticks. The system clock's frequency ? set by the variable * "hz" ? defaults to 100, so 100 system clock ticks is one second. */ @callout[self->callout] = lquantize(arg2, 0, 100); } sdt:::callout-end { self->callout = NULL; } END { printa("%a\n%@d\n\n", @callout); }