The following is a demonstration of the sar-c.d script.
Here we run both sar-c.d and "sar -c 1 100" at the same time, to compare
outputs.
The DTrace script,
# ./sar-c.d
Time scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s
2005 Jun 14 02:40:24 1556 82 71 0.00 0.00 10262 10508
2005 Jun 14 02:40:25 1553 88 75 0.00 0.00 15095 15341
2005 Jun 14 02:40:26 1596 89 76 0.00 0.00 14885 15131
2005 Jun 14 02:40:27 5395 290 154 9.00 10.00 185991 77219
2005 Jun 14 02:40:28 1755 91 98 1.00 1.00 15421 16788
2005 Jun 14 02:40:29 1757 100 91 1.00 1.00 17127 17462
2005 Jun 14 02:40:30 1603 95 80 0.00 0.00 16767 16634
2005 Jun 14 02:40:31 14380 83 2420 1.00 1.00 14556 126461
2005 Jun 14 02:40:32 10573 88 1586 0.00 0.00 14222 87888
2005 Jun 14 02:40:33 1645 87 76 0.00 0.00 15320 15608
2005 Jun 14 02:40:34 2099 167 130 0.00 0.00 126295 74281
2005 Jun 14 02:40:35 1559 79 67 0.00 0.00 11663 11977
[...]
The original command,
$ sar -c 1 100
SunOS jupiter 5.10 Generic i86pc 06/14/2005
02:40:23 scall/s sread/s swrit/s fork/s exec/s rchar/s wchar/s
02:40:24 1549 86 74 0.00 0.00 14799 15040
02:40:25 1552 85 73 0.00 0.00 14475 14719
02:40:26 5479 300 161 9.00 10.00 186755 77983
02:40:27 1725 86 94 0.99 0.99 14819 16172
02:40:28 1596 96 82 0.00 0.00 16521 16762
02:40:29 1716 93 85 1.00 1.00 16395 16730
02:40:30 1579 88 75 0.00 0.00 15324 15192
02:40:32 23036 79 3887 0.99 0.99 10113 193520
02:40:33 1756 94 83 0.00 0.00 14935 15300
02:40:34 2099 165 130 0.00 0.00 125051 73552
02:40:35 1560 82 69 0.00 0.00 15976 16287
[...]
We can see that both tools are producing similar data.
The DTrace output lacks the "summary since boot" line, as it is not using
Kstat to fetch this data.
The sar-c.d script is not intended itself as a useful program, rather it
is intended as a starting point for other DTrace scripts; a starting point
of familiar statistics to provide the programmer with a "common ground"
of knowledge.