150397Sobrien/* 2132718Skan * CDDL HEADER START 3132718Skan * 450397Sobrien * The contents of this file are subject to the terms of the 590075Sobrien * Common Development and Distribution License (the "License"). 650397Sobrien * You may not use this file except in compliance with the License. 790075Sobrien * 890075Sobrien * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 990075Sobrien * or http://www.opensolaris.org/os/licensing. 1090075Sobrien * See the License for the specific language governing permissions 1150397Sobrien * and limitations under the License. 1290075Sobrien * 1390075Sobrien * When distributing Covered Code, include this CDDL HEADER in each 1490075Sobrien * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1590075Sobrien * If applicable, add the following below this CDDL HEADER, with the 1650397Sobrien * fields enclosed by brackets "[]" replaced with your own identifying 1750397Sobrien * information: Portions Copyright [yyyy] [name of copyright owner] 1890075Sobrien * 1990075Sobrien * CDDL HEADER END 2090075Sobrien */ 2150397Sobrien 22132718Skan/* 23132718Skan * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24132718Skan * Use is subject to license terms. 25132718Skan */ 26 27/* 28 * ASSERTION: 29 * Multiple aggregates can be used within the same D script. 30 * 31 * SECTION: Aggregations/Aggregations 32 * 33 */ 34 35#pragma D option quiet 36 37BEGIN 38{ 39 time_1 = timestamp; 40 i = 0; 41} 42 43tick-10ms 44/i <= 10/ 45{ 46 time_2 = timestamp; 47 new_time = time_2 - time_1; 48 @a[pid] = max(new_time); 49 @b[pid] = min(new_time); 50 @c[pid] = avg(new_time); 51 @d[pid] = sum(new_time); 52 @e[pid] = quantize(new_time); 53 @f[pid] = stddev(new_time); 54 @g[timestamp] = max(new_time); 55 @h[timestamp] = quantize(new_time); 56 @i[timestamp] = lquantize(new_time, 0, 10000, 1000); 57 58 time_1 = time_2; 59 i++; 60} 61 62tick-10ms 63/i == 10/ 64{ 65 exit(0); 66} 67