diff --git a/sys/man/3/kprof b/sys/man/3/kprof index 4d3f99992..ce975e325 100644 --- a/sys/man/3/kprof +++ b/sys/man/3/kprof @@ -24,10 +24,9 @@ The size of the file depends on the size of kernel text. The first count holds the total number of clock ticks during profiling; the second the number of ticks that occurred while the kernel -was running. The rest each hold the number of ticks -the kernel program counter was within the -corresponding 8-byte range of kernel text, starting from the base -of kernel text. +was running. The rest each hold the number of total ticks +the kernel spent at any one program counter, indexed by +their offset from the minimum kernel text address. .PP The file .B kpctl diff --git a/sys/src/9/port/devkprof.c b/sys/src/9/port/devkprof.c index c6d73a74e..f0c161974 100644 --- a/sys/src/9/port/devkprof.c +++ b/sys/src/9/port/devkprof.c @@ -6,7 +6,6 @@ #include "../port/error.h" -#define LRES 3 /* log of PC resolution */ #define SZ 4 /* sizeof of count cell; well known as 4 */ struct @@ -46,7 +45,6 @@ _kproftimer(uintptr pc) kprof.buf[0] += TK2MS(1); if(kprof.minpc<=pc && pc>= LRES; kprof.buf[pc] += TK2MS(1); }else kprof.buf[1] += TK2MS(1); @@ -68,7 +66,7 @@ kprofattach(char *spec) /* allocate when first used */ kprof.minpc = KTZERO; kprof.maxpc = (uintptr)etext; - kprof.nbuf = (kprof.maxpc-kprof.minpc) >> LRES; + kprof.nbuf = kprof.maxpc-kprof.minpc; n = kprof.nbuf*SZ; if(kprof.buf == 0) { kprof.buf = xalloc(n); diff --git a/sys/src/cmd/kprof.c b/sys/src/cmd/kprof.c index 530386004..5c2527ba0 100644 --- a/sys/src/cmd/kprof.c +++ b/sys/src/cmd/kprof.c @@ -3,8 +3,6 @@ #include #include -#define PCRES 8 - struct COUNTER { char *name; /* function name */ @@ -82,7 +80,7 @@ main(int argc, char *argv[]) data = malloc(d->length); if(data == 0) error(1, "malloc"); - if(read(fd, data, d->length) < 0) + if(readn(fd, data, d->length) != d->length) error(1, "text read"); close(fd); for(i=0; i