I often count the number of compartments manually. It'd be nice (and easy) to automate this.
Should we telemeterize this?
Good idea, I'll do that.
Created attachment 546989 [details] [diff] [review]
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.
Created attachment 547321 [details] [diff] [review]
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.
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")?
(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.