Skip to content

Instantly share code, notes, and snippets.

@jtheuer
Created October 30, 2015 12:03
Show Gist options
  • Save jtheuer/b7ca049f29f7c4e8698d to your computer and use it in GitHub Desktop.
Save jtheuer/b7ca049f29f7c4e8698d to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import fileinput
import re
import time
import subprocess, os, sys
def ctime():
return int(time.time() * 1000)
p = subprocess.Popen(sys.argv[1:], stdout=subprocess.PIPE)
goals = []
cur = None
for line in iter(p.stdout.readline, b''):
m = re.match('^\[INFO\] --- ([a-z0-9\:\.\-]+) \([a-z0-9\-]+\) \@ ([a-z0-9\:\.\-]+) ---', line)
if m:
cur = {'module': m.group(2), 'goal': m.group(1), 't': ctime()}
goals.append(cur)
goals.append({'module': 'finished', 'goal': '', 't': ctime()})
first_ts = goals[0]['t']
print("\n\n--- build results ---")
print("start\tduration\tmodule\tgoal")
for current, next in zip(goals, goals[1:]):
absolute = current['t'] - first_ts
diff = next['t'] - current['t']
print("%d\t%d\t%s\t%s" % (absolute, diff, current['module'], current['goal']))
@jtheuer
Copy link
Author

jtheuer commented Oct 30, 2015

Run with python profile_maven.py mvn clean install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment