summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozsystemmonitor
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
commita90a5cba08fdf6c0ceb95101c275108a152a3aed (patch)
tree532507288f3defd7f4dcf1af49698bcb76034855 /testing/mozbase/mozsystemmonitor
parentAdding debian version 126.0.1-1. (diff)
downloadfirefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz
firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/mozbase/mozsystemmonitor')
-rw-r--r--testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
index 978d7d6911..553fcde284 100644
--- a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
+++ b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
@@ -314,6 +314,7 @@ class SystemResourceMonitor(object):
self._swap_type = type(swap)
self._swap_len = len(swap)
self.start_timestamp = time.time()
+ self.start_time = time.monotonic()
self._pipe, child_pipe = multiprocessing.Pipe(True)
@@ -328,6 +329,9 @@ class SystemResourceMonitor(object):
self._pipe.send(("terminate",))
self._process.join()
+ def convert_to_monotonic_time(self, timestamp):
+ return timestamp - self.start_timestamp + self.start_time
+
# Methods to control monitoring.
def start(self):
@@ -458,18 +462,24 @@ class SystemResourceMonitor(object):
SystemResourceMonitor.instance.markers.append((name, start, end, text))
@staticmethod
- def begin_marker(name, text, disambiguator=None):
+ def begin_marker(name, text, disambiguator=None, timestamp=None):
if SystemResourceMonitor.instance:
id = name + ":" + text
if disambiguator:
id += ":" + disambiguator
- SystemResourceMonitor.instance._active_markers[id] = time.monotonic()
+ SystemResourceMonitor.instance._active_markers[id] = (
+ SystemResourceMonitor.instance.convert_to_monotonic_time(timestamp)
+ if timestamp
+ else time.monotonic()
+ )
@staticmethod
- def end_marker(name, text, disambiguator=None):
+ def end_marker(name, text, disambiguator=None, timestamp=None):
if not SystemResourceMonitor.instance:
return
end = time.monotonic()
+ if timestamp:
+ end = SystemResourceMonitor.instance.convert_to_monotonic_time(timestamp)
id = name + ":" + text
if disambiguator:
id += ":" + disambiguator