summaryrefslogtreecommitdiff
path: root/sys/src/cmd/stats.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2018-09-09 00:24:43 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2018-09-09 00:24:43 +0200
commit4f2cdcf74bddc52179e205ac98774c4a6d194ed0 (patch)
tree993f2d8c4b663070fc8ddcc8bc6a871828ce2c92 /sys/src/cmd/stats.c
parente534c4147e1ab3f5891c8821c2cbac1c66bec93c (diff)
stats: fix etherstats, avoid vmax == 0
Diffstat (limited to 'sys/src/cmd/stats.c')
-rw-r--r--sys/src/cmd/stats.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/sys/src/cmd/stats.c b/sys/src/cmd/stats.c
index 654c76268..ac5f9b448 100644
--- a/sys/src/cmd/stats.c
+++ b/sys/src/cmd/stats.c
@@ -876,43 +876,35 @@ inintrval(Machine *m, uvlong *v, uvlong *vmax, int)
}
void
-etherval(Machine *m, uvlong *v, uvlong *vmax, int init)
+etherval(Machine *m, uvlong *v, uvlong *vmax, int)
{
*v = m->netetherstats[In]-m->prevetherstats[In] + m->netetherstats[Out]-m->prevetherstats[Out];
- *vmax = sleeptime*m->nproc;
- if(init)
- *vmax = sleeptime;
+ *vmax = sleeptime;
}
void
-etherinval(Machine *m, uvlong *v, uvlong *vmax, int init)
+etherinval(Machine *m, uvlong *v, uvlong *vmax, int)
{
*v = m->netetherstats[In]-m->prevetherstats[In];
- *vmax = sleeptime*m->nproc;
- if(init)
- *vmax = sleeptime;
+ *vmax = sleeptime;
}
void
-etheroutval(Machine *m, uvlong *v, uvlong *vmax, int init)
+etheroutval(Machine *m, uvlong *v, uvlong *vmax, int)
{
*v = m->netetherstats[Out]-m->prevetherstats[Out];
- *vmax = sleeptime*m->nproc;
- if(init)
- *vmax = sleeptime;
+ *vmax = sleeptime;
}
void
-ethererrval(Machine *m, uvlong *v, uvlong *vmax, int init)
+ethererrval(Machine *m, uvlong *v, uvlong *vmax, int)
{
int i;
*v = 0;
for(i=Err0; i<nelem(m->netetherstats); i++)
- *v += m->netetherstats[i];
- *vmax = (sleeptime/1000)*10*m->nproc;
- if(init)
- *vmax = (sleeptime/1000)*10;
+ *v += m->netetherstats[i]-m->prevetherstats[i];
+ *vmax = (sleeptime/1000)*10;
}
void
@@ -1184,6 +1176,8 @@ resize(void)
if(r.max.x <= g->r.max.x)
g->overtmp = allocimage(display, r, screen->chan, 0, -1);
g->newvalue(g->mach, &v, &vmax, 0);
+ if(vmax == 0)
+ vmax = 1;
redraw(g, vmax);
}
}
@@ -1412,6 +1406,8 @@ main(int argc, char *argv[])
parity = 1-parity;
for(i=0; i<nmach*ngraph; i++){
graph[i].newvalue(graph[i].mach, &v, &vmax, 0);
+ if(vmax == 0)
+ vmax = 1;
graph[i].update(&graph[i], v, vmax);
}
flushimage(display, 1);