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*9531Srafael.vanoni@sun.com * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 242633Sahl * Use is subject to license terms. 252633Sahl */ 262633Sahl 272633Sahl /* 282633Sahl * ASSERTION: 29*9531Srafael.vanoni@sun.com * Multiple aggregates can be used within the same D script. 302633Sahl * 312633Sahl * SECTION: Aggregations/Aggregations 322633Sahl * 332633Sahl */ 342633Sahl 352633Sahl #pragma D option quiet 362633Sahl 372633Sahl BEGIN 382633Sahl { 392633Sahl time_1 = timestamp; 402633Sahl i = 0; 412633Sahl } 422633Sahl 432633Sahl tick-10ms 442633Sahl /i <= 10/ 452633Sahl { 462633Sahl time_2 = timestamp; 472633Sahl new_time = time_2 - time_1; 482633Sahl @a[pid] = max(new_time); 492633Sahl @b[pid] = min(new_time); 502633Sahl @c[pid] = avg(new_time); 512633Sahl @d[pid] = sum(new_time); 522633Sahl @e[pid] = quantize(new_time); 53*9531Srafael.vanoni@sun.com @f[pid] = stddev(new_time); 54*9531Srafael.vanoni@sun.com @g[timestamp] = max(new_time); 55*9531Srafael.vanoni@sun.com @h[timestamp] = quantize(new_time); 56*9531Srafael.vanoni@sun.com @i[timestamp] = lquantize(new_time, 0, 10000, 1000); 57*9531Srafael.vanoni@sun.com 582633Sahl time_1 = time_2; 592633Sahl i++; 602633Sahl } 612633Sahl 622633Sahl tick-10ms 632633Sahl /i == 10/ 642633Sahl { 652633Sahl exit(0); 662633Sahl } 67