mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
[trace2] Add absolute time on trace2 exit events
Change-Id: I58aff46bd4ff4ba79286a7f1226e19eb568c34c5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/373954 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Josip Sokcevic <sokcevic@google.com> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
This commit is contained in:
parent
acb9523eaa
commit
2ad5d50874
@ -65,13 +65,13 @@ class EventLog(object):
|
|||||||
if env is None:
|
if env is None:
|
||||||
env = os.environ
|
env = os.environ
|
||||||
|
|
||||||
now = datetime.datetime.utcnow()
|
self.start = datetime.datetime.utcnow()
|
||||||
|
|
||||||
# Save both our sid component and the complete sid.
|
# Save both our sid component and the complete sid.
|
||||||
# We use our sid component (self._sid) as the unique filename prefix and
|
# We use our sid component (self._sid) as the unique filename prefix and
|
||||||
# the full sid (self._full_sid) in the log itself.
|
# the full sid (self._full_sid) in the log itself.
|
||||||
self._sid = "repo-%s-P%08x" % (
|
self._sid = "repo-%s-P%08x" % (
|
||||||
now.strftime("%Y%m%dT%H%M%SZ"),
|
self.start.strftime("%Y%m%dT%H%M%SZ"),
|
||||||
os.getpid(),
|
os.getpid(),
|
||||||
)
|
)
|
||||||
parent_sid = env.get(KEY)
|
parent_sid = env.get(KEY)
|
||||||
@ -136,6 +136,8 @@ class EventLog(object):
|
|||||||
if result is None:
|
if result is None:
|
||||||
result = 0
|
result = 0
|
||||||
exit_event["code"] = result
|
exit_event["code"] = result
|
||||||
|
time_delta = datetime.datetime.utcnow() - self.start
|
||||||
|
exit_event["t_abs"] = time_delta.total_seconds()
|
||||||
self._log.append(exit_event)
|
self._log.append(exit_event)
|
||||||
|
|
||||||
def CommandEvent(self, name, subcommands):
|
def CommandEvent(self, name, subcommands):
|
||||||
|
Loading…
Reference in New Issue
Block a user