1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#include "stdinc.h"
#include "dat.h"
#include "fns.h"
Stats stats;
void
statsinit(void)
{
}
static int
percent(long v, long total)
{
if(total == 0)
total = 1;
if(v < 1000*1000)
return (v * 100) / total;
total /= 100;
if(total == 0)
total = 1;
return v / total;
}
void
printstats(void)
{
fprint(2, "lump writes=%,ld\n", stats.lumpwrites);
fprint(2, "lump reads=%,ld\n", stats.lumpreads);
fprint(2, "lump cache read hits=%,ld\n", stats.lumphit);
fprint(2, "lump cache read misses=%,ld\n", stats.lumpmiss);
fprint(2, "clump disk writes=%,ld\n", stats.clumpwrites);
fprint(2, "clump disk bytes written=%,lld\n", stats.clumpbwrites);
fprint(2, "clump disk bytes compressed=%,lld\n", stats.clumpbcomp);
fprint(2, "clump disk reads=%,ld\n", stats.clumpreads);
fprint(2, "clump disk bytes read=%,lld\n", stats.clumpbreads);
fprint(2, "clump disk bytes uncompressed=%,lld\n", stats.clumpbuncomp);
fprint(2, "clump directory disk writes=%,ld\n", stats.ciwrites);
fprint(2, "clump directory disk reads=%,ld\n", stats.cireads);
fprint(2, "index disk writes=%,ld\n", stats.indexwrites);
fprint(2, "index disk reads=%,ld\n", stats.indexreads);
fprint(2, "index disk reads for modify=%,ld\n", stats.indexwreads);
fprint(2, "index disk reads for allocation=%,ld\n", stats.indexareads);
fprint(2, "index cache lookups=%,ld\n", stats.iclookups);
fprint(2, "index cache hits=%,ld %d%%\n", stats.ichits,
percent(stats.ichits, stats.iclookups));
fprint(2, "index cache fills=%,ld %d%%\n", stats.icfills,
percent(stats.icfills, stats.iclookups));
fprint(2, "index cache inserts=%,ld\n", stats.icinserts);
fprint(2, "disk cache hits=%,ld\n", stats.pchit);
fprint(2, "disk cache misses=%,ld\n", stats.pcmiss);
fprint(2, "disk cache reads=%,ld\n", stats.pcreads);
fprint(2, "disk cache bytes read=%,lld\n", stats.pcbreads);
fprint(2, "disk writes=%,ld\n", stats.diskwrites);
fprint(2, "disk bytes written=%,lld\n", stats.diskbwrites);
fprint(2, "disk reads=%,ld\n", stats.diskreads);
fprint(2, "disk bytes read=%,lld\n", stats.diskbreads);
}
|