[ReactNative] Add more markers and fix FPS graph

Summary:
@public

Add marker to show JavaScript download duration + flow arrows to show the origin
of the UI blocks being flushed.
Also fixed the condition on `RCTPerfStats`, UI and JS graphs were being created
at startup time, now they're just created on the first time they're shown.

Test Plan:
The markers:

{F22577660}

To check the FPS graph, enable it on the DevMenu, and it should appear initially
empty, instead of previously filled as before.
This commit is contained in:
Tadeu Zagallo 2015-06-17 14:03:50 -07:00
parent a48e9b4690
commit a885efe02d
3 changed files with 8 additions and 5 deletions

View File

@ -951,8 +951,10 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(__unused NSString *)module
});
} else {
RCTProfileBeginEvent();
RCTJavaScriptLoader *loader = [[RCTJavaScriptLoader alloc] initWithBridge:self];
[loader loadBundleAtURL:bundleURL onComplete:^(NSError *error, NSString *script) {
RCTProfileEndEvent(@"JavaScript dowload", @"init,download", @[]);
_loading = NO;
if (!self.isValid) {
@ -1119,12 +1121,11 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(__unused NSString *)module
{
RCTAssert(onComplete != nil, @"onComplete block passed in should be non-nil");
RCTProfileBeginEvent();
RCTProfileBeginFlowEvent();
[_javaScriptExecutor executeApplicationScript:script sourceURL:url onComplete:^(NSError *scriptLoadError) {
RCTProfileEndFlowEvent();
RCTAssertJSThread();
RCTProfileEndEvent(@"ApplicationScript", @"js_call,init", scriptLoadError);
if (scriptLoadError) {
onComplete(scriptLoadError);
return;

View File

@ -41,7 +41,7 @@ RCT_EXPORT_MODULE()
- (RCTFPSGraph *)jsGraph
{
if (!_jsGraph) {
if (!_jsGraph && _container) {
UIColor *jsColor = [UIColor colorWithRed:0 green:1 blue:0 alpha:1];
_jsGraph = [[RCTFPSGraph alloc] initWithFrame:CGRectMake(2, 2, 124, 34)
graphPosition:RCTFPSGraphPositionRight
@ -54,7 +54,7 @@ RCT_EXPORT_MODULE()
- (RCTFPSGraph *)uiGraph
{
if (!_uiGraph) {
if (!_uiGraph && _container) {
UIColor *uiColor = [UIColor colorWithRed:0 green:1 blue:1 alpha:1];
_uiGraph = [[RCTFPSGraph alloc] initWithFrame:CGRectMake(2, 2, 124, 34)
graphPosition:RCTFPSGraphPositionLeft

View File

@ -979,7 +979,9 @@ RCT_EXPORT_METHOD(findSubviewIn:(NSNumber *)reactTag atPoint:(CGPoint)point call
[_pendingUIBlocksLock unlock];
// Execute the previously queued UI blocks
RCTProfileBeginFlowEvent();
dispatch_async(dispatch_get_main_queue(), ^{
RCTProfileEndFlowEvent();
RCTProfileBeginEvent();
for (dispatch_block_t block in previousPendingUIBlocks) {
block();