xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/common/aggs/tst.clearavg2.d (revision 3944:75371f172291)
12633Sahl /*
22633Sahl  * CDDL HEADER START
32633Sahl  *
42633Sahl  * The contents of this file are subject to the terms of the
52633Sahl  * Common Development and Distribution License (the "License").
62633Sahl  * You may not use this file except in compliance with the License.
72633Sahl  *
82633Sahl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92633Sahl  * or http://www.opensolaris.org/os/licensing.
102633Sahl  * See the License for the specific language governing permissions
112633Sahl  * and limitations under the License.
122633Sahl  *
132633Sahl  * When distributing Covered Code, include this CDDL HEADER in each
142633Sahl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152633Sahl  * If applicable, add the following below this CDDL HEADER, with the
162633Sahl  * fields enclosed by brackets "[]" replaced with your own identifying
172633Sahl  * information: Portions Copyright [yyyy] [name of copyright owner]
182633Sahl  *
192633Sahl  * CDDL HEADER END
202633Sahl  */
212633Sahl 
222633Sahl /*
23*3944Sahl  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
242633Sahl  * Use is subject to license terms.
252633Sahl  */
262633Sahl 
272633Sahl #pragma ident	"%Z%%M%	%I%	%E% SMI"
282633Sahl 
292633Sahl 
302633Sahl /*
312633Sahl  * ASSERTION:
322633Sahl  * 	Positive avg() test
332633Sahl  *
342633Sahl  * SECTION: Aggregations/Aggregations
352633Sahl  *
362633Sahl  * NOTES:
372633Sahl  *	Verifies that printing a clear()'d aggregation with an avg()
382633Sahl  *	aggregation function of 0 doesn't cause divide-by-zero problems.
392633Sahl  *
402633Sahl  */
412633Sahl 
422633Sahl #pragma D option quiet
432633Sahl #pragma D option switchrate=50ms
442633Sahl #pragma D option aggrate=1ms
452633Sahl 
462633Sahl tick-100ms
472633Sahl /(x++ % 5) == 0/
482633Sahl {
492633Sahl 	@time = avg(0);
502633Sahl }
512633Sahl 
522633Sahl tick-100ms
53*3944Sahl /x > 5 && x <= 20/
542633Sahl {
552633Sahl 	printa(" %@d\n", @time);
562633Sahl 	clear(@time);
572633Sahl }
582633Sahl 
592633Sahl tick-100ms
602633Sahl /x > 20/
612633Sahl {
622633Sahl 	exit(0);
632633Sahl }
64