Files
react-native/ReactCommon/react/renderer/mounting/MountingTelemetry.h
T
Valentin Shergin cb48b50290 Fabric: Storing commit revision number in MountingTelemetry
Summary:
Now we store a revision number of a Shadow Tree that leads to a transaction for which the concrete instance of MountingTelemetry corresponds. This is useful to understand how many actual transactions were skipped during a mounting phase (a mounting transaction does not directly correspond to a commit operation).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D23364663

fbshipit-source-id: 32b86bcdfc1ae97d8fff3b97a8615cc5a5b4d4a9
2020-08-27 12:33:58 -07:00

78 lines
2.0 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <chrono>
#include <cstdint>
#include <react/utils/Telemetry.h>
#include <react/utils/ThreadStorage.h>
namespace facebook {
namespace react {
/*
* Represents telemetry data associated with a particular revision of
* `ShadowTree`.
*/
class MountingTelemetry final {
public:
/*
* Thread-local Telemetry instance
*/
static MountingTelemetry *threadLocalTelemetry();
void setAsThreadLocal();
void unsetAsThreadLocal();
/*
* Signaling
*/
void willDiff();
void didDiff();
void willCommit();
void didCommit();
void willLayout();
void didMeasureText();
void didLayout();
void willMount();
void didMount();
void setRevisionNumber(int revisionNumber);
/*
* Reading
*/
TelemetryTimePoint getDiffStartTime() const;
TelemetryTimePoint getDiffEndTime() const;
TelemetryTimePoint getLayoutStartTime() const;
TelemetryTimePoint getLayoutEndTime() const;
TelemetryTimePoint getCommitStartTime() const;
TelemetryTimePoint getCommitEndTime() const;
TelemetryTimePoint getMountStartTime() const;
TelemetryTimePoint getMountEndTime() const;
int getNumberOfTextMeasurements() const;
int getRevisionNumber() const;
private:
TelemetryTimePoint diffStartTime_{kTelemetryUndefinedTimePoint};
TelemetryTimePoint diffEndTime_{kTelemetryUndefinedTimePoint};
TelemetryTimePoint commitStartTime_{kTelemetryUndefinedTimePoint};
TelemetryTimePoint commitEndTime_{kTelemetryUndefinedTimePoint};
TelemetryTimePoint layoutStartTime_{kTelemetryUndefinedTimePoint};
TelemetryTimePoint layoutEndTime_{kTelemetryUndefinedTimePoint};
TelemetryTimePoint mountStartTime_{kTelemetryUndefinedTimePoint};
TelemetryTimePoint mountEndTime_{kTelemetryUndefinedTimePoint};
int numberOfTextMeasurements_{0};
int revisionNumber_{0};
};
} // namespace react
} // namespace facebook