Use actual CADisplayLink timestamp for VSYNC

Summary:
public

Use the actual timestamp provided through `CADisplayLink` instead of the time
the handler is called.

Reviewed By: jspahrsummers

Differential Revision: D2739121

fb-gh-sync-id: 1da28190bb25351dc3dd94efaff21d49279a570f
This commit is contained in:
Tadeu Zagallo 2015-12-09 09:53:00 -08:00 committed by facebook-github-bot-9
parent 86bb656e6f
commit cd4574498d
3 changed files with 5 additions and 4 deletions

View File

@ -943,7 +943,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
[self updateJSDisplayLinkState];
RCTProfileImmediateEvent(0, @"JS Thread Tick", 'g');
RCTProfileImmediateEvent(0, @"JS Thread Tick", displayLink.timestamp, 'g');
RCT_PROFILE_END_EVENT(0, @"objc_call", nil);
}

View File

@ -124,6 +124,7 @@ RCT_EXTERN void RCTProfileEndAsyncEvent(uint64_t tag,
*/
RCT_EXTERN void RCTProfileImmediateEvent(uint64_t tag,
NSString *name,
NSTimeInterval time,
char scope);
/**

View File

@ -275,9 +275,9 @@ void RCTProfileUnhookModules(RCTBridge *bridge)
@implementation RCTProfile
+ (void)vsync:(__unused CADisplayLink *)displayLink
+ (void)vsync:(CADisplayLink *)displayLink
{
RCTProfileImmediateEvent(0, @"VSYNC", 'g');
RCTProfileImmediateEvent(0, @"VSYNC", displayLink.timestamp, 'g');
}
@end
@ -513,6 +513,7 @@ void RCTProfileEndAsyncEvent(
void RCTProfileImmediateEvent(
uint64_t tag,
NSString *name,
NSTimeInterval time,
char scope
) {
CHECK();
@ -522,7 +523,6 @@ void RCTProfileImmediateEvent(
return;
}
NSTimeInterval time = CACurrentMediaTime();
NSString *threadName = RCTCurrentThreadName();
dispatch_async(RCTProfileGetQueue(), ^{