diff options
author | Josh Matthews <josh@joshmatthews.net> | 2025-04-16 09:11:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-16 13:11:44 +0000 |
commit | f16f625c9ba4aecf8a422c8ea5a2c9b18fe9944e (patch) | |
tree | 5a6a5a56521c8d48d19c52860d048be47ee4b408 /components/net/resource_thread.rs | |
parent | 94a9588bcc2d6396f76cc5f7467d31f22c8b3791 (diff) | |
download | servo-f16f625c9ba4aecf8a422c8ea5a2c9b18fe9944e.tar.gz servo-f16f625c9ba4aecf8a422c8ea5a2c9b18fe9944e.zip |
net: Measure HSTS memory usage. (#36558)
Records the memory usage of the HSTS lists in the network thread.
Testing: Verified the presence of the new reports for servo.org.
Fixes: #35059
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/net/resource_thread.rs')
-rw-r--r-- | components/net/resource_thread.rs | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/components/net/resource_thread.rs b/components/net/resource_thread.rs index 28934c94091..7235c362d66 100644 --- a/components/net/resource_thread.rs +++ b/components/net/resource_thread.rs @@ -21,7 +21,7 @@ use embedder_traits::EmbedderProxy; use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcReceiver, IpcReceiverSet, IpcSender}; use log::{debug, trace, warn}; -use malloc_size_of::{MallocSizeOf, MallocSizeOfOps}; +use malloc_size_of::MallocSizeOfOps; use net_traits::blob_url_store::parse_blob_url; use net_traits::filemanager_thread::FileTokenCheck; use net_traits::request::{Destination, RequestBuilder, RequestId}; @@ -32,10 +32,7 @@ use net_traits::{ FetchChannels, FetchTaskTarget, ResourceFetchTiming, ResourceThreads, ResourceTimingType, WebSocketDomAction, WebSocketNetworkEvent, }; -use profile_traits::mem::{ - ProcessReports, ProfilerChan as MemProfilerChan, Report, ReportKind, ReportsChan, -}; -use profile_traits::path; +use profile_traits::mem::{ProcessReports, ProfilerChan as MemProfilerChan, ReportsChan}; use profile_traits::time::ProfilerChan; use rustls::RootCertStore; use serde::{Deserialize, Serialize}; @@ -257,7 +254,7 @@ impl ResourceChannelManager { // If message is memory report, get the size_of of public and private http caches if id == reporter_id { if let Ok(msg) = data.to() { - self.process_report(msg, &private_http_state, &public_http_state); + self.process_report(msg, &public_http_state, &private_http_state); continue; } } else { @@ -284,22 +281,9 @@ impl ResourceChannelManager { private_http_state: &Arc<HttpState>, ) { let mut ops = MallocSizeOfOps::new(servo_allocator::usable_size, None, None); - let public_cache = public_http_state.http_cache.read().unwrap(); - let private_cache = private_http_state.http_cache.read().unwrap(); - - let public_report = Report { - path: path!["memory-cache", "public"], - kind: ReportKind::ExplicitJemallocHeapSize, - size: public_cache.size_of(&mut ops), - }; - - let private_report = Report { - path: path!["memory-cache", "private"], - kind: ReportKind::ExplicitJemallocHeapSize, - size: private_cache.size_of(&mut ops), - }; - - msg.send(ProcessReports::new(vec![public_report, private_report])); + let mut reports = public_http_state.memory_reports("public", &mut ops); + reports.extend(private_http_state.memory_reports("private", &mut ops)); + msg.send(ProcessReports::new(reports)); } fn cancellation_listener(&self, request_id: RequestId) -> Option<Arc<CancellationListener>> { |