Skip to content
Permalink
Browse files

Allow the output of the JSC profile to be specified in JS

Reviewed By: astreet

Differential Revision: D2674869

fb-gh-sync-id: 15e192015ecc9291359d6c988e793849eac97513
  • Loading branch information...
mikearmstrong001 authored and facebook-github-bot-8 committed Nov 25, 2015
1 parent e6897dd commit aaffb239cab5e730bbe83041fc9404946f2215e3
Showing with 12 additions and 3 deletions.
  1. +12 −3 ReactAndroid/src/main/jni/react/JSCLegacyProfiler.cpp
@@ -7,6 +7,7 @@
#include <jsc_legacy_profiler.h>
#include "JSCHelpers.h"
#include "JSCLegacyProfiler.h"
#include "Value.h"

static JSValueRef nativeProfilerStart(
JSContextRef ctx,
@@ -20,7 +21,7 @@ static JSValueRef nativeProfilerStart(
return JSValueMakeUndefined(ctx);
}

JSStringRef title = JSValueToStringCopy(ctx, arguments[0], NULL);
JSStringRef title = JSValueToStringCopy(ctx, arguments[0], exception);
JSStartProfiling(ctx, title);
JSStringRelease(title);
return JSValueMakeUndefined(ctx);
@@ -38,8 +39,16 @@ static JSValueRef nativeProfilerEnd(
return JSValueMakeUndefined(ctx);
}

JSStringRef title = JSValueToStringCopy(ctx, arguments[0], NULL);
JSEndProfilingAndRender(ctx, title, "/sdcard/profile.json");
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);
}

0 comments on commit aaffb23

Please sign in to comment.
You can’t perform that action at this time.