Merge pull request #2828 from Daniel-B-Smith/chrome-tracing-fixes

A couple of small fixes to the chrome tracing helper
This commit is contained in:
Evan Tschannen 2020-03-18 10:18:53 -07:00 committed by GitHub
commit 487d131b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -54,16 +54,15 @@ class CommitDebugHandler(xml.sax.ContentHandler, object):
self._f.write(json.dumps(d) + ', ')
def startElement(self, name, attrs):
if self._starttime is None:
self._starttime = float(attrs['Time'])
# I've flipped from using Async spans to Duration spans, because
# I kept on running into issues with trace viewer believeing there
# is no start or end of an emitted span even when there actually is.
if name == "Event" and attrs.get('Type') == "CommitDebug":
if self._starttime is None:
self._starttime = float(attrs['Time'])
attr_id = attrs['ID']
trace_id = self._idmap.setdefault(attr_id, attr_id)
# Trace viewer doesn't seem to care about types, so use host as pid and port as tid
(pid, tid) = attrs['Machine'].split(':')
traces = locationToPhase[attrs["Location"]]