2018-05-31 22:31:03 +00:00
|
|
|
// Copyright (c) 2004-present, Facebook, Inc.
|
|
|
|
|
|
|
|
// This source code is licensed under the MIT license found in the
|
|
|
|
// LICENSE file in the root directory of this source tree.
|
2016-07-15 18:51:10 +00:00
|
|
|
|
|
|
|
#include "JSCSamplingProfiler.h"
|
|
|
|
|
2016-11-01 18:38:43 +00:00
|
|
|
#include <jschelpers/JSCHelpers.h>
|
2016-07-15 18:51:10 +00:00
|
|
|
|
2016-08-02 18:10:48 +00:00
|
|
|
static JSValueRef pokeSamplingProfiler(
|
|
|
|
JSContextRef ctx,
|
|
|
|
JSObjectRef function,
|
|
|
|
JSObjectRef thisObject,
|
|
|
|
size_t argumentCount,
|
|
|
|
const JSValueRef arguments[],
|
|
|
|
JSValueRef* exception) {
|
2016-11-22 14:05:38 +00:00
|
|
|
return JSC_JSPokeSamplingProfiler(ctx);
|
2016-08-02 18:10:48 +00:00
|
|
|
}
|
2017-07-25 11:45:08 +00:00
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
2016-07-15 18:51:10 +00:00
|
|
|
|
|
|
|
void initSamplingProfilerOnMainJSCThread(JSGlobalContextRef ctx) {
|
2016-11-22 14:05:38 +00:00
|
|
|
JSC_JSStartSamplingProfilingOnMainJSCThread(ctx);
|
2017-01-10 19:19:09 +00:00
|
|
|
|
|
|
|
// Allow the profiler to be poked from JS as well
|
|
|
|
// (see SamplingProfiler.js for an example of how it could be used with the JSCSamplingProfiler module).
|
2016-08-02 18:10:48 +00:00
|
|
|
installGlobalFunction(ctx, "pokeSamplingProfiler", pokeSamplingProfiler);
|
2016-07-15 18:51:10 +00:00
|
|
|
}
|
|
|
|
|
2017-07-25 11:45:08 +00:00
|
|
|
} }
|