| 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)
|
|
|