aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-07-29 19:42:00 -0600
committerbors-servo <metajack+bors@gmail.com>2015-07-29 19:42:00 -0600
commitbff5e325a89ab6621a049ac55c1da66e901c776c (patch)
tree892f9c2c435fe9a0dc22d415b3d170c7b2c9a002 /components/script
parentacbca7b3aaf18866f7a1a79d9684149897bf4305 (diff)
parent187068e2ae05e6fbe6d335bd961753c393e2bcb7 (diff)
downloadservo-bff5e325a89ab6621a049ac55c1da66e901c776c.tar.gz
servo-bff5e325a89ab6621a049ac55c1da66e901c776c.zip
Auto merge of #6802 - nnethercote:report-kind, r=jdm
Add a `kind` field to memory reports. This is used for two memory reporting improvements. - It's used to distinguish "explicit" memory reports from others. This mirrors the same categorization that is used in Firefox, and gives a single tree that's the best place to look. It replaces the "pages" tree which was always intended to be a temporary stand-in for "explicit". - It's used to computed "heap-unclassified" values for both the jemalloc and system heaps, both of which are placed into the "explicit" tree. Example output: ``` | 114.99 MiB -- explicit | 52.34 MiB -- jemalloc-heap-unclassified | 46.14 MiB -- system-heap-unclassified | 14.95 MiB -- url(file:///home/njn/moz/servo2/../servo-static-suite/wikipe dia/Guardians%20of%20the%20Galaxy%20(film)%20-%20Wikipedia,%20the%20free%20encyc lopedia.html) | 7.32 MiB -- js | 3.07 MiB -- malloc-heap | 3.00 MiB -- gc-heap | 2.49 MiB -- used | 0.34 MiB -- decommitted | 0.09 MiB -- unused | 0.09 MiB -- admin | 1.25 MiB -- non-heap | 1.36 MiB -- layout-worker-3-local-context | 1.34 MiB -- layout-worker-0-local-context | 1.24 MiB -- layout-worker-1-local-context | 1.24 MiB -- layout-worker-4-local-context | 1.16 MiB -- layout-worker-2-local-context | 0.89 MiB -- layout-worker-5-local-context | 0.38 MiB -- layout-task | 0.31 MiB -- display-list | 0.07 MiB -- local-context | 1.56 MiB -- compositor-task | 0.78 MiB -- surface-map | 0.78 MiB -- layer-tree ``` The heap-unclassified values dominate the "explicit" tree because reporter coverage is still quite poor. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6802) <!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r--components/script/script_task.rs46
1 files changed, 36 insertions, 10 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index d9560e40911..e34e93008d2 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -70,7 +70,7 @@ use net_traits::{ResourceTask, LoadConsumer, ControlMsg, Metadata};
use net_traits::LoadData as NetLoadData;
use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask, ImageCacheResult};
use net_traits::storage_task::StorageTask;
-use profile_traits::mem::{self, Report, Reporter, ReporterRequest, ReportsChan};
+use profile_traits::mem::{self, Report, Reporter, ReporterRequest, ReportKind, ReportsChan};
use string_cache::Atom;
use util::str::DOMString;
use util::task::spawn_named_with_send_on_failure;
@@ -1042,18 +1042,44 @@ impl ScriptTask {
let rt = JS_GetRuntime(cx);
let mut stats = ::std::mem::zeroed();
if CollectServoSizes(rt, &mut stats) {
- let mut report = |mut path_suffix, size| {
- let mut path = path!["pages", path_seg, "js"];
+ let mut report = |mut path_suffix, kind, size| {
+ let mut path = path![path_seg, "js"];
path.append(&mut path_suffix);
- reports.push(Report { path: path, size: size as usize })
+ reports.push(Report {
+ path: path,
+ kind: kind,
+ size: size as usize,
+ })
};
- report(path!["gc-heap", "used"], stats.gcHeapUsed);
- report(path!["gc-heap", "unused"], stats.gcHeapUnused);
- report(path!["gc-heap", "admin"], stats.gcHeapAdmin);
- report(path!["gc-heap", "decommitted"], stats.gcHeapDecommitted);
- report(path!["malloc-heap"], stats.mallocHeap);
- report(path!["non-heap"], stats.nonHeap);
+ // A note about possibly confusing terminology: the JS GC "heap" is allocated via
+ // mmap/VirtualAlloc, which means it's not on the malloc "heap", so we use
+ // `ExplicitNonHeapSize` as its kind.
+
+ report(path!["gc-heap", "used"],
+ ReportKind::ExplicitNonHeapSize,
+ stats.gcHeapUsed);
+
+ report(path!["gc-heap", "unused"],
+ ReportKind::ExplicitNonHeapSize,
+ stats.gcHeapUnused);
+
+ report(path!["gc-heap", "admin"],
+ ReportKind::ExplicitNonHeapSize,
+ stats.gcHeapAdmin);
+
+ report(path!["gc-heap", "decommitted"],
+ ReportKind::ExplicitNonHeapSize,
+ stats.gcHeapDecommitted);
+
+ // SpiderMonkey uses the system heap, not jemalloc.
+ report(path!["malloc-heap"],
+ ReportKind::ExplicitSystemHeapSize,
+ stats.mallocHeap);
+
+ report(path!["non-heap"],
+ ReportKind::ExplicitNonHeapSize,
+ stats.nonHeap);
}
}
reports