Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Oct 2011 10:08:22 -0400
From:      George Neville-Neil <gnn@freebsd.org>
To:        current@freebsd.org
Subject:   A patch for a bug in the dtrace command...
Message-ID:  <3F00228B-857B-472E-926B-9BEFE9B3557A@freebsd.org>

next in thread | raw e-mail | index | archive | help

--Apple-Mail=_D5A06F2A-CFAD-4B9F-8510-8BCBB86E6612
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi,

I have found that the dtrace command on FreeBSD, in both STABLE and =
HEAD, does not print out
aggregations properly, likely due to the difference in how Solaris and =
FreeBSD signals work.
For example, this one liner will give no output:

sudo dtrace -n 'syscall:::entry { @[execname] =3D quantize(arg0); }'

While is should print this:

dtrace -n 'syscall:::entry { @[execname] =3D quantize(arg0); }'
dtrace: description 'syscall:::entry ' matched 1028 probes
^C

  nrpe2                                            =20
           value  ------------- Distribution ------------- count   =20
               2 |                                         0       =20
               4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12      =20
               8 |                                         0       =20

  sshd                                             =20
           value  ------------- Distribution ------------- count   =20
               0 |                                         0       =20
               1 |@@@@@@@@@@                               5       =20
               2 |@@@@@@@@@@@@@@                           7       =20
               4 |                                         0       =20
               8 |@@@@@@@@@@@@@@@@                         8       =20
              16 |                                         0       =20

etc.

I have made the following patch, but I'd be interested in people testing =
and commenting on it.

Best,
George


--Apple-Mail=_D5A06F2A-CFAD-4B9F-8510-8BCBB86E6612
Content-Disposition: attachment;
	filename=dtrace.c.signal.diff
Content-Type: application/octet-stream; x-unix-mode=0664;
	name="dtrace.c.signal.diff"
Content-Transfer-Encoding: 7bit

Index: dtrace.c
===================================================================
--- dtrace.c	(revision 217284)
+++ dtrace.c	(revision 225366)
@@ -70,6 +70,8 @@
 #define	E_ERROR		1
 #define	E_USAGE		2
 
+#define IMPATIENT_LIMIT 2
+
 static const char DTRACE_OPTSTR[] =
 	"3:6:aAb:Bc:CD:ef:FGhHi:I:lL:m:n:o:p:P:qs:SU:vVwx:X:Z";
 
@@ -1199,7 +1201,7 @@
 	if (!g_intr)
 		g_newline = 1;
 
-	if (g_intr++)
+	if (g_intr++ > IMPATIENT_LIMIT)
 		g_impatient = 1;
 }
 

--Apple-Mail=_D5A06F2A-CFAD-4B9F-8510-8BCBB86E6612--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F00228B-857B-472E-926B-9BEFE9B3557A>