@@ 11,7 11,6 @@ struct Mntrpc
Mntrpc* list; /* Free/pending list */
Fcall request; /* Outgoing file system protocol message */
Fcall reply; /* Incoming reply */
- uvlong stime; /* start time */
Mnt* m; /* Mount device during rpc */
Rendez r; /* Place to hang out */
char* rpc; /* I/O Data buffer */
@@ 19,6 18,9 @@ struct Mntrpc
char flushed; /* Flush was sent */
ushort flushtag; /* Tag flush sent on */
char flush[MAXMSG]; /* Somewhere to build flush */
+ uvlong stime; /* start time for mnt statistics */
+ ulong reqlen; /* request length for mnt statistics */
+ ulong replen; /* reply length for mnt statistics */
};
struct Mntalloc
@@ 56,7 58,7 @@ void mntrecover(Mnt*, Mntrpc*);
Chan* mntchan(void);
int defmaxmsg = MAXFDATA;
-extern void (*mntstats)(int, Chan*, uvlong);
+void (*mntstats)(int, Chan*, uvlong, ulong);
enum
{
@@ 679,7 681,7 @@ mountio(Mnt *m, Mntrpc *r)
error(Emountrpc);
}
r->stime = fastticks(nil);
- r->bytes = n;
+ r->reqlen = n;
poperror();
}
@@ 731,6 733,7 @@ mntrpcread(Mnt *m, Mntrpc *r)
if(n == 0)
continue;
+ r->replen = n;
if(convM2S(r->rpc, &r->reply, n) != 0)
return;
}
@@ 765,17 768,20 @@ mountmux(Mnt *m, Mntrpc *r)
*l = q->list;
unlock(m);
if(q != r) { /* Completed someone else */
+ /* trade pointers to receive buffer */
dp = q->rpc;
q->rpc = r->rpc;
r->rpc = dp;
q->reply = r->reply;
q->done = 1;
if(mntstats != nil)
- (*mntstats)(q->request.type, m->c, q->stime);
+ (*mntstats)(q->request.type, m->c, q->stime,
+ q->reqlen + r->replen);
wakeup(&q->r);
}else {
if(mntstats != nil)
- (*mntstats)(r->request.type, m->c, q->stime);
+ (*mntstats)(r->request.type, m->c, r->stime,
+ r->reqlen + r->replen);
q->done = 1;
}
return;
@@ 5,7 5,7 @@
#include "fns.h"
#include "../port/error.h"
-void (*mntstats)(int, Chan*, uvlong);
+void (*mntstats)(int, Chan*, uvlong, ulong);
enum
{
@@ 22,10 22,13 @@ struct Mntstats
Mntstats *next;
int inuse;
Chan c;
- uvlong hi[Nrpc]; /* high water time spent/msg type */
- uvlong tot[Nrpc]; /* cumulative time spent/msg type */
+ uvlong hi[Nrpc]; /* high water time spent */
+ uvlong tot[Nrpc]; /* cumulative time spent */
uvlong bytes[Nrpc]; /* cumulative bytes xfered */
ulong n[Nrpc]; /* number of messages/msg type */
+ uvlong bigtot[Nrpc]; /* cumulative time spent in big messages */
+ uvlong bigbytes[Nrpc]; /* cumulative bytes xfered in big messages */
+ ulong bign[Nrpc]; /* number of big messages */
ulong last100[Nrpc]; /* avg time for last 100 */
};
@@ 38,7 41,7 @@ static struct
} msalloc;
static void
-_mntstats(int type, Chan *c, uvlong start)
+_mntstats(int type, Chan *c, uvlong start, ulong bytes)
{
uint h;
Mntstats **l, *m;
@@ 82,6 85,13 @@ _mntstats(int type, Chan *c, uvlong start)
m->n[type]++;
x = elapsed;
m->last100[type] = (m->last100[type]*127 + x)>>7;
+ m->bytes[type] += bytes;
+
+ if(bytes >= 8*1024){
+ m->bigtot[type] += elapsed;
+ m->bign[type]++;
+ m->bigbytes[type] += bytes;
+ }
}
static int
@@ 139,7 149,7 @@ mntstatsclose(Chan*)
enum
{
- Nline= 80,
+ Nline= 141,
};
char *rpcname[Nrpc] =
@@ 193,9 203,10 @@ mntstatsread(Chan *c, void *buf, long n, vlong off)
avg = m->tot[o]/m->n[o];
else
avg = 0;
- sprint(xbuf, "%-8.8s %16.0llud %16.0llud %9.0lud %16.0llud %9.0lud\n",
- rpcname[o], m->hi[o],
- m->tot[o], m->n[o], avg, m->last100[o]);
+ sprint(xbuf, "%-8.8s %16.0llud %16.0llud %16.0llud %9.0lud %16.0llud %16.0llud %9.0lud %16.0llud %9.0lud\n",
+ rpcname[o], m->hi[o], m->tot[o], m->bytes[o], m->n[o],
+ m->bigtot[o], m->bigbytes[o], m->bign[o],
+ avg, m->last100[o]);
memmove(a, xbuf, Nline);
a += Nline;
o++;