Skip to content

Commit

Permalink
Introduce Perf Monitor
Browse files Browse the repository at this point in the history
Summary: public

Kill `RCTPerfStats` and introduce the new `RCTPerfMonitor`, including memory
usage, JSC heap size, number of RN views in screen, FPS (both on UI and JS threads)
and more to come.

It removes all the previous traces that were previous spread across the bridge
and the dev menu and moves everything to be more contained, so the whole thing
can be safely striped in production.

Reviewed By: nicklockwood

Differential Revision: D2575158

fb-gh-sync-id: 6a6d0c4422adbddeeefddd32ec3409a7095ff2a9
  • Loading branch information
tadeuzagallo authored and facebook-github-bot-7 committed Oct 23, 2015
1 parent cae4761 commit 9069bdf
Show file tree
Hide file tree
Showing 9 changed files with 595 additions and 371 deletions.
25 changes: 0 additions & 25 deletions React/Base/RCTBatchedBridge.m
Expand Up @@ -20,7 +20,6 @@
#import "RCTModuleMap.h"
#import "RCTBridgeMethod.h"
#import "RCTPerformanceLogger.h"
#import "RCTPerfStats.h"
#import "RCTProfile.h"
#import "RCTRedBox.h"
#import "RCTSourceCode.h"
Expand Down Expand Up @@ -68,7 +67,6 @@ @implementation RCTBatchedBridge
NSMutableArray *_pendingCalls;
NSMutableArray *_moduleDataByID;
RCTModuleMap *_modulesByName;
CADisplayLink *_mainDisplayLink;
CADisplayLink *_jsDisplayLink;
NSMutableSet *_frameUpdateObservers;
}
Expand All @@ -94,11 +92,6 @@ - (instancetype)initWithParentBridge:(RCTBridge *)bridge
_frameUpdateObservers = [NSMutableSet new];
_jsDisplayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_jsThreadUpdate:)];

if (RCT_DEV) {
_mainDisplayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(_mainThreadUpdate:)];
[_mainDisplayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
}

[RCTBridge setCurrentBridge:self];

[[NSNotificationCenter defaultCenter] postNotificationName:RCTJavaScriptWillStartLoadingNotification
Expand Down Expand Up @@ -508,9 +501,6 @@ - (void)invalidate
[RCTBridge setCurrentBridge:nil];
}

[_mainDisplayLink invalidate];
_mainDisplayLink = nil;

// Invalidate modules
dispatch_group_t group = dispatch_group_create();
for (RCTModuleData *moduleData in _moduleDataByID) {
Expand Down Expand Up @@ -868,21 +858,6 @@ - (void)_jsThreadUpdate:(CADisplayLink *)displayLink
RCTProfileImmediateEvent(0, @"JS Thread Tick", 'g');

RCTProfileEndEvent(0, @"objc_call", nil);

RCT_IF_DEV(
dispatch_async(dispatch_get_main_queue(), ^{
[self.perfStats.jsGraph onTick:displayLink.timestamp];
});
)
}

- (void)_mainThreadUpdate:(CADisplayLink *)displayLink
{
RCTAssertMainThread();

RCTProfileImmediateEvent(0, @"VSYNC", 'g');

_modulesByName == nil ?: [self.perfStats.uiGraph onTick:displayLink.timestamp];
}

- (void)startProfiling
Expand Down
138 changes: 0 additions & 138 deletions React/Base/RCTFPSGraph.m

This file was deleted.

27 changes: 0 additions & 27 deletions React/Base/RCTPerfStats.h

This file was deleted.

147 changes: 0 additions & 147 deletions React/Base/RCTPerfStats.m

This file was deleted.

0 comments on commit 9069bdf

Please sign in to comment.