Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Unified Diff: infra/bots/utils.py

Issue 1769583002: Swarming tasks: print start and end time (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unused import Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra/bots/test_skia.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/bots/utils.py
diff --git a/infra/bots/utils.py b/infra/bots/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..ee648a26a4d4c6e3ee8fe0e08dd5ac9b240dab05
--- /dev/null
+++ b/infra/bots/utils.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+#
+# Copyright 2016 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+import datetime
+
+
+class print_timings(object):
+ def __init__(self):
+ self._start = None
+
+ def __enter__(self):
+ self._start = datetime.datetime.utcnow()
+ print 'Task started at %s GMT' % str(self._start)
+
+ def __exit__(self, t, v, tb):
+ finish = datetime.datetime.utcnow()
+ duration = (finish-self._start).total_seconds()
+ print 'Task finished at %s GMT (%f seconds)' % (str(finish), duration)
« no previous file with comments | « infra/bots/test_skia.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698