From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGit PATCH 4/5] Log subprocess calls during performance testing
Date: Thu, 17 Jul 2008 22:42:44 +0200 [thread overview]
Message-ID: <20080717204244.23407.16332.stgit@yoghurt> (raw)
In-Reply-To: <20080717204133.23407.34264.stgit@yoghurt>
Log each command's subprocess calls to a separate file.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
perf/perftest.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/perf/perftest.py b/perf/perftest.py
index 7072772..e5ed04b 100644
--- a/perf/perftest.py
+++ b/perf/perftest.py
@@ -1,4 +1,4 @@
-import datetime, subprocess, sys
+import datetime, os, os.path, subprocess, sys
def duration(t1, t2):
d = t2 - t1
@@ -8,8 +8,16 @@ class Run(object):
def __init__(self):
self.__cwd = None
self.__log = []
+ def __logfile(self, cmd):
+ fn = os.path.join(os.getcwd(), '%04d.log' % len(self.__log))
+ f = open(fn, 'w')
+ f.write(' '.join(cmd) + '\n' + '-'*70 + '\n\n')
+ f.close()
+ return fn
def __call__(self, *cmd, **args):
- kwargs = { 'cwd': self.__cwd }
+ env = dict(os.environ)
+ env['STGIT_SUBPROCESS_LOG'] = 'profile:' + self.__logfile(cmd)
+ kwargs = { 'cwd': self.__cwd, 'env': env }
if args.get('capture_stdout', False):
kwargs['stdout'] = subprocess.PIPE
start = datetime.datetime.now()
next prev parent reply other threads:[~2008-07-17 20:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-17 20:42 [StGit PATCH 0/5] Performance testing tools Karl Hasselström
2008-07-17 20:42 ` [StGit PATCH 1/5] Add some performance testing scripts Karl Hasselström
2008-07-17 20:42 ` [StGit PATCH 2/5] Log subproces activity to a file Karl Hasselström
2008-07-18 21:45 ` Catalin Marinas
2008-07-17 20:42 ` [StGit PATCH 3/5] Show full command in subprocess profiling Karl Hasselström
2008-07-18 21:47 ` Catalin Marinas
2008-07-17 20:42 ` Karl Hasselström [this message]
2008-07-17 20:42 ` [StGit PATCH 5/5] Global performance logging Karl Hasselström
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080717204244.23407.16332.stgit@yoghurt \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).