blob: b6d58fde96c42377b0650f6943fd1228bb24392b [file] [log] [blame]
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +05301#!/usr/bin/env python
2# Pretty print 9p simpletrace log
3# Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid>
4#
5# Author: Harsh Prateek Bora
6
7import simpletrace
8
9class VirtFSRequestTracker(simpletrace.Analyzer):
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053010 def begin(self):
11 print "Pretty printing 9p simpletrace log ..."
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053012
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053013 def v9fs_rerror(self, tag, id, err):
14 print "RERROR (tag =", tag, ", id =", id, ",err =", err, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053015
16 def v9fs_version(self, tag, id, msize, version):
17 print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
18
19 def v9fs_version_return(self, tag, id, msize, version):
20 print "RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
21
22 def v9fs_attach(self, tag, id, fid, afid, uname, aname):
23 print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")"
24
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053025 def v9fs_attach_return(self, tag, id, type, version, path):
26 print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053027
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053028 def v9fs_stat(self, tag, id, fid):
29 print "TSTAT (tag =", tag, ", fid =", fid, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053030
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053031 def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
32 print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053033
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053034 def v9fs_getattr(self, tag, id, fid, request_mask):
35 print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053036
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053037 def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
38 print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053039
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053040 def v9fs_walk(self, tag, id, fid, newfid, nwnames):
41 print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053042
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053043 def v9fs_walk_return(self, tag, id, nwnames, qids):
44 print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053045
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053046 def v9fs_open(self, tag, id, fid, mode):
47 print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053048
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053049 def v9fs_open_return(self, tag, id, type, version, path, iounit):
50 print "ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053051
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053052 def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
53 print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053054
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053055 def v9fs_lcreate_return(self, tag, id, type, version, path, iounit):
56 print "RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053057
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053058 def v9fs_fsync(self, tag, id, fid, datasync):
59 print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053060
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053061 def v9fs_clunk(self, tag, id, fid):
62 print "TCLUNK (tag =", tag, ", fid =", fid, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053063
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053064 def v9fs_read(self, tag, id, fid, off, max_count):
65 print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053066
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053067 def v9fs_read_return(self, tag, id, count, err):
68 print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053069
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053070 def v9fs_readdir(self, tag, id, fid, offset, max_count):
71 print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053072
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053073 def v9fs_readdir_return(self, tag, id, count, retval):
74 print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053075
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053076 def v9fs_write(self, tag, id, fid, off, count, cnt):
77 print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053078
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053079 def v9fs_write_return(self, tag, id, total, err):
80 print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053081
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053082 def v9fs_create(self, tag, id, fid, name, perm, mode):
83 print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053084
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053085 def v9fs_create_return(self, tag, id, type, version, path, iounit):
86 print "RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053087
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053088 def v9fs_symlink(self, tag, id, fid, name, symname, gid):
89 print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053090
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053091 def v9fs_symlink_return(self, tag, id, type, version, path):
92 print "RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053093
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053094 def v9fs_flush(self, tag, id, flush_tag):
95 print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053096
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +053097 def v9fs_link(self, tag, id, dfid, oldfid, name):
98 print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +053099
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530100 def v9fs_remove(self, tag, id, fid):
101 print "TREMOVE (tag =", tag, ", fid =", fid, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530102
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530103 def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
104 print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530105
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530106 def v9fs_mknod(self, tag, id, fid, mode, major, minor):
107 print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530108
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530109 def v9fs_lock(self, tag, id, fid, type, start, length):
110 print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530111
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530112 def v9fs_lock_return(self, tag, id, status):
113 print "RLOCK (tag =", tag, ", status =", status, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530114
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530115 def v9fs_getlock(self, tag, id, fid, type, start, length):
116 print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530117
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530118 def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
119 print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530120
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530121 def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
122 print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530123
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530124 def v9fs_mkdir_return(self, tag, id, type, version, path, err):
125 print "RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530126
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530127 def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
128 print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530129
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530130 def v9fs_xattrwalk_return(self, tag, id, size):
131 print "RXATTRWALK (tag =", tag, ", xattrsize =", size, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530132
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530133 def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
134 print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530135
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530136 def v9fs_readlink(self, tag, id, fid):
137 print "TREADLINK (tag =", tag, ", fid =", fid, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530138
Aneesh Kumar K.V7999f7e2011-10-24 15:09:49 +0530139 def v9fs_readlink_return(self, tag, id, target):
140 print "RREADLINK (tag =", tag, ", target =", target, ")"
Harsh Prateek Bora49a88ce2011-09-30 16:06:15 +0530141
142simpletrace.run(VirtFSRequestTracker())