feat:add global anchor hook to monitor all performance hook

This commit is contained in:
pengfei.zhou
2021-07-20 10:50:24 +08:00
committed by osborn
parent ba3635769a
commit 17e14e7119
16 changed files with 303 additions and 12 deletions

View File

@@ -58,7 +58,11 @@ @implementation DoricJSEngine
- (instancetype)init {
if (self = [super init]) {
_initialized = NO;
_registry = [[DoricRegistry alloc] initWithJSEngine:self];
_profile = [[DoricPerformanceProfile alloc] initWithName:@"JSEngine"];
if (_registry.globalPerformanceAnchorHook) {
[_profile addAnchorHook:_registry.globalPerformanceAnchorHook];
}
[_profile prepare:@"Init"];
_jsThread = [[NSThread alloc] initWithTarget:self selector:@selector(threadRun) object:nil];
[_jsThread start];
@@ -95,7 +99,6 @@ - (instancetype)init {
@"localeLanguage": [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode] ?: @"",
@"localeCountry": [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] ?: @"",
}.mutableCopy;
self.registry = [[DoricRegistry alloc] initWithJSEngine:self];
[self ensureRunOnJSThread:^() {
[self.profile start:@"Init"];
self.timers = [[NSMutableDictionary alloc] init];