From 41f0be497a180d1dc7d5cb9df4673191fe3f81c9 Mon Sep 17 00:00:00 2001 From: phk Date: Thu, 14 Aug 1997 10:36:02 +0000 Subject: Do not output anything for source-files with no counts. Output function name for the "pre-prologue" entry, by stealing it from the next entry. Output length of basic-block in bytes and product of executions and length. --- usr.sbin/kernbb/kernbb.8 | 6 ++++-- usr.sbin/kernbb/kernbb.c | 26 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'usr.sbin/kernbb') diff --git a/usr.sbin/kernbb/kernbb.8 b/usr.sbin/kernbb/kernbb.8 index 4fc78d2..73acfae 100644 --- a/usr.sbin/kernbb/kernbb.8 +++ b/usr.sbin/kernbb/kernbb.8 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: kernbb.8,v 1.4 1997/02/22 16:06:05 peter Exp $ .\" .Dd May 22, 1995 .Dt KERNBB 8 @@ -50,7 +50,9 @@ with the option. .Pp The output format is ascii, consisting of one line per record with the -following fields: filename, linenumber, procedure, address and count. +following fields: filename, linenumber, procedure, address, count +of executions, length of the basic-block in bytes and the product of +the previous two fields. .Sh FILES .Bl -tag -width /dev/kmemx -compact .It Pa /kernel diff --git a/usr.sbin/kernbb/kernbb.c b/usr.sbin/kernbb/kernbb.c index dea1632..4fa9f92 100644 --- a/usr.sbin/kernbb/kernbb.c +++ b/usr.sbin/kernbb/kernbb.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: kernbb.c,v 1.6 1997/02/22 16:06:06 peter Exp $ * */ @@ -52,7 +52,7 @@ int main() { int i,j; - u_long l1,l2,l3; + u_long l1,l2,l3,l4; struct bb bb; char buf[128]; @@ -81,9 +81,20 @@ main() kvm_read(kv,bb.addr, addr, bb.ncounts * sizeof addr[0]); kvm_read(kv,bb.file, file, bb.ncounts * sizeof file[0]); kvm_read(kv,bb.func, func, bb.ncounts * sizeof func[0]); + l4 = 0; for (i=0; i < bb.ncounts; i++) { - if (!counts[i]) + if (counts[i]) + l4++; + if (!func[i] && i+1 < bb.ncounts) + func[i] = func[i+1]; + } + if (!l4) + continue; + for (i=0; i < bb.ncounts; i++) { + + if (0 && !counts[i]) continue; + if (!pn[i] && func[i]) { kvm_read(kv,func[i], buf, sizeof buf); buf[sizeof buf -1] = 0; @@ -94,7 +105,7 @@ main() func[j] = 0; } } - if (!pn[i]) + if (!pn[i] && i < bb.ncounts) pn[i] = "-"; if (!fn[i] && file[i]) { kvm_read(kv,file[i], buf, sizeof buf); @@ -108,8 +119,11 @@ main() } if (!fn[i]) fn[i] = "-"; - printf("%s %5lu %s %lu %lu\n", - fn[i],lineno[i],pn[i],addr[i],counts[i]); + l4 = 0; + if (i+1 < bb.ncounts) + l4 = addr[i+1] - addr[i]; + printf("%s %5lu %s %lu %lu %lu %lu\n", + fn[i], lineno[i], pn[i], addr[i], counts[i], l4, counts[i] * l4); } for(i=0;i