tools: parselog: parse winfsp logs

This commit is contained in:
Bill Zissimopoulos 2020-08-26 16:01:14 -07:00
parent fcfebb968f
commit c18d4f1508
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3

View File

@ -121,8 +121,8 @@ proc parseLog(path: string, processReq: proc(req: Req), processRsp: proc(rsp: Rs
type type
Stat = ref object Stat = ref object
ototal: int # open total ototal: int # open total
omulti: int # multiplicate open total
oerror: int # open error total oerror: int # open error total
mtotal: int # multiplicate open total
rtotal: int # read total rtotal: int # read total
rbytes: uint64 # read bytes rbytes: uint64 # read bytes
rerror: int # read error total rerror: int # read error total
@ -172,8 +172,8 @@ proc processRsp(rsp: Rsp) =
aggr.ototal += 1 aggr.ototal += 1
stat.ocount += 1 stat.ocount += 1
if 2 == stat.ocount: if 2 == stat.ocount:
stat.mtotal += 1 stat.omulti += 1
aggr.mtotal += 1 aggr.omulti += 1
else: else:
var stat = stattab.mgetOrPut(filename, Stat()) var stat = stattab.mgetOrPut(filename, Stat())
stat.oerror += 1 stat.oerror += 1
@ -181,13 +181,12 @@ proc processRsp(rsp: Rsp) =
of "Read": of "Read":
var filename = filetab[req.context] var filename = filetab[req.context]
var stat = stattab.mgetOrPut(filename, Stat()) var stat = stattab.mgetOrPut(filename, Stat())
if 0 == rsp.status: if 0 == rsp.status or 0xC0000011u32 == rsp.status:
stat.rtotal += 1 stat.rtotal += 1
stat.rbytes += rsp.inform stat.rbytes += rsp.inform
aggr.rtotal += 1 aggr.rtotal += 1
aggr.rbytes += rsp.inform aggr.rbytes += rsp.inform
elif 0xC0000011u32 != rsp.status: else:
echo &"{rsp.status:X}"
stat.rerror += 1 stat.rerror += 1
aggr.rerror += 1 aggr.rerror += 1
of "Write": of "Write":
@ -284,10 +283,10 @@ proc main =
case s case s
of "ototal": of "ototal":
dumpstat ototal dumpstat ototal
of "omulti":
dumpstat omulti
of "oerror": of "oerror":
dumpstat oerror dumpstat oerror
of "mtotal":
dumpstat mtotal
of "rtotal": of "rtotal":
dumpstat rtotal dumpstat rtotal
of "rbytes": of "rbytes":