Skip to content

Commit

Permalink
Bug 1860896 - Output events recorded with SystemResourceMonitor.recor…
Browse files Browse the repository at this point in the history
…d_event as instant markers in profiles, r=glandium.

Differential Revision: https://phabricator.services.mozilla.com/D191787
  • Loading branch information
fqueze committed Oct 26, 2023
1 parent b582f5e commit af4c80b
Showing 1 changed file with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -972,10 +972,15 @@ def add_marker(name_index, start, end, data, precision=None):
# For short duration markers, the profiler front-end may show up to
# 3 digits after the decimal point (ie. µs precision).
markers["startTime"].append(round((start - start_time) * 1000, precision))
markers["endTime"].append(round((end - start_time) * 1000, precision))
if end is None:
markers["endTime"].append(None)
# 0 = Instant marker
markers["phase"].append(0)
else:
markers["endTime"].append(round((end - start_time) * 1000, precision))
# 1 = marker with start and end times, 2 = start but no end.
markers["phase"].append(1)
markers["category"].append(0)
# 1 = marker with start and end times, 2 = start but no end.
markers["phase"].append(1)
markers["name"].append(name_index)
markers["data"].append(data)
markers["length"] = markers["length"] + 1
Expand Down Expand Up @@ -1106,5 +1111,16 @@ def format_percent(value):
if text:
markerData["text"] = text
add_marker(get_string_index(name), start, end, markerData, 3)
if self.events:
event_string_index = get_string_index("Event")
for event_time, text in self.events:
if text:
add_marker(
event_string_index,
event_time,
None,
{"type": "Text", "text": text},
3,
)

return profile

0 comments on commit af4c80b

Please sign in to comment.