2016-07-15 18:51:10 +00:00
|
|
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
|
|
|
|
#ifdef WITH_JSC_EXTRA_TRACING
|
|
|
|
|
|
|
|
#include "JSCSamplingProfiler.h"
|
|
|
|
|
2016-08-02 18:10:48 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2016-07-15 18:51:10 +00:00
|
|
|
#include <JavaScriptCore/API/JSProfilerPrivate.h>
|
2016-11-01 18:38:43 +00:00
|
|
|
#include <jschelpers/JSCHelpers.h>
|
|
|
|
#include <jschelpers/Value.h>
|
2016-07-15 18:51:10 +00:00
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
2016-08-02 18:10:48 +00:00
|
|
|
namespace {
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2016-07-15 18:51:10 +00:00
|
|
|
|
|
|
|
void initSamplingProfilerOnMainJSCThread(JSGlobalContextRef ctx) {
|
2016-11-22 14:05:38 +00:00
|
|
|
JSC_JSStartSamplingProfilingOnMainJSCThread(ctx);
|
2016-08-02 18:10:48 +00:00
|
|
|
installGlobalFunction(ctx, "pokeSamplingProfiler", pokeSamplingProfiler);
|
2016-07-15 18:51:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // WITH_JSC_EXTRA_TRACING
|