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

[-- Attachment #1 --]
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] = quantize(arg0); }'

While is should print this:

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

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

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

etc.

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

Best,
George


[-- Attachment #2 --]
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;
 }
 

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