Skip to content

Commit ed586ee

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
Ignore unusually early timestamps (facebook#53514)
Summary: Changelog: [Internal] Add a way to ignore unusually early timestamps, in our example those are artificial marks to create web tracks in correct order, coming from console.timeStamp via React. These markers are ignore in RNDT on Chrome, but not excluded in perfetto. Differential Revision: D81246527
1 parent 6c7c518 commit ed586ee

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/react-native/ReactCommon/reactperflogger/reactperflogger/ReactPerfettoLogger.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace facebook::react {
1818
namespace {
1919

2020
#if defined(WITH_PERFETTO)
21+
const HighResTimeStamp PROGRAM_INIT_TIME = HighResTimeStamp::now();
2122
const std::string PERFETTO_DEFAULT_TRACK_NAME = "# Web Performance";
2223
const std::string PERFETTO_TRACK_NAME_PREFIX = "# Web Performance: ";
2324

@@ -70,6 +71,10 @@ int64_t getDeltaNanos(HighResTimeStamp jsTime) {
7071
const std::optional<std::string_view>& trackGroup) {
7172
#if defined(WITH_PERFETTO)
7273
if (TRACE_EVENT_CATEGORY_ENABLED("react-native")) {
74+
if (startTime < PROGRAM_INIT_TIME || endTime < PROGRAM_INIT_TIME) {
75+
return;
76+
}
77+
7378
auto track = getPerfettoWebPerfTrackAsync(
7479
toPerfettoTrackName(trackName, trackGroup));
7580
TRACE_EVENT_BEGIN(

0 commit comments

Comments
 (0)