Files
react-native/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.h
T
Kevin GozaliandFacebook GitHub Bot fb39d45ed5 C++ - better => butter
Summary:
Renaming the `better` utilities to `butter`:
- to prevent claims that this library is superior to others - it really depends on use cases
- to indicate ease of use throughout the codebase, easily spread like butter

Changelog: [C++][Changed] Renaming C++ better util to butter, used by Fabric internals

Reviewed By: JoshuaGross

Differential Revision: D33242764

fbshipit-source-id: 26dc95d9597c61ce8e66708e44ed545e0fc5cff5
2021-12-20 22:25:14 -08:00

70 lines
1.8 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 <butter/small_vector.h>
#include <vector>
#include <react/renderer/telemetry/TransactionTelemetry.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 getTextMeasureTime() const;
TelemetryDuration getCommitTime() const;
TelemetryDuration getDiffTime() const;
TelemetryDuration getMountTime() const;
int getNumberOfTransactions() const;
int getNumberOfMutations() const;
int getNumberOfTextMeasurements() const;
int getLastRevisionNumber() const;
std::vector<TransactionTelemetry> getRecentTransactionTelemetries() const;
/*
* Incorporate data from given transaction telemetry into aggregated data
* for the Surface.
*/
void incorporate(
TransactionTelemetry const &telemetry,
int numberOfMutations);
private:
TelemetryDuration layoutTime_{};
TelemetryDuration commitTime_{};
TelemetryDuration textMeasureTime_{};
TelemetryDuration diffTime_{};
TelemetryDuration mountTime_{};
int numberOfTransactions_{};
int numberOfMutations_{};
int numberOfTextMeasurements_{};
int lastRevisionNumber_{};
butter::
small_vector<TransactionTelemetry, kMaxNumberOfRecordedCommitTelemetries>
recentTransactionTelemetries_{};
};
} // namespace react
} // namespace facebook