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-08-02 18:10:48 +00:00
|
|
|
#include "JSCHelpers.h"
|
|
|
|
|
|
|
|
#include "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) {
|
|
|
|
return JSPokeSamplingProfiler(ctx);
|
|
|
|
}
|
|
|
|
}
|
2016-07-15 18:51:10 +00:00
|
|
|
|
|
|
|
void initSamplingProfilerOnMainJSCThread(JSGlobalContextRef ctx) {
|
|
|
|
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
|