diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /testing/mozbase/mozsystemmonitor | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.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.py | 16 |
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 |