2 # Pretty print 9p simpletrace log
3 # Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid>
5 # Author: Harsh Prateek Bora
80 class VirtFSRequestTracker(simpletrace.Analyzer):
82 print "Pretty printing 9p simpletrace log ..."
84 def v9fs_rerror(self, tag, id, err):
85 print "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")"
87 def v9fs_version(self, tag, id, msize, version):
88 print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
90 def v9fs_version_return(self, tag, id, msize, version):
91 print "RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
93 def v9fs_attach(self, tag, id, fid, afid, uname, aname):
94 print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")"
96 def v9fs_attach_return(self, tag, id, type, version, path):
97 print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
99 def v9fs_stat(self, tag, id, fid):
100 print "TSTAT (tag =", tag, ", fid =", fid, ")"
102 def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
103 print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
105 def v9fs_getattr(self, tag, id, fid, request_mask):
106 print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
108 def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
109 print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
111 def v9fs_walk(self, tag, id, fid, newfid, nwnames):
112 print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
114 def v9fs_walk_return(self, tag, id, nwnames, qids):
115 print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
117 def v9fs_open(self, tag, id, fid, mode):
118 print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
120 def v9fs_open_return(self, tag, id, type, version, path, iounit):
121 print "ROPEN (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
123 def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
124 print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
126 def v9fs_lcreate_return(self, tag, id, type, version, path, iounit):
127 print "RLCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
129 def v9fs_fsync(self, tag, id, fid, datasync):
130 print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
132 def v9fs_clunk(self, tag, id, fid):
133 print "TCLUNK (tag =", tag, ", fid =", fid, ")"
135 def v9fs_read(self, tag, id, fid, off, max_count):
136 print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
138 def v9fs_read_return(self, tag, id, count, err):
139 print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
141 def v9fs_readdir(self, tag, id, fid, offset, max_count):
142 print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
144 def v9fs_readdir_return(self, tag, id, count, retval):
145 print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
147 def v9fs_write(self, tag, id, fid, off, count, cnt):
148 print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
150 def v9fs_write_return(self, tag, id, total, err):
151 print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
153 def v9fs_create(self, tag, id, fid, name, perm, mode):
154 print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
156 def v9fs_create_return(self, tag, id, type, version, path, iounit):
157 print "RCREATE (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
159 def v9fs_symlink(self, tag, id, fid, name, symname, gid):
160 print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
162 def v9fs_symlink_return(self, tag, id, type, version, path):
163 print "RSYMLINK (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
165 def v9fs_flush(self, tag, id, flush_tag):
166 print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
168 def v9fs_link(self, tag, id, dfid, oldfid, name):
169 print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
171 def v9fs_remove(self, tag, id, fid):
172 print "TREMOVE (tag =", tag, ", fid =", fid, ")"
174 def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
175 print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
177 def v9fs_mknod(self, tag, id, fid, mode, major, minor):
178 print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
180 def v9fs_lock(self, tag, id, fid, type, start, length):
181 print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
183 def v9fs_lock_return(self, tag, id, status):
184 print "RLOCK (tag =", tag, ", status =", status, ")"
186 def v9fs_getlock(self, tag, id, fid, type, start, length):
187 print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
189 def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
190 print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id, ")"
192 def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
193 print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
195 def v9fs_mkdir_return(self, tag, id, type, version, path, err):
196 print "RMKDIR (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
198 def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
199 print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
201 def v9fs_xattrwalk_return(self, tag, id, size):
202 print "RXATTRWALK (tag =", tag, ", xattrsize =", size, ")"
204 def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
205 print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
207 def v9fs_readlink(self, tag, id, fid):
208 print "TREADLINK (tag =", tag, ", fid =", fid, ")"
210 def v9fs_readlink_return(self, tag, id, target):
211 print "RREADLINK (tag =", tag, ", target =", target, ")"
213 simpletrace.run(VirtFSRequestTracker())