mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
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  Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
parent
76edcff202
commit
aef8537d75
15 changed files with 551 additions and 424 deletions
|
@ -32,6 +32,8 @@ use media::WindowGLContext;
|
|||
use net::image_cache::ImageCacheImpl;
|
||||
use net_traits::ResourceThreads;
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use profile::system_reporter;
|
||||
use profile_traits::mem::{ProfilerMsg, Reporter};
|
||||
use profile_traits::{mem as profile_mem, time};
|
||||
use script_layout_interface::{LayoutFactory, ScriptThreadFactory};
|
||||
use script_traits::{
|
||||
|
@ -591,4 +593,24 @@ impl UnprivilegedPipelineContent {
|
|||
pub fn prefs(&self) -> &Preferences {
|
||||
&self.prefs
|
||||
}
|
||||
|
||||
pub fn register_system_memory_reporter(&self) {
|
||||
// Register the system memory reporter, which will run on its own thread. It never needs to
|
||||
// be unregistered, because as long as the memory profiler is running the system memory
|
||||
// reporter can make measurements.
|
||||
let (system_reporter_sender, system_reporter_receiver) =
|
||||
ipc::channel().expect("failed to create ipc channel");
|
||||
ROUTER.add_typed_route(
|
||||
system_reporter_receiver,
|
||||
Box::new(|message| {
|
||||
if let Ok(request) = message {
|
||||
system_reporter::collect_reports(request);
|
||||
}
|
||||
}),
|
||||
);
|
||||
self.mem_profiler_chan.send(ProfilerMsg::RegisterReporter(
|
||||
format!("system-content-{}", std::process::id()),
|
||||
Reporter(system_reporter_sender),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue