xref: /freebsd/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.neglquant.d (revision 2be1a816b9ff69588e55be0a84cbe2a31efc0f2f)
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #pragma D option quiet
30 
31 BEGIN
32 {
33 	@["j-church"] = lquantize(1, 0, 10, 1, 100);
34 	@["j-church"] = lquantize(1, 0, 10, 1, -99);
35 	@["j-church"] = lquantize(1, 0, 10, 1, -1);
36 	val = 123;
37 }
38 
39 BEGIN
40 {
41 	@["k-ingleside"] = lquantize(1, 0, 10, 1, -val);
42 }
43 
44 BEGIN
45 {
46 	@["l-taraval"] = lquantize(0, 0, 10, 1, -val);
47 	@["l-taraval"] = lquantize(-1, 0, 10, 1, -val);
48 	@["l-taraval"] = lquantize(1, 0, 10, 1, val);
49 	@["l-taraval"] = lquantize(1, 0, 10, 1, val);
50 }
51 
52 BEGIN
53 {
54 	@["m-oceanview"] = lquantize(1, 0, 10, 1, (1 << 63) - 1);
55 	@["m-oceanview"] = lquantize(1, 0, 10, 1);
56 	@["m-oceanview"] = lquantize(2, 0, 10, 1, (1 << 63) - 1);
57 	@["m-oceanview"] = lquantize(8, 0, 10, 1, 400000);
58 }
59 
60 BEGIN
61 {
62 	@["n-judah"] = lquantize(1, 0, 10, 1, val);
63 	@["n-judah"] = lquantize(2, 0, 10, 1, val);
64 	@["n-judah"] = lquantize(2, 0, 10, 1, val);
65 	@["n-judah"] = lquantize(2, 0, 10, 1);
66 }
67 
68 BEGIN
69 {
70 	this->i = 1;
71 	this->val = (1 << 63) - 1;
72 
73 	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
74 	this->i++;
75 	this->val = ((1 << 63) - 1) / this->i;
76 
77 	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
78 	this->i++;
79 	this->val = ((1 << 63) - 1) / this->i;
80 
81 	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
82 	this->i++;
83 	this->val = ((1 << 63) - 1) / this->i;
84 
85 	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
86 	this->i++;
87 	this->val = ((1 << 63) - 1) / this->i;
88 
89 	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
90 	this->i++;
91 	this->val = ((1 << 63) - 1) / this->i;
92 
93 	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
94 	this->i++;
95 	this->val = ((1 << 63) - 1) / this->i;
96 
97 	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
98 	this->i++;
99 	this->val = ((1 << 63) - 1) / this->i;
100 }
101 
102 BEGIN
103 {
104 	this->i = 1;
105 
106 	/*
107 	 * We want to test the ability to sort very large quantizations
108 	 * that differ by a small amount.  Ideally, they would differ only
109 	 * by 1 -- but that is smaller than the precision of long doubles of
110 	 * this magnitude on x86.  To assure that the same test works on x86
111 	 * just as it does on SPARC, we pick a value that is just larger than
112 	 * the precision at this magnitude.  It should go without saying that
113 	 * this robustness on new ISAs very much depends on the precision
114 	 * of the long double representation.
115 	 */
116 	this->val = (1 << 63) - 7;
117 
118 	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
119 	this->i++;
120 	this->val = ((1 << 63) - 1) / this->i;
121 
122 	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
123 	this->i++;
124 	this->val = ((1 << 63) - 1) / this->i;
125 
126 	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
127 	this->i++;
128 	this->val = ((1 << 63) - 1) / this->i;
129 
130 	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
131 	this->i++;
132 	this->val = ((1 << 63) - 1) / this->i;
133 
134 	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
135 	this->i++;
136 	this->val = ((1 << 63) - 1) / this->i;
137 
138 	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
139 	this->i++;
140 	this->val = ((1 << 63) - 1) / this->i;
141 
142 	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
143 	this->i++;
144 	this->val = ((1 << 63) - 1) / this->i;
145 }
146 
147 BEGIN
148 {
149 	exit(0);
150 }
151