3 * rb_objcpu.d - measure Ruby object creation on-CPU time using DTrace.
4 * Written for the Ruby DTrace provider.
6 * $Id: rb_objcpu.d 20 2007-09-12 09:28:22Z brendan $
8 * This traces Ruby activity from all programs running on the system with
9 * Ruby provider support.
11 * USAGE: rb_objcpu.d # hit Ctrl-C to end
13 * Class names are printed if available.
15 * COPYRIGHT: Copyright (c) 2007 Brendan Gregg.
19 * The contents of this file are subject to the terms of the
20 * Common Development and Distribution License, Version 1.0 only
21 * (the "License"). You may not use this file except in compliance
24 * You can obtain a copy of the license at Docs/cddl1.txt
25 * or http://www.opensolaris.org/os/licensing.
26 * See the License for the specific language governing permissions
27 * and limitations under the License.
31 * 09-Sep-2007 Brendan Gregg Created this.
34 #pragma D option quiet
38 printf("Tracing... Hit Ctrl-C to end.\n");
41 ruby*:::object-create-start
43 self->vstart = vtimestamp;
46 ruby*:::object-create-done
49 this->oncpu = vtimestamp - self->vstart;
50 @total = sum(this->oncpu);
51 @dist[copyinstr(arg0)] = quantize(this->oncpu / 1000);
57 normalize(@total, 1000000);
58 printa("Total object creation on-CPU time (ms): %@d\n\n", @total);
59 printf("Object creation on-CPU time distributions (us),\n");