Subject: patch to add vm.vmmeter to sysctl(8)
To: None <current-users@NetBSD.ORG>
From: Tom Pavel <pavel@MAILBOX.SLAC.Stanford.EDU>
List: current-users
Date: 06/27/1995 19:28:01
Here is a little patch adding vm.vmmeter to sysctl(8), if anyone is
interested in looking at these numbers. I was trying to compare them
to the numbers reported by "top" (which come from _cnt via libkvm).
Seems like there wasn't any reason vm.vmmeter should be omitted from
sysctl.
[By the way, is this the appropriate place to post such code, or is
there a better place? I didn't consider this a bug, so I didn't think
netbsd-bugs would be right.]
Tom Pavel
Stanford Linear Accelerator Center
pavel@slac.stanford.edu
diff -c sysctl/sysctl.c sysctl-new/sysctl.c
*** sysctl/sysctl.c Sat Dec 24 03:53:30 1994
--- sysctl-new/sysctl.c Sun Jun 11 22:13:11 1995
***************
*** 285,290 ****
--- 285,316 ----
fprintf(stdout, "%.2f %.2f %.2f\n",
loads[0], loads[1], loads[2]);
return;
+ } else if (mib[1] == VM_METER) {
+ struct vmtotal tot;
+ size = sizeof(tot);
+ if (sysctl(mib, 2, &tot, &size, NULL, 0) < 0) {
+ if (flags == 0)
+ return;
+ if (!nflag)
+ fprintf(stdout, "%s: ", string);
+ fprintf(stderr, "failed sysctl\n");
+ return;
+ }
+ if (!nflag)
+ fprintf(stdout, "%s: ", string);
+ fprintf(stdout,
+ "rq = %d, dw = %d, pw = %d, sl = %d, sw = %d,\n",
+ tot.t_rq, tot.t_dw, tot.t_pw,
+ tot.t_sl, tot.t_sw);
+ fprintf(stdout,
+ "\tvm = %d, avm = %d, rm = %d, arm = %d,\n",
+ tot.t_vm, tot.t_avm, tot.t_rm, tot.t_arm);
+ fprintf(stdout,
+ "\tvmshr = %d, avmshr = %d, rmshr = %d, armshr = %d, free = %d\n",
+ tot.t_vmshr, tot.t_avmshr,
+ tot.t_rmshr, tot.t_armshr,
+ tot.t_free);
+ return;
}
if (flags == 0)
return;
-----------------------------
End of patch
-----------------------------