shithub: fork

Download patch

ref: dc8c14d39b50adb0261299e5d8cc747e2ad78b6d
parent: f17884aa38dec2fc5d91b81abe94791636b5a27a
author: qwx <qwx@sciops.net>
date: Fri Jan 10 03:09:25 EST 2025

stats: update to latest

--- a/sys/src/cmd/stats.c
+++ b/sys/src/cmd/stats.c
@@ -56,6 +56,8 @@
 	Link,
 	Out,
 	Err0,
+	Overflows,
+	Soverflows,
 };
 
 struct Machine
@@ -76,8 +78,8 @@
 	uvlong		prevsysstat[10];
 	int		nproc;
 	int		lgproc;
-	uvlong		netetherstats[8];
-	uvlong		prevetherstats[8];
+	uvlong		netetherstats[9];
+	uvlong		prevetherstats[9];
 	uvlong		batterystats[2];
 	uvlong		temp[10];
 
@@ -114,6 +116,7 @@
 	Methererr,
 	Metherin,
 	Metherout,
+	Metherovf,
 	Mfault,
 	Midle,
 	Minintr,
@@ -138,6 +141,7 @@
 	"add  ethererr",
 	"add  etherin ",
 	"add  etherout",
+	"add  etherovf",
 	"add  fault   ",
 	"add  idle    ",
 	"add  inintr  ",
@@ -159,6 +163,7 @@
 void	contextval(Machine*, uvlong*, uvlong*, int),
 	etherval(Machine*, uvlong*, uvlong*, int),
 	ethererrval(Machine*, uvlong*, uvlong*, int),
+	etherovfval(Machine*, uvlong*, uvlong*, int),
 	etherinval(Machine*, uvlong*, uvlong*, int),
 	etheroutval(Machine*, uvlong*, uvlong*, int),
 	faultval(Machine*, uvlong*, uvlong*, int),
@@ -186,6 +191,7 @@
 	ethererrval,
 	etherinval,
 	etheroutval,
+	etherovfval,
 	faultval,
 	idleval,
 	inintrval,
@@ -805,7 +811,7 @@
 int
 needether(int init)
 {
-	return init | present[Mether] | present[Metherin] | present[Metherout] | present[Methererr];
+	return init | present[Mether] | present[Metherin] | present[Metherout] | present[Methererr] | present[Metherovf];
 }
 
 int
@@ -1059,6 +1065,17 @@
 }
 
 void
+etherovfval(Machine *m, uvlong *v, uvlong *vmax, int)
+{
+	int i;
+
+	*v = 0;
+	for(i=Overflows; i<=Soverflows; i++)
+		*v += m->netetherstats[i]-m->prevetherstats[i];
+	*vmax = (sleeptime/1000)*10;
+}
+
+void
 batteryval(Machine *m, uvlong *v, uvlong *vmax, int)
 {
 	*v = m->batterystats[0];
@@ -1422,6 +1439,7 @@
 		addgraph(Metherin);
 		addgraph(Metherout);
 		addgraph(Methererr);
+		addgraph(Metherovf);
 		break;
 	case 'p':
 		addgraph(Mtlbpurge);