Skip to content

Commit edb9fce

Browse files
lukaspiatkowskiFacebook Github Bot
authored andcommitted
#6 Notify SamplingProfiler of the main MachineThread
Reviewed By: bnham Differential Revision: D3503444 fbshipit-source-id: a2e9a692cd5badac5a15416844c8497f88021a5e
1 parent 4843a90 commit edb9fce

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

ReactCommon/cxxreact/BUCK

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ react_library(
117117
'JSCLegacyTracing.cpp',
118118
'JSCMemory.cpp',
119119
'JSCPerfStats.cpp',
120+
'JSCSamplingProfiler.cpp',
120121
'JSCTracing.cpp',
121122
'JSCWebWorker.cpp',
122123
'MethodCall.cpp',
@@ -130,6 +131,7 @@ react_library(
130131
'JSCLegacyTracing.h',
131132
'JSCMemory.h',
132133
'JSCPerfStats.h',
134+
'JSCSamplingProfiler.h',
133135
'JSCTracing.h',
134136
],
135137
exported_headers = [

ReactCommon/cxxreact/JSCExecutor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "SystraceSection.h"
2121
#include "Value.h"
2222

23+
#include "JSCSamplingProfiler.h"
24+
2325
#if defined(WITH_JSC_EXTRA_TRACING) || DEBUG
2426
#include "JSCTracing.h"
2527
#endif
@@ -223,6 +225,8 @@ void JSCExecutor::initOnJSVMThread() throw(JSException) {
223225
addNativeProfilingHooks(m_context);
224226
addNativeTracingLegacyHooks(m_context);
225227
PerfLogging::installNativeHooks(m_context);
228+
229+
initSamplingProfilerOnMainJSCThread(m_context);
226230
#endif
227231

228232
#ifdef WITH_FB_MEMORY_PROFILING
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2004-present Facebook. All Rights Reserved.
2+
3+
#ifdef WITH_JSC_EXTRA_TRACING
4+
5+
#include "JSCSamplingProfiler.h"
6+
7+
#include <JavaScriptCore/API/JSProfilerPrivate.h>
8+
9+
namespace facebook {
10+
namespace react {
11+
12+
void initSamplingProfilerOnMainJSCThread(JSGlobalContextRef ctx) {
13+
JSStartSamplingProfilingOnMainJSCThread(ctx);
14+
}
15+
16+
}
17+
}
18+
19+
#endif // WITH_JSC_EXTRA_TRACING
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2004-present Facebook. All Rights Reserved.
2+
3+
#pragma once
4+
5+
#ifdef WITH_JSC_EXTRA_TRACING
6+
7+
#include <JavaScriptCore/JSContextRef.h>
8+
9+
namespace facebook {
10+
namespace react {
11+
12+
void initSamplingProfilerOnMainJSCThread(JSGlobalContextRef ctx);
13+
}
14+
}
15+
16+
#endif // WITH_JSC_EXTRA_TRACING

0 commit comments

Comments
 (0)