[Pcsclite-cvs-commit] r5154 - /trunk/contrib/pcscd_perfs.py

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Aug 17 09:58:03 UTC 2010


Author: rousseau
Date: Tue Aug 17 09:58:03 2010
New Revision: 5154

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5154
Log:
calculate the cumulative times of pcscd logs

Added:
    trunk/contrib/pcscd_perfs.py   (with props)

Added: trunk/contrib/pcscd_perfs.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/contrib/pcscd_perfs.py?rev=5154&op=file
==============================================================================
--- trunk/contrib/pcscd_perfs.py (added)
+++ trunk/contrib/pcscd_perfs.py Tue Aug 17 09:58:03 2010
@@ -1,0 +1,61 @@
+#! /usr/bin/env python
+
+"""
+#   pcscd_perfs.py: calculate the cumulative times of pcscd logs
+#   Copyright (C) 2010  Ludovic Rousseau
+"""
+
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program; if not, write to the Free Software Foundation, Inc.,
+#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Usage:
+# 1. start pcscd in debug mode to generate a trace
+#    pcscd --foreground --debug
+# 2. copy the trace into a file using Copy/Paste of your terminal
+# 3. Make sure the first line of the log file is the first output line
+#    00000000 debuglog.c:277:DebugLogSetLevel() debug level=debug
+# 4. run the script
+#    ./pcscd_perfs.py log
+
+# Log file:
+# 00000000 debuglog.c:277:DebugLogSetLevel() debug level=debug
+# 00000316 configfile.l:242:DBGetReaderListDir() Parsing conf directory: /etc/reader.conf.d
+# 00000029 configfile.l:284:DBGetReaderList() Parsing conf file: /etc/reader.conf.d/0comments
+
+# Output:
+# 00000000 00000000 debuglog.c:277:DebugLogSetLevel() debug level=debug
+# 00000316 00000316 configfile.l:242:DBGetReaderListDir() Parsing conf directory: /etc/reader.conf.d
+# 00000345 00000029 configfile.l:284:DBGetReaderList() Parsing conf file: /etc/reader.conf.d/0comments
+
+# The first column is the cummulative time in µs i.e. the sum of the
+# second column
+
+
+def total_time(file):
+    total = 0
+    for line in open(file).readlines():
+        fields = line.split(' ')
+        delta = fields[0]
+
+        # user entered a Ctrl-C
+        if delta.startswith('\x03'):
+            return
+
+        total += int(delta)
+        print "%08d" % total, line,
+
+if __name__ == "__main__":
+    import sys
+
+    total_time(sys.argv[1])

Propchange: trunk/contrib/pcscd_perfs.py
------------------------------------------------------------------------------
    svn:executable = *




More information about the Pcsclite-cvs-commit mailing list