Skip to content

Commit

Permalink
Track how much measure cache entries are used
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davidaurelio authored and facebook-github-bot committed Jan 29, 2019
1 parent c7a6980 commit 9adc3b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions YGMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ typedef YG_ENUM_BEGIN(YGMarker){
typedef struct {
int layouts;
int measures;
int maxMeasureCache;
int cachedLayouts;
int cachedMeasures;
} YGMarkerLayoutData;
Expand Down
5 changes: 5 additions & 0 deletions Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 9adc3b4

Please sign in to comment.