commit - 0e9f3966da196eee3353154d7da04fafe90e5644
commit + 3c6ab1854e92467a7309cf244339c6f10c2b0d7d
blob - a6f5ba43e1325eb01c24870f2095cbbd7173df92
blob + d5555deb2386cd9d86cf6e871159556ad3541e23
--- man/man1/stats.1
+++ man/man1/stats.1
number of valid pages on the swap device.
The swap is displayed as a
fraction of the number of swap pages configured by the machine.
+.TP
+.B "8 802.11b
+display the signal strength detected by the 802.11b wireless ether card; the value
+is usually below 50% unless the receiver is in the same room as the transmitter, so
+a midrange value represents a strong signal.
.PD
.PP
The graphs are plotted with time on the horizontal axis.
blob - 2592bc4e0ee02036b49548841ccc3329fc95dccf
blob + 09ca18f309b651f5a190dfd3fc1aaf03fda443c7
--- src/cmd/auxstats/Linux.c
+++ src/cmd/auxstats/Linux.c
void xmeminfo(int);
void xnet(int);
void xstat(int);
+void xvmstat(int);
+void xwireless(int);
void (*statfn[])(int) =
{
xmeminfo,
xnet,
xstat,
+ xvmstat,
+ xwireless,
0
};
int i;
vlong tot, used;
vlong mtot, mfree;
+ vlong stot, sfree;
static int fd = -1;
if(first){
readfile(fd);
mtot = 0;
+ stot = 0;
+ mfree = 0;
+ sfree = 0;
for(i=0; i<nline; i++){
tokens(i);
if(ntok < 3)
Bprint(&bout, "swap =%lld %lld\n", used/1024, tot/1024);
else if(strcmp(tok[0], "MemTotal:") == 0)
mtot = atoll(tok[1]); /* kb */
- else if(strcmp(tok[0], "MemFree:") == 0){
- mfree = atoll(tok[1]);
+ else if(strcmp(tok[0], "MemFree:") == 0)
+ mfree += atoll(tok[1]);
+ else if(strcmp(tok[0], "Buffers:") == 0)
+ mfree += atoll(tok[1]);
+ else if(strcmp(tok[0], "Cached:") == 0){
+ mfree += atoll(tok[1]);
if(mtot < mfree)
continue;
Bprint(&bout, "mem =%lld %lld\n", mtot-mfree, mtot);
+ }else if(strcmp(tok[0], "SwapTotal:") == 0)
+ stot = atoll(tok[1]); /* kb */
+ else if(strcmp(tok[0], "SwapFree:") == 0){
+ sfree = atoll(tok[1]);
+ if(stot < sfree)
+ continue;
+ Bprint(&bout, "swap =%lld %lld\n", stot-sfree, stot);
}
}
}
tokens(i);
if(ntok < 8+8)
continue;
- if(strncmp(tok[0], "eth", 3) != 0)
+ if(strncmp(tok[0], "eth", 3) != 0 && strncmp(tok[0], "wlan", 4) != 0)
continue;
inb = atoll(tok[1]);
oub = atoll(tok[9]);
Bprint(&bout, "user %lld 100\n", atoll(tok[1]));
Bprint(&bout, "sys %lld 100\n", atoll(tok[3]));
Bprint(&bout, "cpu %lld 100\n", atoll(tok[1])+atoll(tok[3]));
- Bprint(&bout, "idle %lld\n", atoll(tok[4]));
+ Bprint(&bout, "idle %lld 100\n", atoll(tok[4]));
}
/*
if(strcmp(tok[0], "page") == 0 && ntok >= 3){
}
*/
if(strcmp(tok[0], "intr") == 0)
- Bprint(&bout, "interrupt %lld 1000\n", atoll(tok[1]));
+ Bprint(&bout, "intr %lld 1000\n", atoll(tok[1]));
if(strcmp(tok[0], "ctxt") == 0)
- Bprint(&bout, "context %lld 1000\n", atoll(tok[1]));
+ Bprint(&bout, "context %lld 10000\n", atoll(tok[1]));
if(strcmp(tok[0], "processes") == 0)
Bprint(&bout, "fork %lld 1000\n", atoll(tok[1]));
}
}
+void
+xvmstat(int first)
+{
+ static int fd = -1;
+ int i;
+
+ if(first){
+ fd = open("/proc/vmstat", OREAD);
+ return;
+ }
+
+ readfile(fd);
+ for(i=0; i<nline; i++){
+ tokens(i);
+ if(ntok < 2)
+ continue;
+ if(strcmp(tok[0], "pgfault") == 0)
+ Bprint(&bout, "fault %lld 100000\n", atoll(tok[1]));
+ }
+}
+
+void
+xwireless(int first)
+{
+ static int fd = -1;
+ int i;
+
+ if(first){
+ fd = open("/proc/net/wireless", OREAD);
+ return;
+ }
+
+ readfile(fd);
+ for(i=0; i<nline; i++){
+ tokens(i);
+ if(ntok < 3)
+ continue;
+ if(strcmp(tok[0], "wlan0:") == 0)
+ Bprint(&bout, "802.11 =%lld 100\n", atoll(tok[2]));
+ }
+}
blob - 75069e2b02650904c152837e9d53cb52a7b95821
blob + 74b8b76c72de390cb231720bc85e2d1e3a047ba8
--- src/cmd/draw/stats.c
+++ src/cmd/draw/stats.c
enum
{
+ V80211,
Vbattery,
Vcontext,
Vcpu,
char*
labels[Nvalue] =
{
+ "802.11",
"battery",
"context",
"cpu",
Font *mediumfont;
char *fontname;
char *mysysname;
-char argchars[] = "bcCeEfiIlmnsw";
+char argchars[] = "8bcCeEfiIlmnsw";
int pids[1024];
int parity; /* toggled to avoid patterns in textured background */
int nmach;
default:
fprint(2, "stats: internal error: unknown arg %c\n", args[i]);
usage();
+ case '8':
+ addgraph(V80211);
+ break;
case 'b':
addgraph(Vbattery);
break;