mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Measure cache memory usage (#19251):
Made the memory cache data structure derive MallocSizeOf, along with manual size_of() implementations in malloc_size_of. Added a Measurable struct that acts as a container for fields size_of() can be called for. Added a new IpcReceiver used for listening to messages from the memory profiler, and used run_with_memory reporting to register a memory reporter in the thread. Now when a message from the memory profiler arrives, report includes sizes of public and private http caches. Updated test file.
This commit is contained in:
parent
d232705106
commit
af445a357d
13 changed files with 312 additions and 76 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use serde;
|
||||
use std::marker::Send;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
||||
|
@ -25,6 +26,14 @@ impl<T> OpaqueSender<T> for Sender<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> OpaqueSender<T> for IpcSender<T> where T: serde::Serialize {
|
||||
fn send(&self, message: T) {
|
||||
if let Err(e) = IpcSender::send(self, message) {
|
||||
warn!("Error communicating with the target thread from the profiler: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Front-end representation of the profiler used to communicate with the
|
||||
/// profiler.
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue