9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER START
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * The contents of this file are subject to the terms of the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Common Development and Distribution License (the "License").
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You may not use this file except in compliance with the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * or http://www.opensolaris.org/os/licensing.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * See the License for the specific language governing permissions
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * and limitations under the License.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * When distributing Covered Code, include this CDDL HEADER in each
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * If applicable, add the following below this CDDL HEADER, with the
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * fields enclosed by brackets "[]" replaced with your own identifying
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * information: Portions Copyright [yyyy] [name of copyright owner]
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * CDDL HEADER END
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
ccf8180ea3a3378aeb6f06a09d4e090b54c01cc9Rafael Vanoni * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * Use is subject to license terms.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/*
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * ASSERTION:
ccf8180ea3a3378aeb6f06a09d4e090b54c01cc9Rafael Vanoni * Multiple aggregates can be used within the same D script.
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl * SECTION: Aggregations/Aggregations
9512fe850e98fdd448c638ca63fdd92a8a510255ahl *
9512fe850e98fdd448c638ca63fdd92a8a510255ahl */
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahl#pragma D option quiet
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahlBEGIN
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl time_1 = timestamp;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl i = 0;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahltick-10ms
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/i <= 10/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl time_2 = timestamp;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl new_time = time_2 - time_1;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl @a[pid] = max(new_time);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl @b[pid] = min(new_time);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl @c[pid] = avg(new_time);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl @d[pid] = sum(new_time);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl @e[pid] = quantize(new_time);
ccf8180ea3a3378aeb6f06a09d4e090b54c01cc9Rafael Vanoni @f[pid] = stddev(new_time);
ccf8180ea3a3378aeb6f06a09d4e090b54c01cc9Rafael Vanoni @g[timestamp] = max(new_time);
ccf8180ea3a3378aeb6f06a09d4e090b54c01cc9Rafael Vanoni @h[timestamp] = quantize(new_time);
ccf8180ea3a3378aeb6f06a09d4e090b54c01cc9Rafael Vanoni @i[timestamp] = lquantize(new_time, 0, 10000, 1000);
ccf8180ea3a3378aeb6f06a09d4e090b54c01cc9Rafael Vanoni
9512fe850e98fdd448c638ca63fdd92a8a510255ahl time_1 = time_2;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl i++;
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}
9512fe850e98fdd448c638ca63fdd92a8a510255ahl
9512fe850e98fdd448c638ca63fdd92a8a510255ahltick-10ms
9512fe850e98fdd448c638ca63fdd92a8a510255ahl/i == 10/
9512fe850e98fdd448c638ca63fdd92a8a510255ahl{
9512fe850e98fdd448c638ca63fdd92a8a510255ahl exit(0);
9512fe850e98fdd448c638ca63fdd92a8a510255ahl}