tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 1c4dda1d78557e8b6c5c1d95c97481c4aee88770
parent 6848892b8f03f70911d3114636890f54ed4efa1e
Author: Florian Quèze <florian@queze.net>
Date:   Tue,  4 Nov 2025 14:03:24 +0000

Bug 1998095 - only import SystemResourceMonitor in resourcehandler.py when starting the resource monitor, r=jcristau.

resourcemonitor.py checks for the availability of psutil at import time, but psutil might be part of a virtualenv that is not active yet (like the lint.txt site).

Differential Revision: https://phabricator.services.mozilla.com/D271195

Diffstat:
Mtesting/mozbase/mozlog/mozlog/handlers/resourcehandler.py | 24++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/testing/mozbase/mozlog/mozlog/handlers/resourcehandler.py b/testing/mozbase/mozlog/mozlog/handlers/resourcehandler.py @@ -4,8 +4,6 @@ import json -from mozsystemmonitor.resourcemonitor import SystemResourceMonitor - from ..reader import LogHandler @@ -15,6 +13,8 @@ class ResourceHandler(LogHandler): def __init__(self, command_context, **kwargs): super(ResourceHandler, self).__init__(**kwargs) + from mozsystemmonitor.resourcemonitor import SystemResourceMonitor + self.build_resources_profile_path = command_context._get_state_filename( "profile_build_resources.json" ) @@ -36,31 +36,31 @@ class ResourceHandler(LogHandler): def suite_start(self, data): self.current_suite = data.get("name") - SystemResourceMonitor.begin_marker("suite", self.current_suite) + self.resources.begin_marker("suite", self.current_suite) def suite_end(self, data): - SystemResourceMonitor.end_marker("suite", self.current_suite) + self.resources.end_marker("suite", self.current_suite) def group_start(self, data): - SystemResourceMonitor.begin_marker("test", data["name"]) + self.resources.begin_marker("test", data["name"]) def group_end(self, data): - SystemResourceMonitor.end_marker("test", data["name"]) + self.resources.end_marker("test", data["name"]) def test_start(self, data): - SystemResourceMonitor.begin_test(data) + self.resources.begin_test(data) def test_end(self, data): - SystemResourceMonitor.end_test(data) + self.resources.end_test(data) def test_status(self, data): - SystemResourceMonitor.test_status(data) + self.resources.test_status(data) def log(self, data): - SystemResourceMonitor.test_status(data) + self.resources.test_status(data) def process_output(self, data): - SystemResourceMonitor.test_status(data) + self.resources.test_status(data) def crash(self, data): - SystemResourceMonitor.crash(data) + self.resources.crash(data)