iostats: add -C flag to enable mount cache

This commit is contained in:
cinap_lenrek 2014-06-08 18:54:36 +02:00
parent 3d12f4f408
commit 01b5ac1402
2 changed files with 15 additions and 4 deletions

View file

@ -5,8 +5,9 @@ iostats \- file system to measure I/O
.B iostats .B iostats
[ [
.B -d .B -d
] ] [
[ .B -C
] [
.B -f .B -f
.I dbfile .I dbfile
] ]
@ -55,6 +56,12 @@ is written to
.I dbfile .I dbfile
(default (default
.BR iostats.out ). .BR iostats.out ).
.PP
The
.B -C
flag sets the MCACHE flag on the mount which allows
the kernel to cache (see
.IR bind(1) ).
.SH EXAMPLE .SH EXAMPLE
Display summary of file I/O incurred by Display summary of file I/O incurred by
.IR ls (1): .IR ls (1):

View file

@ -48,8 +48,9 @@ main(int argc, char **argv)
char *dbfile, *s; char *dbfile, *s;
char buf[128]; char buf[128];
float brpsec, bwpsec, bppsec; float brpsec, bwpsec, bppsec;
int type, cpid, fspid, n; int type, cpid, fspid, n, mflag;
mflag = MREPL;
dbfile = DEBUGFILE; dbfile = DEBUGFILE;
ARGBEGIN{ ARGBEGIN{
@ -59,6 +60,9 @@ main(int argc, char **argv)
case 'f': case 'f':
dbfile = ARGF(); dbfile = ARGF();
break; break;
case 'C':
mflag |= MCACHE;
break;
default: default:
usage(); usage();
}ARGEND }ARGEND
@ -83,7 +87,7 @@ main(int argc, char **argv)
fatal("no working directory"); fatal("no working directory");
rfork(RFENVG|RFNAMEG|RFNOTEG); rfork(RFENVG|RFNAMEG|RFNOTEG);
if(mount(p[0], -1, "/", MREPL, "") < 0) if(mount(p[0], -1, "/", mflag, "") < 0)
fatal("mount /"); fatal("mount /");
bind("#c/pid", "/dev/pid", MREPL); bind("#c/pid", "/dev/pid", MREPL);