mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Collecting mounting time inside MountingTelemetry
Summary: Now we also collect mounting time inside MountingTelemetry. We will use it soon. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D18285826 fbshipit-source-id: 512fc62c210a111614b0defb0d76cbd6228fe89f
This commit is contained in:
committed by
Facebook Github Bot
parent
2690e7363c
commit
89add2582d
@@ -269,12 +269,15 @@ static void RNPerformMountInstructions(
|
||||
}
|
||||
|
||||
RCTAssertMainQueue();
|
||||
auto metadata = MountingTransactionMetadata{surfaceId, transaction->getNumber(), transaction->getTelemetry()};
|
||||
auto telemetry = transaction->getTelemetry();
|
||||
auto number = transaction->getNumber();
|
||||
|
||||
[self.delegate mountingManager:self willMountComponentsWithRootTag:surfaceId];
|
||||
_observerCoordinator.notifyObserversMountingTransactionWillMount(metadata);
|
||||
_observerCoordinator.notifyObserversMountingTransactionWillMount({surfaceId, number, telemetry});
|
||||
telemetry.willMount();
|
||||
RNPerformMountInstructions(mutations, self.componentViewRegistry, _observerCoordinator, surfaceId);
|
||||
_observerCoordinator.notifyObserversMountingTransactionDidMount(metadata);
|
||||
telemetry.didMount();
|
||||
_observerCoordinator.notifyObserversMountingTransactionDidMount({surfaceId, number, telemetry});
|
||||
[self.delegate mountingManager:self didMountComponentsWithRootTag:surfaceId];
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,18 @@ void MountingTelemetry::didLayout() {
|
||||
layoutEndTime_ = monotonicTimeInMilliseconds();
|
||||
}
|
||||
|
||||
void MountingTelemetry::willMount() {
|
||||
assert(mountStartTime_ == kUndefinedTime);
|
||||
assert(mountEndTime_ == kUndefinedTime);
|
||||
mountStartTime_ = monotonicTimeInMilliseconds();
|
||||
}
|
||||
|
||||
void MountingTelemetry::didMount() {
|
||||
assert(mountStartTime_ != kUndefinedTime);
|
||||
assert(mountEndTime_ == kUndefinedTime);
|
||||
mountEndTime_ = monotonicTimeInMilliseconds();
|
||||
}
|
||||
|
||||
int64_t MountingTelemetry::getDiffStartTime() const {
|
||||
assert(diffStartTime_ != kUndefinedTime);
|
||||
assert(diffEndTime_ != kUndefinedTime);
|
||||
@@ -91,5 +103,17 @@ int64_t MountingTelemetry::getLayoutEndTime() const {
|
||||
return layoutEndTime_;
|
||||
}
|
||||
|
||||
int64_t MountingTelemetry::getMountStartTime() const {
|
||||
assert(mountStartTime_ != kUndefinedTime);
|
||||
assert(mountEndTime_ != kUndefinedTime);
|
||||
return mountStartTime_;
|
||||
}
|
||||
|
||||
int64_t MountingTelemetry::getMountEndTime() const {
|
||||
assert(mountStartTime_ != kUndefinedTime);
|
||||
assert(mountEndTime_ != kUndefinedTime);
|
||||
return mountEndTime_;
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
|
||||
@@ -28,6 +28,8 @@ class MountingTelemetry final {
|
||||
void didCommit();
|
||||
void willLayout();
|
||||
void didLayout();
|
||||
void willMount();
|
||||
void didMount();
|
||||
|
||||
/*
|
||||
* Reading
|
||||
@@ -39,6 +41,8 @@ class MountingTelemetry final {
|
||||
int64_t getCommitStartTime() const;
|
||||
int64_t getCommitEndTime() const;
|
||||
int64_t getCommitNumber() const;
|
||||
int64_t getMountStartTime() const;
|
||||
int64_t getMountEndTime() const;
|
||||
|
||||
private:
|
||||
constexpr static int64_t kUndefinedTime = std::numeric_limits<int64_t>::max();
|
||||
@@ -50,6 +54,8 @@ class MountingTelemetry final {
|
||||
int64_t commitEndTime_{kUndefinedTime};
|
||||
int64_t layoutStartTime_{kUndefinedTime};
|
||||
int64_t layoutEndTime_{kUndefinedTime};
|
||||
int64_t mountStartTime_{kUndefinedTime};
|
||||
int64_t mountEndTime_{kUndefinedTime};
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
|
||||
Reference in New Issue
Block a user