/* * Copyright (c) Meta Platforms, Inc. and 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 #include #include #include "NativePerformanceObserver.h" namespace facebook::react { enum class PerformanceEntryType { UNDEFINED = 0, MARK = 1, _COUNT = 2, }; class PerformanceEntryReporter { public: void setReportingCallback(std::optional> callback); void startReporting(PerformanceEntryType entryType); void stopReporting(PerformanceEntryType entryType); std::vector getPendingEntries() const; std::vector popPendingEntries(); void clearPendingEntries(); void logEntry(const RawPerformanceEntry &entry); bool isReportingType(PerformanceEntryType entryType) const { return reportingType_[static_cast(entryType)]; } private: std::optional> callback_; std::vector entries_; std::array reportingType_{false}; }; } // namespace facebook::react