Fix profiler setup

Summary: @​public

Update packager entry and profiler pre-built dylib +
Update makefile to make it easier to use different versions of Xcode
and shortcircuit when using the wrong version.

Reviewed By: @jspahrsummers

Differential Revision: D2498157
This commit is contained in:
Tadeu Zagallo 2015-10-01 12:48:37 -07:00 committed by facebook-github-bot-3
parent 2c0da0f8b5
commit d447edc5ed
2 changed files with 16 additions and 14 deletions

View File

@ -1,6 +1,7 @@
HEADER_PATHS := `find download/JavaScriptCore -name '*.h' | xargs -I{} dirname {} | uniq | xargs -I{} echo "-I {}"`
SDK_PATH = /Applications/Xcode.app/Contents/Developer/Platforms/$1.platform/Developer/SDKs/$1.sdk
XCODE_PATH ?= $(shell xcode-select -p)
SDK_PATH = $(XCODE_PATH)/Platforms/$1.platform/Developer/SDKs/$1.sdk
SDK_VERSION = $(shell plutil -convert json -o - $(call SDK_PATH,iPhoneOS)/SDKSettings.plist | awk -f parseSDKVersion.awk)
@ -19,13 +20,14 @@ SYSROOT = -isysroot $(call SDK_PATH,$${PLATFORM})
IOS8_LIBS = download/WebCore/WebCore-7600.1.25 download/WTF/WTF-7600.1.24 download/JavaScriptCore/JavaScriptCore-7600.1.17 download/JavaScriptCore/JavaScriptCore-7600.1.17/Bytecodes.h
ios8: RCTJSCProfiler.ios8.dylib /tmp/RCTJSCProfiler
ifneq ($(SDK_VERSION), 8)
all:
$(error "Expected to be compiled with iOS SDK version 8, found $(SDK_VERSION)")
else
cp $^
endif
ios8: RCTJSCProfiler.ios8.dylib /tmp/RCTJSCProfiler
cp $^
/tmp/RCTJSCProfiler:
mkdir -p $@

View File

@ -233,14 +233,14 @@ function systraceProfileMiddleware(req, res, next) {
childProcess.exec(cmd, function(error) {
if (error) {
if (error.code === 127) {
res.end(
'\n** Failed executing `' + cmd + '` **\n\n' +
var response = '\n** Failed executing `' + cmd + '` **\n\n' +
'Google trace-viewer is required to visualize the data, You can install it with `brew install trace2html`\n\n' +
'NOTE: Your profile data was kept at:\n' + dumpName
);
console.log(response);
res.end(response);
} else {
console.error(error);
res.end('Unknown error %s', error.message);
res.end('Unknown error: ' + error.message);
}
return;
} else {
@ -267,16 +267,16 @@ function cpuProfileMiddleware(req, res, next) {
var dumpName = '/tmp/cpu-profile_' + Date.now();
fs.writeFileSync(dumpName + '.json', req.rawBody);
var cmd = path.join(__dirname, '..', 'JSCLegacyProfiler', 'json2trace') + ' -cpuprofiler ' + dumpName + '.cpuprofile ' + dumpName + '.json';
var cmd = path.join(__dirname, '..', 'react-native-github', 'JSCLegacyProfiler', 'json2trace') + ' -cpuprofiler ' + dumpName + '.cpuprofile ' + dumpName + '.json';
childProcess.exec(cmd, function(error) {
if (error) {
console.error(error);
res.end('Unknown error: %s', error.message);
res.end('Unknown error: ' + error.message);
} else {
res.end(
'Your profile was generated at\n\n' + dumpName + '.cpuprofile\n\n' +
'Open `Chrome Dev Tools > Profiles > Load` and select the profile to visualize it.'
);
var response = 'Your profile was generated at\n\n' + dumpName + '.cpuprofile\n\n' +
'Open `Chrome Dev Tools > Profiles > Load` and select the profile to visualize it.';
console.log(response);
res.end(response);
}
});
}