summaryrefslogtreecommitdiff
path: root/job-times
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-09-23 09:12:06 +0100
committerLars Wirzenius <liw@liw.fi>2012-09-23 09:12:06 +0100
commitc2613e4431ced222f73161edc94ecd3bbe4babbd (patch)
tree654accd197d6b316b5382c8b8051fb1022116307 /job-times
parentb483f475f3b1fbee5105c56e051885ac5b0fd3a6 (diff)
downloadjenkinstool-c2613e4431ced222f73161edc94ecd3bbe4babbd.tar.gz
Add script to list the time it takes to run each job
Diffstat (limited to 'job-times')
-rwxr-xr-xjob-times26
1 files changed, 26 insertions, 0 deletions
diff --git a/job-times b/job-times
new file mode 100755
index 0000000..7cd4b35
--- /dev/null
+++ b/job-times
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+import cliapp
+import time
+
+class ListJobTimes(cliapp.Application):
+
+ def process_input_line(self, filename, line):
+ words = line.split()
+ if len(words) < 6 or words[2] != 'INFO':
+ pass
+ elif words[3] == 'Starting' and words[4] == 'job':
+ self.started = self.parse_time(words[0], words[1])
+ self.jobid = words[5]
+ elif words[3] == 'Finished' and words[4] == 'job':
+ ended = self.parse_time(words[0], words[1])
+ self.output.write('%.1f %s\n' % (ended - self.started, self.jobid))
+ self.started = None
+ self.jobid = None
+
+ def parse_time(self, dt, tm):
+ t = time.strptime('%s %s' % (dt, tm), '%Y-%m-%d %H:%M:%S')
+ return time.mktime(t)
+
+ListJobTimes().run()
+