192555Sdes/* 276259Sgreen * CDDL HEADER START 376259Sgreen * 476259Sgreen * The contents of this file are subject to the terms of the 576259Sgreen * Common Development and Distribution License (the "License"). 676259Sgreen * You may not use this file except in compliance with the License. 776259Sgreen * 876259Sgreen * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 976259Sgreen * or http://www.opensolaris.org/os/licensing. 1076259Sgreen * See the License for the specific language governing permissions 1176259Sgreen * and limitations under the License. 1276259Sgreen * 1376259Sgreen * When distributing Covered Code, include this CDDL HEADER in each 1476259Sgreen * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1592555Sdes * If applicable, add the following below this CDDL HEADER, with the 1692555Sdes * fields enclosed by brackets "[]" replaced with your own identifying 1792555Sdes * information: Portions Copyright [yyyy] [name of copyright owner] 1892555Sdes * 1992555Sdes * CDDL HEADER END 2092555Sdes */ 2192555Sdes 2292555Sdes/* 2392555Sdes * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 2476259Sgreen * Use is subject to license terms. 2592555Sdes */ 2676259Sgreen 2792555Sdes#pragma ident "%Z%%M% %I% %E% SMI" 2892555Sdes 2992555Sdes 3092555Sdes/* 3192555Sdes * ASSERTION: 3292555Sdes * Positive avg() test 3392555Sdes * 34 * SECTION: Aggregations/Aggregations 35 * 36 * NOTES: 37 * Verifies that printing a clear()'d aggregation with an avg() 38 * aggregation function of 0 doesn't cause divide-by-zero problems. 39 * 40 */ 41 42#pragma D option quiet 43#pragma D option switchrate=50ms 44#pragma D option aggrate=1ms 45 46tick-100ms 47/(x++ % 5) == 0/ 48{ 49 @time = avg(0); 50} 51 52tick-100ms 53/x > 5 && x <= 20/ 54{ 55 printa(" %@d\n", @time); 56 clear(@time); 57} 58 59tick-100ms 60/x > 20/ 61{ 62 exit(0); 63} 64