static JSValueRef nativeProfilerEnd( JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 1) { if (exception) { *exception = facebook::react::makeJSCException( ctx, "nativeProfilerEnd: requires at least 1 argument"); } return JSValueMakeUndefined(ctx); } std::string writeLocation("/sdcard/"); if (argumentCount > 1) { JSStringRef fileName = JSValueToStringCopy(ctx, arguments[1], exception); writeLocation += facebook::react::String::ref(fileName).str(); JSStringRelease(fileName); } else { writeLocation += "profile.json"; } JSStringRef title = JSValueToStringCopy(ctx, arguments[0], exception); JSEndProfilingAndRender(ctx, title, writeLocation.c_str()); JSStringRelease(title); return JSValueMakeUndefined(ctx); }
static JSValueRef nativeProfilerEnd( JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 1) { // Could raise an exception here. return JSValueMakeUndefined(ctx); } JSStringRef title = JSValueToStringCopy(ctx, arguments[0], NULL); JSEndProfilingAndRender(ctx, title, "/sdcard/profile.json"); JSStringRelease(title); return JSValueMakeUndefined(ctx); }
void stopAndOutputProfilingFile( JSContextRef ctx, JSStringRef title, const char *filename) { JSEndProfilingAndRender(ctx, title, filename); }