Send measure pass duration
Summary: Send measure callback duration time to yoga plugin Reviewed By: davidaurelio Differential Revision: D15917548 fbshipit-source-id: 2c947f14ddbc5932cedd0aab8622260478ec29a6
This commit is contained in:
committed by
Facebook Github Bot
parent
9dac56e824
commit
2b8217ce8d
@@ -10,6 +10,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <chrono>
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "YGNode.h"
|
#include "YGNode.h"
|
||||||
#include "YGNodePrint.h"
|
#include "YGNodePrint.h"
|
||||||
@@ -29,6 +30,8 @@ __forceinline const float fmaxf(const float a, const float b) {
|
|||||||
|
|
||||||
using namespace facebook::yoga;
|
using namespace facebook::yoga;
|
||||||
using detail::Log;
|
using detail::Log;
|
||||||
|
using std::chrono::duration_cast;
|
||||||
|
using std::chrono::steady_clock;
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
static int YGAndroidLog(
|
static int YGAndroidLog(
|
||||||
@@ -1626,6 +1629,10 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
|||||||
ownerWidth),
|
ownerWidth),
|
||||||
YGDimensionHeight);
|
YGDimensionHeight);
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef YG_ENABLE_EVENTS
|
||||||
|
auto start = steady_clock::now();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Measure the text under the current constraints.
|
// Measure the text under the current constraints.
|
||||||
const YGSize measuredSize = marker::MarkerSection<YGMarkerMeasure>::wrap(
|
const YGSize measuredSize = marker::MarkerSection<YGMarkerMeasure>::wrap(
|
||||||
node,
|
node,
|
||||||
@@ -1635,9 +1642,14 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
|||||||
innerHeight,
|
innerHeight,
|
||||||
heightMeasureMode,
|
heightMeasureMode,
|
||||||
layoutContext);
|
layoutContext);
|
||||||
|
|
||||||
layoutMarkerData.measureCallbacks += 1;
|
layoutMarkerData.measureCallbacks += 1;
|
||||||
|
|
||||||
#ifdef YG_ENABLE_EVENTS
|
#ifdef YG_ENABLE_EVENTS
|
||||||
|
auto end = steady_clock::now();
|
||||||
|
auto measureCallbackDuration =
|
||||||
|
duration_cast<std::chrono::duration<float, std::milli>>(end - start);
|
||||||
|
|
||||||
Event::publish<Event::NodeMeasure>(
|
Event::publish<Event::NodeMeasure>(
|
||||||
node,
|
node,
|
||||||
{layoutContext,
|
{layoutContext,
|
||||||
@@ -1646,7 +1658,8 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
|||||||
innerHeight,
|
innerHeight,
|
||||||
heightMeasureMode,
|
heightMeasureMode,
|
||||||
measuredSize.width,
|
measuredSize.width,
|
||||||
measuredSize.height});
|
measuredSize.height,
|
||||||
|
measureCallbackDuration.count()});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
node->setLayoutMeasuredDimension(
|
node->setLayoutMeasuredDimension(
|
||||||
|
@@ -94,6 +94,7 @@ struct Event::TypedData<Event::NodeMeasure> {
|
|||||||
YGMeasureMode heightMeasureMode;
|
YGMeasureMode heightMeasureMode;
|
||||||
float measuredWidth;
|
float measuredWidth;
|
||||||
float measuredHeight;
|
float measuredHeight;
|
||||||
|
float measureCallbackDuration;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
Reference in New Issue
Block a user