4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 2012, Joyent, Inc. All rights reserved.
30 prog
=/var
/tmp
/dtest.$$.d
31 err
=/var
/tmp
/dtest.$$.err
33 nawk
-v nprobes
=$1 'BEGIN { \
34 for (i = 0; i < nprobes - 1; i++) { \
35 printf("dtrace:::BEGIN,\n"); \
38 printf("dtrace:::BEGIN { exit(0); }\n"); \
41 dtrace
-qs $prog > /dev
/null
2> $err
43 if [[ "$?" -eq 0 ]]; then
46 if ! grep "DIF program exceeds maximum program size" $err \
47 1> /dev
/null
2>&1 ; then
48 echo "failed to enable $prog: `cat $err`"
57 # First, establish an upper bound
61 while enable $upper ; do
64 echo success
at $lower, raised to
$upper
68 # Now search for the highest value that can be enabled
70 while [[ "$lower" -lt "$upper" ]]; do
71 let guess
=$
(((lower
+ upper
) / 2))
72 echo "lower is $lower; upper is $upper; guess is $guess\c"
74 if enable $guess ; then
75 if [[ $
((upper
- lower
)) -le 2 ]]; then
89 if [[ "$lower" -lt "$expected" ]]; then
90 echo "expected support for enablings of at least $expected probes; \c"
95 echo "maximum supported enabled probes found to be $lower"