Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

[iOS] add execute jsbundle time point #2628

Merged
merged 1 commit into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,6 @@ - (void)createInstance:(NSString *)instanceIdString
[self.sendQueue setValue:sendQueue forKey:instanceIdString];

if (sdkInstance.dataRender && ![options[@"EXEC_JS"] boolValue]) {
WX_MONITOR_INSTANCE_PERF_START(WXFirstScreenJSFExecuteTime, [WXSDKManager instanceForID:instanceIdString]);
WX_MONITOR_INSTANCE_PERF_START(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
if (_dataRenderHandler) {
WXPerformBlockOnComponentThread(^{
[_dataRenderHandler createPage:instanceIdString template:jsBundleString options:options data:data];
Expand All @@ -444,8 +442,6 @@ - (void)createInstance:(NSString *)instanceIdString
});
}
}
WX_MONITOR_INSTANCE_PERF_END(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
[sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_LOAD_BUNDLE_END];
return;
}

Expand Down Expand Up @@ -476,14 +472,15 @@ - (void)createInstance:(NSString *)instanceIdString
}
if ([WXDebugTool isDevToolDebug]) {
[self callJSMethod:@"createInstanceContext" args:@[instanceIdString, newOptions, data?:@[],raxAPIScript?:@""]];
[sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_LOAD_BUNDLE_END];

if ([NSURL URLWithString:sdkInstance.pageName]) {
[sdkInstance.instanceJavaScriptContext executeJavascript:jsBundleString withSourceURL:[NSURL URLWithString:sdkInstance.pageName]];
} else {
[sdkInstance.instanceJavaScriptContext executeJavascript:jsBundleString];
}
WX_MONITOR_INSTANCE_PERF_END(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
[sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_LOAD_BUNDLE_END];
[sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_EXECUTE_BUNDLE_END];
} else {
sdkInstance.callCreateInstanceContext = [NSString stringWithFormat:@"instanceId:%@\noptions:%@\ndata:%@", instanceIdString, newOptions, data];
//add instanceId to weexContext ,if fucn createInstanceContext failure ,then we will know which instance has problem (exceptionhandler)
Expand Down Expand Up @@ -547,6 +544,7 @@ - (void)createInstance:(NSString *)instanceIdString
[sdkInstance.instanceJavaScriptContext executeJavascript:jsBundleString];
}
sdkInstance.instanceJavaScriptContext.javaScriptContext[@"wxExtFuncInfo"] = nil;
[sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_EXECUTE_BUNDLE_END];
WX_MONITOR_INSTANCE_PERF_END(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
}];
}
Expand All @@ -567,7 +565,7 @@ - (void)createInstance:(NSString *)instanceIdString
sdkInstance.instanceJavaScriptContext.javaScriptContext[@"wxExtFuncInfo"] = funcInfo;
[self callJSMethod:@"createInstance" args:args];
sdkInstance.instanceJavaScriptContext.javaScriptContext[@"wxExtFuncInfo"] = nil;

[sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_EXECUTE_BUNDLE_END];
WX_MONITOR_INSTANCE_PERF_END(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
}
}
Expand Down Expand Up @@ -607,8 +605,6 @@ - (void)createInstance:(NSString *)instanceIdString
[self.sendQueue setValue:sendQueue forKey:instanceIdString];

if (sdkInstance.dataRender) {
WX_MONITOR_INSTANCE_PERF_START(WXFirstScreenJSFExecuteTime, [WXSDKManager instanceForID:instanceIdString]);
WX_MONITOR_INSTANCE_PERF_START(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
if (_dataRenderHandler) {
WXPerformBlockOnComponentThread(^{
[_dataRenderHandler createPage:instanceIdString contents:contents options:options data:data];
Expand All @@ -624,8 +620,6 @@ - (void)createInstance:(NSString *)instanceIdString
});
}
}
WX_MONITOR_INSTANCE_PERF_END(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
[sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_LOAD_BUNDLE_END];
return;
}
}
Expand Down
1 change: 1 addition & 0 deletions ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ - (void)_renderWithRequest:(WXResourceRequest *)request options:(NSDictionary *)
}

if (([newOptions[@"DATA_RENDER"] boolValue] && [newOptions[@"RENDER_WITH_BINARY"] boolValue]) || [newOptions[@"WLASM_RENDER"] boolValue]) {
[strongSelf.apmInstance onStage:KEY_PAGE_STAGES_DOWN_BUNDLE_END];
[strongSelf _renderWithData:data];
return;
}
Expand Down
3 changes: 3 additions & 0 deletions ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ extern NSString* const KEY_PAGE_STAGES_CUSTOM_PREPROCESS_END;
extern NSString* const KEY_PAGE_STAGES_RENDER_ORGIGIN;
extern NSString* const KEY_PAGE_STAGES_LOAD_BUNDLE_START;
extern NSString* const KEY_PAGE_STAGES_LOAD_BUNDLE_END;
extern NSString* const KEY_PAGE_STAGES_EXECUTE_BUNDLE_END;
extern NSString* const KEY_PAGE_STAGES_EXECUTE_JSON_START;
extern NSString* const KEY_PAGE_STAGES_EXECUTE_JSON_END;
extern NSString* const KEY_PAGE_STAGES_CREATE_FINISH;
extern NSString* const KEY_PAGE_STAGES_FSRENDER;
extern NSString* const KEY_PAGE_STAGES_NEW_FSRENDER;
Expand Down
3 changes: 3 additions & 0 deletions ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
NSString* const KEY_PAGE_STAGES_RENDER_ORGIGIN = @"wxRenderTimeOrigin";
NSString* const KEY_PAGE_STAGES_LOAD_BUNDLE_START = @"wxStartLoadBundle";
NSString* const KEY_PAGE_STAGES_LOAD_BUNDLE_END = @"wxEndLoadBundle";
NSString* const KEY_PAGE_STAGES_EXECUTE_BUNDLE_END = @"wxEndExecuteBundle";
NSString* const KEY_PAGE_STAGES_EXECUTE_JSON_START = @"wxStartExecuteJson";
NSString* const KEY_PAGE_STAGES_EXECUTE_JSON_END = @"wxEndExecuteJson";
NSString* const KEY_PAGE_STAGES_CREATE_FINISH = @"wxJSBundleCreateFinish";
NSString* const KEY_PAGE_STAGES_FSRENDER = @"wxFsRender";
NSString* const KEY_PAGE_STAGES_NEW_FSRENDER = @"wxNewFsRender";
Expand Down