4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #
pragma ident
"%Z%%M% %I% %E% SMI"
32 * Signed integer keys print and sort as expected using the
33 * aggsortkeypos and aggsortrev options
35 * SECTION: Aggregations, Printing Aggregations
37 * NOTES: DTrace sorts integer keys as unsigned values, yet prints 32-
38 * and 64-bit integers as signed values. Since the Java DTrace API is
39 * expected to emulate this behavior, this test was added to ensure that
40 * the behavior is preserved.
43 #
pragma D option quiet
44 #
pragma D option aggsortkey
45 #
pragma D option aggsortkeypos
=1
46 #
pragma D option aggsortrev
50 @i8["cat", (char)-2] = sum(-2);
51 @i8["dog", (char)-2] = sum(-22);
52 @i8["mouse", (char)-2] = sum(-222);
53 @i8["cat", (char)-1] = sum(-1);
54 @i8["dog", (char)-1] = sum(-11);
55 @i8["mouse", (char)-1] = sum(-111);
56 @i8["cat", (char)0] = sum(0);
57 @i8["dog", (char)0] = sum(10);
58 @i8["mouse", (char)0] = sum(100);
59 @i8["cat", (char)1] = sum(1);
60 @i8["dog", (char)1] = sum(11);
61 @i8["mouse", (char)1] = sum(111);
62 @i8["cat", (char)2] = sum(2);
63 @i8["dog", (char)2] = sum(22);
64 @i8["mouse", (char)2] = sum(222);
66 @i16["mouse", (short)-2] = sum(-2);
67 @i16["dog", (short)-2] = sum(-22);
68 @i16["cat", (short)-2] = sum(-222);
69 @i16["mouse", (short)-1] = sum(-1);
70 @i16["dog", (short)-1] = sum(-11);
71 @i16["cat", (short)-1] = sum(-111);
72 @i16["mouse", (short)0] = sum(0);
73 @i16["dog", (short)0] = sum(10);
74 @i16["cat", (short)0] = sum(100);
75 @i16["mouse", (short)1] = sum(1);
76 @i16["dog", (short)1] = sum(11);
77 @i16["cat", (short)1] = sum(111);
78 @i16["mouse", (short)2] = sum(2);
79 @i16["dog", (short)2] = sum(22);
80 @i16["cat", (short)2] = sum(222);
82 @i32["mouse", -2] = sum(-2);
83 @i32["bear", -2] = sum(-22);
84 @i32["cat", -2] = sum(-222);
85 @i32["mouse", -1] = sum(-1);
86 @i32["bear", -1] = sum(-11);
87 @i32["cat", -1] = sum(-111);
88 @i32["mouse", 0] = sum(0);
89 @i32["bear", 0] = sum(10);
90 @i32["cat", 0] = sum(100);
91 @i32["mouse", 1] = sum(1);
92 @i32["bear", 1] = sum(11);
93 @i32["cat", 1] = sum(111);
94 @i32["mouse", 2] = sum(2);
95 @i32["bear", 2] = sum(22);
96 @i32["cat", 2] = sum(222);
98 @i64["cat", (long long)-2] = sum(-2);
99 @i64["bear", (long long)-2] = sum(-22);
100 @i64["dog", (long long)-2] = sum(-222);
101 @i64["cat", (long long)-1] = sum(-1);
102 @i64["bear", (long long)-1] = sum(-11);
103 @i64["dog", (long long)-1] = sum(-111);
104 @i64["cat", (long long)0] = sum(0);
105 @i64["bear", (long long)0] = sum(10);
106 @i64["dog", (long long)0] = sum(100);
107 @i64["cat", (long long)1] = sum(1);
108 @i64["bear", (long long)1] = sum(11);
109 @i64["dog", (long long)1] = sum(111);
110 @i64["cat", (long long)2] = sum(2);
111 @i64["bear", (long long)2] = sum(22);
112 @i64["dog", (long long)2] = sum(222);