Files
react-native/ReactCommon/react/renderer/mounting/SurfaceTelemetry.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

65 lines
1.7 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 <better/small_vector.h>
#include <vector>
#include <react/renderer/mounting/MountingTelemetry.h>
#include <react/utils/Telemetry.h>
namespace facebook {
namespace react {
/*
* Represents telemetry data associated with a particular running Surface.
* Contains information aggregated from multiple completed transaction.
*/
class SurfaceTelemetry final {
public:
constexpr static size_t kMaxNumberOfRecordedCommitTelemetries = 16;
/*
* Metrics
*/
TelemetryDuration getLayoutTime() const;
TelemetryDuration getCommitTime() const;
TelemetryDuration getDiffTime() const;
TelemetryDuration getMountTime() const;
int getNumberOfTransactions() const;
int getNumberOfMutations() const;
int getNumberOfTextMeasurements() const;
int getLastRevisionNumber() const;
std::vector<MountingTelemetry> getRecentCommitTelemetries() const;
/*
* Incorporate data from given transaction telemetry into aggregated data
* for the Surface.
*/
void incorporate(MountingTelemetry const &telemetry, int numberOfMutations);
private:
TelemetryDuration layoutTime_{};
TelemetryDuration commitTime_{};
TelemetryDuration diffTime_{};
TelemetryDuration mountTime_{};
int numberOfTransactions_{};
int numberOfMutations_{};
int numberOfTextMeasurements_{};
int lastRevisionNumber_{};
better::small_vector<MountingTelemetry, kMaxNumberOfRecordedCommitTelemetries>
recentCommitTelemetries_{};
};
} // namespace react
} // namespace facebook