5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2012 by Delphix. All rights reserved.
21 ############################################################################
23 # temporal option causes output to be sorted, even when some
28 # NOTES: The temporal option has no effect on a single-CPU system, so
29 # this needs to be run on a multi-CPU system to effectively test the
32 ############################################################################
35 echo expected one argument
: '<'dtrace-path
'>'
44 $dtrace -o $file -s /dev
/stdin
<<EOF
45 #pragma D option quiet
46 #pragma D option destructive
47 #pragma D option temporal
48 #pragma D option switchrate=1000hz
51 * Use two enablings of the same probe, so that cpu 0 will always
52 * record its data just a little bit before the other cpus.
53 * We don't want to use the chill() action in the same enabling
54 * that we record the timestamp, because chill() causes the
55 * timestamp to be re-read, and thus not match the timestamp
56 * which libdtrace uses to sort the records.
62 printf("%d\n", timestamp);
68 chill(1000); /* one microsecond */
74 printf("%d\n", timestamp);
80 printf("%d\n", timestamp);
86 if [ "$status" -ne 0 ]; then
87 echo $tst: dtrace failed
91 # dtrace outputs a blank line at the end, which will sort to the beginning,
92 # so use grep to remove the blank line.
93 head -n -1 $file > $file.2
95 sort -n $file.2 |
diff $file.2 -
97 if [ "$status" -ne 0 ]; then
98 echo $tst: output is not sorted