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# 232633Sahl# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 242633Sahl# Use is subject to license terms. 252633Sahl# 262633Sahl#ident "%Z%%M% %I% %E% SMI" 272633Sahl 28*2804Stomeeif [ $# != 1 ]; then 29*2804Stomee echo expected one argument: '<'dtrace-path'>' 30*2804Stomee exit 2 31*2804Stomeefi 32*2804Stomee 33*2804Stomeedtrace=$1 34*2804Stomee 35*2804Stomee# 36*2804Stomee# /usr/ccs/bin/nm execs a 64-bit version of itself. DTrace uses libproc 37*2804Stomee# (which uses /proc) to find out when the traced process exits, but a 38*2804Stomee# 32-bit process can't examine a 64-bit one with libproc. The 39*2804Stomee# LD_NOEXEC_64 variable prevents nm from re-execing itself. 40*2804Stomee# 41*2804StomeeLD_NOEXEC_64=tomeeisrad $dtrace -F -s /dev/stdin -c \ 42*2804Stomee '/usr/ccs/bin/nm /bin/ls' stat <<EOF 43*2804Stomee 442633Sahlpid\$target::\$1:entry 452633Sahl{ 462633Sahl self->start = vtimestamp; 472633Sahl} 482633Sahl 492633Sahlpid\$target:::entry 502633Sahl/self->start/ 512633Sahl{ 522633Sahl trace(vtimestamp - self->start); 532633Sahl} 542633Sahl 552633Sahlpid\$target:::return 562633Sahl/self->start/ 572633Sahl{ 582633Sahl trace(vtimestamp - self->start); 592633Sahl} 602633Sahl 612633Sahlpid\$target::\$1:return 622633Sahl/self->start/ 632633Sahl{ 642633Sahl self->start = 0; 652633Sahl exit(0); 662633Sahl} 672633Sahl 682633Sahlsyscall::: 692633Sahl/self->start/ 702633Sahl{ 712633Sahl trace(vtimestamp - self->start); 722633Sahl} 732633Sahl 742633Sahlfbt::: 752633Sahl/self->start/ 762633Sahl{ 772633Sahl trace(vtimestamp - self->start); 782633Sahl} 792633SahlEOF 80