Last Comment Bug 672694 - Add memory reporters to count compartments
: Add memory reporters to count compartments
Status: RESOLVED FIXED
[MemShrink]
:
Product: Core
Classification: Components
Component: XPConnect (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla8
Assigned To: Nicholas Nethercote [:njn] (on vacation until July 11)
:
Mentors:
Depends on:
Blocks: 672731
  Show dependency treegraph
 
Reported: 2011-07-19 17:31 PDT by Nicholas Nethercote [:njn] (on vacation until July 11)
Modified: 2011-07-22 14:44 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (3.00 KB, patch)
2011-07-19 22:04 PDT, Nicholas Nethercote [:njn] (on vacation until July 11)
gal: review+
Details | Diff | Review
patch, v2 (4.16 KB, patch)
2011-07-20 22:02 PDT, Nicholas Nethercote [:njn] (on vacation until July 11)
gal: review+
Details | Diff | Review

Description Nicholas Nethercote [:njn] (on vacation until July 11) 2011-07-19 17:31:45 PDT
I often count the number of compartments manually.  It'd be nice (and easy) to automate this.
Comment 1 Kyle Huey [:khuey] (khuey@mozilla.com) 2011-07-19 20:16:40 PDT
Should we telemeterize this?
Comment 2 Nicholas Nethercote [:njn] (on vacation until July 11) 2011-07-19 20:49:59 PDT
Good idea, I'll do that.
Comment 3 Nicholas Nethercote [:njn] (on vacation until July 11) 2011-07-19 22:04:25 PDT
Created attachment 546989 [details] [diff] [review]
patch

This patch adds the js-compartment-count reporter.

It doesn't telemeterize the counter, however.  TelemetryPing.js has code that assumes that any UNITS_COUNT reporter reports a number that always increases, and so reports the change between pings.  This makes sense for the page-fault counters, but not for js-compartment-count.  I'll defer that to a follow-up bug (and assign it to jlebar, who implemented the current behaviour.)  We might need to distinguish between UNITS_COUNT and UNITS_COUNT_INCREASING.
Comment 4 Nicholas Nethercote [:njn] (on vacation until July 11) 2011-07-20 22:02:36 PDT
Created attachment 547321 [details] [diff] [review]
patch, v2

I split this into two reporters:  js-system-compartment-count and js-user-compartment-count, because knowing the split is useful, and summing them to get the overall count is trivial.
Comment 5 Nicholas Nethercote [:njn] (on vacation until July 11) 2011-07-21 00:22:50 PDT
http://hg.mozilla.org/integration/mozilla-inbound/rev/9bb30262e230
Comment 6 :Ehsan Akhgari (out sick) 2011-07-21 08:16:04 PDT
http://hg.mozilla.org/mozilla-central/rev/9bb30262e230
Comment 7 Nickolay_Ponomarev 2011-07-22 14:31:32 PDT
The user vs system terminology (I realize it comes from the names in the code) is confusing.

Do I understand correctly that the 'system' compartment basically counts compartments for the chrome code (as in "System principal")?
Comment 8 Nicholas Nethercote [:njn] (on vacation until July 11) 2011-07-22 14:44:10 PDT
(In reply to comment #7)
> 
> Do I understand correctly that the 'system' compartment basically counts
> compartments for the chrome code (as in "System principal")?

That's right.  It also includes the 'atoms' compartment.

Note You need to log in before you can comment on or make changes to this bug.