зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1387958 - Measure the stylist during memory reporting. r=heycam.
Example output from the Obama Wikipedia page: > ├──2,315,600 B (01.16%) -- stylist > │ ├──1,916,928 B (00.96%) ── invalidation-map > │ ├────228,800 B (00.11%) ── rule-tree > │ ├────142,336 B (00.07%) ── element-and-pseudos-maps > │ ├─────14,336 B (00.01%) ── revalidation-selectors > │ ├──────9,648 B (00.00%) ── other > │ └──────3,552 B (00.00%) ── precomputed-pseudos This change requires new code to measure HashMaps, which uses the new 'malloc_enclosing_size_of' functions that can measure a heap block from an interior pointer. The patch changes MallocSizeOfFn to a newtype, and introduces MallocEnclosingSizeOfFn alongside. It also adds new traits: MallocSizeOfBox, MallocSizeOfVec, MallocSizeOfHash. These each contain a single method that does shallow measurement of the relevant type, which is often useful. (This is a different style to the existing MallocSizeOf trait, which does deep measurement, but I'm moving away from the always-deep-measurement style because it's less flexible.) MozReview-Commit-ID: FgJCCmdw0ZF --HG-- extra : rebase_source : c692c2073aa66020224489b97247c49de95a99a4
This commit is contained in:
Родитель
d5b2e6c551
Коммит
fb0b046a21
|
@ -375,6 +375,41 @@ CollectWindowReports(nsGlobalWindow *aWindow,
|
|||
aWindowTotalSizes->mLayoutServoStyleSetsStylistRuleTree +=
|
||||
windowSizes.mLayoutServoStyleSetsStylistRuleTree;
|
||||
|
||||
REPORT_SIZE("/layout/servo-style-sets/stylist/precomputed-pseudos",
|
||||
windowSizes.mLayoutServoStyleSetsStylistPrecomputedPseudos,
|
||||
"Memory used by precomputed pseudo-element declarations within "
|
||||
"Servo style sets within a window.");
|
||||
aWindowTotalSizes->mLayoutServoStyleSetsStylistPrecomputedPseudos +=
|
||||
windowSizes.mLayoutServoStyleSetsStylistPrecomputedPseudos;
|
||||
|
||||
REPORT_SIZE("/layout/servo-style-sets/stylist/element-and-pseudos-maps",
|
||||
windowSizes.mLayoutServoStyleSetsStylistElementAndPseudosMaps,
|
||||
"Memory used by element and pseudos maps within Servo style "
|
||||
"sets within a window.");
|
||||
aWindowTotalSizes->mLayoutServoStyleSetsStylistElementAndPseudosMaps +=
|
||||
windowSizes.mLayoutServoStyleSetsStylistElementAndPseudosMaps;
|
||||
|
||||
REPORT_SIZE("/layout/servo-style-sets/stylist/invalidation-map",
|
||||
windowSizes.mLayoutServoStyleSetsStylistInvalidationMap,
|
||||
"Memory used by invalidation maps within Servo style sets "
|
||||
"within a window.");
|
||||
aWindowTotalSizes->mLayoutServoStyleSetsStylistInvalidationMap +=
|
||||
windowSizes.mLayoutServoStyleSetsStylistInvalidationMap;
|
||||
|
||||
REPORT_SIZE("/layout/servo-style-sets/stylist/revalidation-selectors",
|
||||
windowSizes.mLayoutServoStyleSetsStylistRevalidationSelectors,
|
||||
"Memory used by selectors for cache revalidation within Servo "
|
||||
"style sets within a window.");
|
||||
aWindowTotalSizes->mLayoutServoStyleSetsStylistRevalidationSelectors +=
|
||||
windowSizes.mLayoutServoStyleSetsStylistRevalidationSelectors;
|
||||
|
||||
REPORT_SIZE("/layout/servo-style-sets/stylist/other",
|
||||
windowSizes.mLayoutServoStyleSetsStylistOther,
|
||||
"Memory used by other Stylist data within Servo style sets "
|
||||
"within a window.");
|
||||
aWindowTotalSizes->mLayoutServoStyleSetsStylistOther +=
|
||||
windowSizes.mLayoutServoStyleSetsStylistOther;
|
||||
|
||||
REPORT_SIZE("/layout/servo-style-sets/other",
|
||||
windowSizes.mLayoutServoStyleSetsOther,
|
||||
"Memory used by other parts of Servo style sets within a "
|
||||
|
@ -658,6 +693,11 @@ nsWindowMemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
|
|||
|
||||
REPORT("window-objects/layout/servo-style-sets",
|
||||
windowTotalSizes.mLayoutServoStyleSetsStylistRuleTree +
|
||||
windowTotalSizes.mLayoutServoStyleSetsStylistPrecomputedPseudos +
|
||||
windowTotalSizes.mLayoutServoStyleSetsStylistElementAndPseudosMaps +
|
||||
windowTotalSizes.mLayoutServoStyleSetsStylistInvalidationMap +
|
||||
windowTotalSizes.mLayoutServoStyleSetsStylistRevalidationSelectors +
|
||||
windowTotalSizes.mLayoutServoStyleSetsStylistOther +
|
||||
windowTotalSizes.mLayoutServoStyleSetsOther,
|
||||
"This is the sum of all windows' 'layout/servo-style-sets/' numbers.");
|
||||
|
||||
|
|
|
@ -177,6 +177,11 @@ class nsWindowSizes
|
|||
macro(Other, mLayoutPresShellSize) \
|
||||
macro(Style, mLayoutGeckoStyleSets) \
|
||||
macro(Style, mLayoutServoStyleSetsStylistRuleTree) \
|
||||
macro(Style, mLayoutServoStyleSetsStylistPrecomputedPseudos) \
|
||||
macro(Style, mLayoutServoStyleSetsStylistElementAndPseudosMaps) \
|
||||
macro(Style, mLayoutServoStyleSetsStylistInvalidationMap) \
|
||||
macro(Style, mLayoutServoStyleSetsStylistRevalidationSelectors) \
|
||||
macro(Style, mLayoutServoStyleSetsStylistOther) \
|
||||
macro(Style, mLayoutServoStyleSetsOther) \
|
||||
macro(Other, mLayoutTextRunsSize) \
|
||||
macro(Other, mLayoutPresContextSize) \
|
||||
|
|
|
@ -123,6 +123,7 @@ SERVO_BINDING_FUNC(Servo_StyleSet_ResolveForDeclarations,
|
|||
RawServoDeclarationBlockBorrowed declarations)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_AddSizeOfExcludingThis, void,
|
||||
mozilla::MallocSizeOf malloc_size_of,
|
||||
mozilla::MallocSizeOf malloc_enclosing_size_of,
|
||||
mozilla::ServoStyleSetSizes* sizes,
|
||||
RawServoStyleSetBorrowed set)
|
||||
SERVO_BINDING_FUNC(Servo_StyleContext_AddRef, void, ServoStyleContextBorrowed ctx);
|
||||
|
|
|
@ -249,6 +249,7 @@ ServoStyleSet::MediumFeaturesChangedRules(bool* aViewportUnitsUsed)
|
|||
}
|
||||
|
||||
MOZ_DEFINE_MALLOC_SIZE_OF(ServoStyleSetMallocSizeOf)
|
||||
MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ServoStyleSetMallocEnclosingSizeOf)
|
||||
|
||||
void
|
||||
ServoStyleSet::AddSizeOfIncludingThis(nsWindowSizes& aSizes) const
|
||||
|
@ -263,10 +264,23 @@ ServoStyleSet::AddSizeOfIncludingThis(nsWindowSizes& aSizes) const
|
|||
// Measure mRawSet. We use ServoStyleSetMallocSizeOf rather than
|
||||
// aMallocSizeOf to distinguish in DMD's output the memory measured within
|
||||
// Servo code.
|
||||
Servo_StyleSet_AddSizeOfExcludingThis(ServoStyleSetMallocSizeOf, &sizes,
|
||||
mRawSet.get());
|
||||
aSizes.mLayoutServoStyleSetsStylistRuleTree += sizes.mStylistRuleTree;
|
||||
aSizes.mLayoutServoStyleSetsOther += sizes.mOther;
|
||||
Servo_StyleSet_AddSizeOfExcludingThis(ServoStyleSetMallocSizeOf,
|
||||
ServoStyleSetMallocEnclosingSizeOf,
|
||||
&sizes, mRawSet.get());
|
||||
aSizes.mLayoutServoStyleSetsStylistRuleTree +=
|
||||
sizes.mStylistRuleTree;
|
||||
aSizes.mLayoutServoStyleSetsStylistPrecomputedPseudos +=
|
||||
sizes.mStylistPrecomputedPseudos;
|
||||
aSizes.mLayoutServoStyleSetsStylistElementAndPseudosMaps +=
|
||||
sizes.mStylistElementAndPseudosMaps;
|
||||
aSizes.mLayoutServoStyleSetsStylistInvalidationMap +=
|
||||
sizes.mStylistInvalidationMap;
|
||||
aSizes.mLayoutServoStyleSetsStylistRevalidationSelectors +=
|
||||
sizes.mStylistRevalidationSelectors;
|
||||
aSizes.mLayoutServoStyleSetsStylistOther +=
|
||||
sizes.mStylistOther;
|
||||
aSizes.mLayoutServoStyleSetsOther +=
|
||||
sizes.mOther;
|
||||
}
|
||||
|
||||
if (mStyleRuleMap) {
|
||||
|
|
|
@ -202,10 +202,20 @@ class ServoStyleSetSizes
|
|||
{
|
||||
public:
|
||||
size_t mStylistRuleTree;
|
||||
size_t mStylistPrecomputedPseudos;
|
||||
size_t mStylistElementAndPseudosMaps;
|
||||
size_t mStylistInvalidationMap;
|
||||
size_t mStylistRevalidationSelectors;
|
||||
size_t mStylistOther;
|
||||
size_t mOther;
|
||||
|
||||
ServoStyleSetSizes()
|
||||
: mStylistRuleTree(0)
|
||||
, mStylistPrecomputedPseudos(0)
|
||||
, mStylistElementAndPseudosMaps(0)
|
||||
, mStylistInvalidationMap(0)
|
||||
, mStylistRevalidationSelectors(0)
|
||||
, mStylistOther(0)
|
||||
, mOther(0)
|
||||
{}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче