Make the memory reporting multi-process aware (#35863)

So far the memory reporter aggregates reports from all processes, and
runs the system reporter only in the main process. Instead it is
desirable to have per-process reports. We do so by:
- creating a ProcessReports struct that holds includes the pid in
addition to the reports themselves.
- running the system memory reporter also in content processes.
- updating the about:memory page to create one report per process, and
add useful information like the pid and the urls loaded in a given
process.

<!-- Please describe your changes on the following line: -->


---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors


![image](https://github.com/user-attachments/assets/0bafe140-539d-4d6a-8316-639309a22d4a)

Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
webbeef 2025-04-04 22:42:12 -07:00 committed by GitHub
parent 76edcff202
commit aef8537d75
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 551 additions and 424 deletions

View file

@ -71,7 +71,7 @@ use net_traits::{
ResourceFetchTiming, ResourceThreads, ResourceTimingType,
};
use percent_encoding::percent_decode;
use profile_traits::mem::ReportsChan;
use profile_traits::mem::{ProcessReports, ReportsChan};
use profile_traits::time::ProfilerCategory;
use profile_traits::time_profile;
use script_layout_interface::{
@ -427,6 +427,7 @@ impl ScriptThreadFactory for ScriptThread {
memory_profiler_sender.run_with_memory_reporting(
|| {
script_thread.start(CanGc::note());
let _ = script_thread
.senders
.content_process_shutdown_sender
@ -2426,7 +2427,7 @@ impl ScriptThread {
document.window().layout().collect_reports(&mut reports);
}
reports_chan.send(reports);
reports_chan.send(ProcessReports::new(reports));
}
/// Updates iframe element after a change in visibility