mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Stabilize sampling-profiler tracing test (#57924)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57924 Changelog: [Internal] Exercise JavaScript briefly before ending each trace. This gives the sampling profiler a bounded opportunity to record a stack while preserving the test comparison between disabled and enabled categories. Reviewed By: Abbondanzo Differential Revision: D115740464 fbshipit-source-id: 9aa42ccf597aa9198cb31c2dae601f1709506d24
This commit is contained in:
1 parent
551d12a787
commit
e774f0d623
1 file changed
+9
@@ -37,7 +37,15 @@ class TracingTest : public TracingTestBase<
|
||||
TEST_F(TracingTest, EnablesSamplingProfilerOnlyCategoryIsSpecified) {
|
||||
InSequence s;
|
||||
|
||||
const auto runSamplingWorkload = [this]() {
|
||||
eval(R"(
|
||||
const start = Date.now();
|
||||
while (Date.now() - start < 10) {}
|
||||
)");
|
||||
};
|
||||
|
||||
startTracing({});
|
||||
runSamplingWorkload();
|
||||
auto allTraceEvents = endTracingAndCollectEvents();
|
||||
|
||||
EXPECT_THAT(
|
||||
@@ -47,6 +55,7 @@ TEST_F(TracingTest, EnablesSamplingProfilerOnlyCategoryIsSpecified) {
|
||||
AtJsonPtr("/cat", "disabled-by-default-v8.cpu_profiler")))));
|
||||
|
||||
startTracing({tracing::Category::JavaScriptSampling});
|
||||
runSamplingWorkload();
|
||||
allTraceEvents = endTracingAndCollectEvents();
|
||||
|
||||
EXPECT_THAT(
|
||||
|
||||
Reference in new issue
Block a user