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.
This commit is contained in:
Poul-Henning Kamp 1997-08-14 10:36:02 +00:00
parent 422ff09040
commit 6ff4cb0076
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28215
2 changed files with 24 additions and 8 deletions

View File

@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $Id$ .\" $Id: kernbb.8,v 1.4 1997/02/22 16:06:05 peter Exp $
.\" .\"
.Dd May 22, 1995 .Dd May 22, 1995
.Dt KERNBB 8 .Dt KERNBB 8
@ -50,7 +50,9 @@ with the
option. option.
.Pp .Pp
The output format is ascii, consisting of one line per record with the 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 .Sh FILES
.Bl -tag -width /dev/kmemx -compact .Bl -tag -width /dev/kmemx -compact
.It Pa /kernel .It Pa /kernel

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * 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() main()
{ {
int i,j; int i,j;
u_long l1,l2,l3; u_long l1,l2,l3,l4;
struct bb bb; struct bb bb;
char buf[128]; char buf[128];
@ -81,9 +81,20 @@ main()
kvm_read(kv,bb.addr, addr, bb.ncounts * sizeof addr[0]); 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.file, file, bb.ncounts * sizeof file[0]);
kvm_read(kv,bb.func, func, bb.ncounts * sizeof func[0]); kvm_read(kv,bb.func, func, bb.ncounts * sizeof func[0]);
l4 = 0;
for (i=0; i < bb.ncounts; i++) { 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; continue;
if (!pn[i] && func[i]) { if (!pn[i] && func[i]) {
kvm_read(kv,func[i], buf, sizeof buf); kvm_read(kv,func[i], buf, sizeof buf);
buf[sizeof buf -1] = 0; buf[sizeof buf -1] = 0;
@ -94,7 +105,7 @@ main()
func[j] = 0; func[j] = 0;
} }
} }
if (!pn[i]) if (!pn[i] && i < bb.ncounts)
pn[i] = "-"; pn[i] = "-";
if (!fn[i] && file[i]) { if (!fn[i] && file[i]) {
kvm_read(kv,file[i], buf, sizeof buf); kvm_read(kv,file[i], buf, sizeof buf);
@ -108,8 +119,11 @@ main()
} }
if (!fn[i]) if (!fn[i])
fn[i] = "-"; fn[i] = "-";
printf("%s %5lu %s %lu %lu\n", l4 = 0;
fn[i],lineno[i],pn[i],addr[i],counts[i]); 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<bb.ncounts;i++) { for(i=0;i<bb.ncounts;i++) {
if (func[i] && pn[i]) if (func[i] && pn[i])