mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
Better logging in vtrpc, publish cache statistics.
This commit is contained in:
parent
f51bf04878
commit
7252036fe8
4 changed files with 23 additions and 7 deletions
|
@ -369,6 +369,7 @@ void vtrespond(VtReq*);
|
|||
|
||||
/* client */
|
||||
Packet *vtrpc(VtConn*, Packet*);
|
||||
Packet *_vtrpc(VtConn*, Packet*, VtFcall*);
|
||||
void vtrecvproc(void*); /* VtConn* */
|
||||
void vtsendproc(void*); /* VtConn* */
|
||||
|
||||
|
@ -428,6 +429,8 @@ int vtblockwrite(VtBlock*);
|
|||
VtBlock *vtblockcopy(VtBlock*);
|
||||
void vtblockduplock(VtBlock*);
|
||||
|
||||
extern int vtcachencopy, vtcachenread, vtcachenwrite;
|
||||
|
||||
/*
|
||||
* Hash tree file tree.
|
||||
*/
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#include <libc.h>
|
||||
#include <venti.h>
|
||||
|
||||
int nread, ncopy, nwrite;
|
||||
int vtcachenread;
|
||||
int vtcachencopy;
|
||||
int vtcachenwrite;
|
||||
|
||||
enum {
|
||||
BioLocal = 1,
|
||||
|
@ -419,6 +421,7 @@ vtcacheglobal(VtCache *c, uchar score[VtScoreSize], int type)
|
|||
b->nlock = 1;
|
||||
qunlock(&c->lk);
|
||||
|
||||
vtcachenread++;
|
||||
n = vtread(c->z, score, type, b->data, c->blocksize);
|
||||
if(n < 0){
|
||||
werrstr("vtread %V: %r", score);
|
||||
|
@ -512,6 +515,7 @@ vtblockwrite(VtBlock *b)
|
|||
|
||||
c = b->c;
|
||||
n = vtzerotruncate(b->type, b->data, c->blocksize);
|
||||
vtcachenwrite++;
|
||||
if(c->write(c->z, score, b->type, b->data, n) < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -540,7 +544,7 @@ vtblockcopy(VtBlock *b)
|
|||
{
|
||||
VtBlock *bb;
|
||||
|
||||
ncopy++;
|
||||
vtcachencopy++;
|
||||
bb = vtcacheallocblock(b->c, b->type);
|
||||
if(bb == nil){
|
||||
vtblockput(b);
|
||||
|
|
|
@ -9,12 +9,10 @@ vtfcallrpc(VtConn *z, VtFcall *ou, VtFcall *in)
|
|||
{
|
||||
Packet *p;
|
||||
|
||||
if(chattyventi)
|
||||
fprint(2, "%s -> %F\n", argv0, ou);
|
||||
p = vtfcallpack(ou);
|
||||
if(p == nil)
|
||||
return -1;
|
||||
if((p = vtrpc(z, p)) == nil)
|
||||
if((p = _vtrpc(z, p, ou)) == nil)
|
||||
return -1;
|
||||
if(vtfcallunpack(in, p) < 0){
|
||||
packetfree(p);
|
||||
|
|
|
@ -29,10 +29,9 @@ struct Rwait
|
|||
static int gettag(VtConn*, Rwait*);
|
||||
static void puttag(VtConn*, Rwait*, int);
|
||||
static void muxrpc(VtConn*, Packet*);
|
||||
Packet *vtrpc(VtConn*, Packet*);
|
||||
|
||||
Packet*
|
||||
vtrpc(VtConn *z, Packet *p)
|
||||
_vtrpc(VtConn *z, Packet *p, VtFcall *tx)
|
||||
{
|
||||
int i;
|
||||
uchar tag, buf[2], *top;
|
||||
|
@ -44,6 +43,12 @@ vtrpc(VtConn *z, Packet *p)
|
|||
qlock(&z->lk);
|
||||
r->r.l = &z->lk;
|
||||
tag = gettag(z, r);
|
||||
if(tx){
|
||||
/* vtfcallrpc can't print packet because it doesn't have tag */
|
||||
tx->tag = tag;
|
||||
if(chattyventi)
|
||||
fprint(2, "%s -> %F\n", argv0, tx);
|
||||
}
|
||||
|
||||
/* slam tag into packet */
|
||||
top = packetpeek(p, buf, 0, 2);
|
||||
|
@ -104,6 +109,12 @@ vtrpc(VtConn *z, Packet *p)
|
|||
return p;
|
||||
}
|
||||
|
||||
Packet*
|
||||
vtrpc(VtConn *z, Packet *p)
|
||||
{
|
||||
return _vtrpc(z, p, nil);
|
||||
}
|
||||
|
||||
static int
|
||||
gettag(VtConn *z, Rwait *r)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue