summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-06-25 21:51:50 +0300
committerLars Wirzenius <liw@liw.fi>2018-06-25 21:51:50 +0300
commit48bd18b6d94e5902cd71cd4a914cda7c5e0c988a (patch)
treeb96b8cbf4f8666c6e3e6d4a63fa96a6c3ac56057
parenta390a380194ee33812840b28e7a868f38b9bc728 (diff)
downloadick2-48bd18b6d94e5902cd71cd4a914cda7c5e0c988a.tar.gz
Change: indicate what each action was in timestamps output
-rwxr-xr-xtimestamps33
1 files changed, 31 insertions, 2 deletions
diff --git a/timestamps b/timestamps
index 32f1a30..6184e41 100755
--- a/timestamps
+++ b/timestamps
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import json
import re
import sys
@@ -35,6 +36,19 @@ def parse_ts(ts):
return hour * 3600 + minute * 60 + second
+def step_summary(step):
+ if 'action' in step:
+ return step['action']
+ if 'shell' in step:
+ return 'shell'
+ if 'python' in step:
+ return 'python'
+ if 'debootstrap' in step:
+ return 'debootstrap'
+ if 'archive' in step:
+ return 'archive'
+ return str(step)
+
build_starts = re.compile(r'^Build starts at (?P<ts>.*)$')
build_ends = re.compile(r'^Build ends at (?P<ts>.*),')
action_starts = re.compile(r'^Action starts at (?P<ts>.*):$')
@@ -63,19 +77,34 @@ names = {
action_starts: 'Action',
}
-durations = []
+step = ''
+read_action = False
+action = ''
for line in sys.stdin:
+ if read_action:
+ action += line
+ if line.rstrip() == '}':
+ action_obj = json.loads(action)
+ step = action_obj.get('step')
+ read_action = False
+ action = ''
+
for pat in patterns:
m = pat.match(line)
if m is None:
continue
ts = m.group('ts')
+ read_action = pat == action_starts
if pat in started:
started[pat] = parse_ts(ts)
else:
ended = parse_ts(ts)
start_pat = pairs[pat]
- print(names[start_pat], ended - started[start_pat])
+ print(
+ names[start_pat],
+ ended - started[start_pat],
+ step_summary(step))
+ step = ''
break