Track how much measure cache entries are used

Summary:
@public

Adds the maximum number of measure cache entries in use to the metrics for `YGMarkerLayout`

Reviewed By: SidharthGuglani

Differential Revision: D13844731

fbshipit-source-id: fa66dbf1b7a1799494f72ecc17dfaef04d0b56e4
This commit is contained in:
David Aurelio 2019-01-29 14:44:55 -08:00 committed by Facebook Github Bot
parent 47a5bcbca2
commit c16fadb7c3
2 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,7 @@ typedef YG_ENUM_BEGIN(YGMarker){
typedef struct {
int layouts;
int measures;
int maxMeasureCache;
int cachedLayouts;
int cachedMeasures;
} YGMarkerLayoutData;

View File

@ -3889,6 +3889,11 @@ bool YGLayoutNodeInternal(
layout->lastOwnerDirection = ownerDirection;
if (cachedResults == nullptr) {
if (layout->nextCachedMeasurementsIndex + 1 >
(uint32_t) layoutMarkerData.maxMeasureCache) {
layoutMarkerData.maxMeasureCache =
layout->nextCachedMeasurementsIndex + 1;
}
if (layout->nextCachedMeasurementsIndex == YG_MAX_CACHED_RESULT_COUNT) {
if (gPrintChanges) {
YGLog(node, YGLogLevelVerbose, "Out of cache entries!\n");