Skip to content

Commit

Permalink
Ignore iOS prewarming (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
oblador authored Aug 24, 2023
1 parent 75b9a8c commit 6af0029
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
13 changes: 11 additions & 2 deletions examples/vanilla/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -934,12 +934,21 @@ PODS:
- react-native-flipper (0.182.0):
- React-Core
- react-native-performance (4.0.0):
- RCT-Folly
- hermes-engine
- RCT-Folly (= 2021.07.22.00)
- RCTRequired
- RCTTypeSafety
- React-Codegen
- React-Core
- React-debug
- React-Fabric
- React-graphics
- React-NativeModulesApple
- React-RCTFabric
- React-utils
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- React-NativeModulesApple (0.72.1):
- hermes-engine
- React-callinvoker
Expand Down Expand Up @@ -1287,7 +1296,7 @@ SPEC CHECKSUMS:
React-jsinspector: d0b5bfd1085599265f4212034321e829bdf83cc0
React-logger: b8103c9b04e707b50cdd2b1aeb382483900cbb37
react-native-flipper: 6e4e344a0104a34a4e189a9ef2b3b5634b516dc8
react-native-performance: 426cc34043381602a59f059755a04452315effb4
react-native-performance: 8d52c16b63aa3728464aa10a1e75dff23412ea2e
React-NativeModulesApple: 4f31a812364443cee6ef768d256c594ad3b20f53
React-perflogger: 3d501f34c8d4b10cb75f348e43591765788525ad
React-RCTActionSheet: f5335572c979198c0c3daff67b07bd1ad8370c1d
Expand Down
19 changes: 3 additions & 16 deletions packages/react-native-performance/ios/RNPerformanceManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@
#import <RNPerformanceSpec/RNPerformanceSpec.h>
#endif

static CFTimeInterval RNPerformanceGetProcessStartTime()
{
size_t len = 4;
int mib[len];
struct kinfo_proc kp;

sysctlnametomib("kern.proc.pid", mib, &len);
mib[3] = getpid();
len = sizeof(kp);
sysctl(mib, 4, &kp, &len, NULL, 0);

struct timeval startTime = kp.kp_proc.p_un.__p_starttime;
return startTime.tv_sec + startTime.tv_usec / 1e6;
}

static int64_t sNativeLaunchStart;
static int64_t sNativeLaunchEnd;

Expand All @@ -38,8 +23,10 @@ @implementation RNPerformanceManager
+ (void) initialize
{
[super initialize];
sNativeLaunchStart = (RNPerformanceGetProcessStartTime() - [NSDate date].timeIntervalSince1970) * 1000 + RNPerformanceGetTimestamp();
struct timespec tp;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tp);
sNativeLaunchEnd = RNPerformanceGetTimestamp();
sNativeLaunchStart = sNativeLaunchEnd - (tp.tv_sec * 1e3 + tp.tv_nsec / 1e6);
}

- (void)setBridge:(RCTBridge *)bridge
Expand Down

0 comments on commit 6af0029

Please sign in to comment.