From patchwork Thu Nov 10 07:03:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsh Prateek Bora X-Patchwork-Id: 124798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CB1C01007D1 for ; Thu, 10 Nov 2011 18:04:56 +1100 (EST) Received: from localhost ([::1]:36603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROOgp-0005bb-FG for incoming@patchwork.ozlabs.org; Thu, 10 Nov 2011 02:04:47 -0500 Received: from eggs.gnu.org ([140.186.70.92]:54314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROOgj-0005bP-4t for qemu-devel@nongnu.org; Thu, 10 Nov 2011 02:04:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROOgi-0004H9-2B for qemu-devel@nongnu.org; Thu, 10 Nov 2011 02:04:41 -0500 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:51687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROOgh-0004GL-F0 for qemu-devel@nongnu.org; Thu, 10 Nov 2011 02:04:40 -0500 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Nov 2011 12:33:55 +0530 Received: from d28relay03.in.ibm.com ([9.184.220.60]) by e28smtp06.in.ibm.com ([192.168.1.136]) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 10 Nov 2011 12:33:53 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pAA73pgq3178744 for ; Thu, 10 Nov 2011 12:33:52 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pAA73pT0025569 for ; Thu, 10 Nov 2011 12:33:51 +0530 Received: from harshbora.in.ibm.com (K50wks273945wss.in.ibm.com [9.124.35.107]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id pAA73pIf025562 for ; Thu, 10 Nov 2011 12:33:51 +0530 From: Harsh Prateek Bora To: qemu-devel@nongnu.org Date: Thu, 10 Nov 2011 12:33:51 +0530 Message-Id: <1320908631-16069-1-git-send-email-harsh@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1.1 x-cbid: 11111007-9574-0000-0000-0000001C966F X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 122.248.162.6 Subject: [Qemu-devel] [PATCH v2 RESEND] scripts/analyse-9p-simpletrace.py: Add symbolic names for 9p operations. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Currently, we just print the numerical value of 9p operation identifier in case of RERROR which is less meaningful for readability. Mapping 9p operation ids to symbolic names provides a better tracelog: RERROR (tag = 1 , id = TWALK , err = " No such file or directory ") RERROR (tag = 1 , id = TUNLINKAT , err = " Directory not empty ") This patch provides a dictionary of all possible 9p operation symbols mapped to their numerical identifiers which are likely to be used in future at various places in this script. Signed-off-by: Harsh Prateek Bora --- v2: - stringify error code also. v1: - dictionary for 9p operations. scripts/analyse-9p-simpletrace.py | 74 ++++++++++++++++++++++++++++++++++++- 1 files changed, 72 insertions(+), 2 deletions(-) diff --git a/scripts/analyse-9p-simpletrace.py b/scripts/analyse-9p-simpletrace.py index b6d58fd..3c7231d 100755 --- a/scripts/analyse-9p-simpletrace.py +++ b/scripts/analyse-9p-simpletrace.py @@ -3,15 +3,85 @@ # Usage: ./analyse-9p-simpletrace # # Author: Harsh Prateek Bora - +import os import simpletrace +symbol_9p = { + 6 : 'TLERROR', + 7 : 'RLERROR', + 8 : 'TSTATFS', + 9 : 'RSTATFS', + 12 : 'TLOPEN', + 13 : 'RLOPEN', + 14 : 'TLCREATE', + 15 : 'RLCREATE', + 16 : 'TSYMLINK', + 17 : 'RSYMLINK', + 18 : 'TMKNOD', + 19 : 'RMKNOD', + 20 : 'TRENAME', + 21 : 'RRENAME', + 22 : 'TREADLINK', + 23 : 'RREADLINK', + 24 : 'TGETATTR', + 25 : 'RGETATTR', + 26 : 'TSETATTR', + 27 : 'RSETATTR', + 30 : 'TXATTRWALK', + 31 : 'RXATTRWALK', + 32 : 'TXATTRCREATE', + 33 : 'RXATTRCREATE', + 40 : 'TREADDIR', + 41 : 'RREADDIR', + 50 : 'TFSYNC', + 51 : 'RFSYNC', + 52 : 'TLOCK', + 53 : 'RLOCK', + 54 : 'TGETLOCK', + 55 : 'RGETLOCK', + 70 : 'TLINK', + 71 : 'RLINK', + 72 : 'TMKDIR', + 73 : 'RMKDIR', + 74 : 'TRENAMEAT', + 75 : 'RRENAMEAT', + 76 : 'TUNLINKAT', + 77 : 'RUNLINKAT', + 100 : 'TVERSION', + 101 : 'RVERSION', + 102 : 'TAUTH', + 103 : 'RAUTH', + 104 : 'TATTACH', + 105 : 'RATTACH', + 106 : 'TERROR', + 107 : 'RERROR', + 108 : 'TFLUSH', + 109 : 'RFLUSH', + 110 : 'TWALK', + 111 : 'RWALK', + 112 : 'TOPEN', + 113 : 'ROPEN', + 114 : 'TCREATE', + 115 : 'RCREATE', + 116 : 'TREAD', + 117 : 'RREAD', + 118 : 'TWRITE', + 119 : 'RWRITE', + 120 : 'TCLUNK', + 121 : 'RCLUNK', + 122 : 'TREMOVE', + 123 : 'RREMOVE', + 124 : 'TSTAT', + 125 : 'RSTAT', + 126 : 'TWSTAT', + 127 : 'RWSTAT' +} class VirtFSRequestTracker(simpletrace.Analyzer): def begin(self): print "Pretty printing 9p simpletrace log ..." def v9fs_rerror(self, tag, id, err): - print "RERROR (tag =", tag, ", id =", id, ",err =", err, ")" + print "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")" def v9fs_version(self, tag, id, msize, version): print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"