summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.com>2019-01-17 15:13:27 +0000
committerJames Ennis <james.ennis@codethink.com>2019-01-17 15:13:27 +0000
commit63b02f7c810e55360126cb725952d6043ed7caa0 (patch)
treee896154ab884e6b4c91f8682f41aa1099d9a035b
parentce91ce5d2eb73295d1862aa8514e631b6231300e (diff)
downloadbuildstream-63b02f7c810e55360126cb725952d6043ed7caa0.tar.gz
_profile.py: Add timestamp to the logs
-rw-r--r--buildstream/_profile.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/buildstream/_profile.py b/buildstream/_profile.py
index 40cd2ab7e..f197b608c 100644
--- a/buildstream/_profile.py
+++ b/buildstream/_profile.py
@@ -62,15 +62,15 @@ class Profile():
def end(self):
self.profiler.disable()
+ dt = datetime.datetime.fromtimestamp(self.start)
+ timestamp = dt.strftime('%Y%m%dT%H%M%S')
+
filename = self.key.replace('/', '-')
filename = filename.replace('.', '-')
- filename = os.path.join(os.getcwd(), 'profile-' + filename + '.log')
+ filename = os.path.join(os.getcwd(), 'profile-' + timestamp + '-' + filename + '.log')
with open(filename, "a", encoding="utf-8") as f:
-
- dt = datetime.datetime.fromtimestamp(self.start)
time_ = dt.strftime('%Y-%m-%d %H:%M:%S')
-
heading = '================================================================\n'
heading += 'Profile for key: {}\n'.format(self.key)
heading += 'Started at: {}\n'.format(time_)