You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by lu...@apache.org on 2019/08/01 08:38:42 UTC
[incubator-weex] branch master updated: [iOS] add fake performance
detail data for server test (#2775)
This is an automated email from the ASF dual-hosted git repository.
luckychen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
The following commit(s) were added to refs/heads/master by this push:
new cf31bc0 [iOS] add fake performance detail data for server test (#2775)
cf31bc0 is described below
commit cf31bc0bbfc72b4f7bdb39ec3969cf7c78c85145
Author: jianhan-he <41...@users.noreply.github.com>
AuthorDate: Thu Aug 1 16:38:37 2019 +0800
[iOS] add fake performance detail data for server test (#2775)
---
ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m | 6 +++---
ios/sdk/WeexSDK/Sources/Model/WXComponent.mm | 3 +++
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h | 7 +++++--
ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m | 12 ++++++++++--
ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h | 3 +++
ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m | 3 +++
weex_core/Source/base/log_defines.h | 2 +-
7 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
index e351ef0..cca0d10 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
@@ -1104,10 +1104,10 @@ _Pragma("clang diagnostic pop") \
} else {
[self callJSMethod:@"callJS" args:@[execIns, [tasks copy]]];
}
- if (execInstance && !(execInstance.isJSCreateFinish)) {
+ if (execInstance) {
NSTimeInterval diff = CACurrentMediaTime()*1000 - start;
- execInstance.performance.fsCallJsNum++;
- execInstance.performance.fsCallJsTime = execInstance.performance.fsCallJsTime+ diff;
+ execInstance.performance.callJsNum++;
+ execInstance.performance.callJsTime = execInstance.performance.callJsTime+ diff;
}
if (execInstance && !execInstance.apmInstance.isFSEnd) {
NSTimeInterval diff = CACurrentMediaTime()*1000 - start;
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
index 3a6da5e..4a80adf 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm
@@ -359,6 +359,7 @@ static BOOL bNeedRemoveEvents = YES;
return _view;
} else {
WXAssertMainThread();
+ double startCreateViewTime = CACurrentMediaTime()*1000;
// compositing child will be drew by its composited ancestor
if (_isCompositingChild) {
@@ -446,6 +447,8 @@ static BOOL bNeedRemoveEvents = YES;
[self _buildViewHierarchyLazily];
}
+ double diffTime = CACurrentMediaTime()*1000 - startCreateViewTime;
+ [self.weexInstance.performance recordViewCreatePerformance:diffTime];
[self _handleFirstScreenTime];
[self.weexInstance.performance onViewLoad:self];
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h
index c9fca16..d4604bf 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h
@@ -30,9 +30,9 @@
@property (nonatomic, assign) double jsCreateFinishTime;
//firsrScreen call jsMethod totalTime
-@property (nonatomic, assign) double fsCallJsTime;
+@property (nonatomic, assign) double callJsTime;
//firsrScreen call jsMethod totalNum
-@property (nonatomic, assign) double fsCallJsNum;
+@property (nonatomic, assign) double callJsNum;
//firsrScreen call nativeMethod totalTime
@property (nonatomic, assign) double fsCallNativeTime;
//firsrScreen call nativeMethod totalNum
@@ -61,12 +61,15 @@
//all componentCreate time in instance life
@property (nonatomic,assign) double componentCreateTime;
+@property (nonatomic,assign) double viewCreateTime;
+
@property (nonatomic,assign) double newFsRenderTime;
@property (nonatomic,assign) long lastRealInteractionTime;
//for performance record
- (void)onViewLoad:(WXComponent *)targetComponent;
- (void)recordComponentCreatePerformance:(double) diffTime forComponent:(WXComponent *)targetComponent;
+- (void)recordViewCreatePerformance:(double) diffTime;
- (void)onInstanceRenderSuccess:(WXSDKInstance*) instance;
@end
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
index a5ebcf2..c57b918 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
@@ -42,6 +42,10 @@
self.componentCreateTime+=diffTime;
}
+- (void)recordViewCreatePerformance:(double) diffTime {
+ self.viewCreateTime += diffTime;
+}
+
/** on UI thread **/
- (void)onViewLoad:(WXComponent *)targetComponent
{
@@ -124,6 +128,10 @@
self.interactionAddCount = self.interactionAddCountRecord;
[targetComponent.weexInstance.apmInstance updateMaxStats:KEY_PAGE_STATS_I_SCREEN_VIEW_COUNT curMaxValue:self.interactionLimitAddOpCount];
[targetComponent.weexInstance.apmInstance updateMaxStats:KEY_PAGE_STATS_I_ALL_VIEW_COUNT curMaxValue:self.interactionAddCount];
+ [targetComponent.weexInstance.apmInstance updateMaxStats:KEY_PAGE_STATS_EXECUTE_JS_TIME curMaxValue:self.callJsTime];
+ [targetComponent.weexInstance.apmInstance updateMaxStats:KEY_PAGE_STATS_CREATE_COMPONENT_TIME curMaxValue:self.componentCreateTime];
+ [targetComponent.weexInstance.apmInstance updateMaxStats:KEY_PAGE_STATS_CREATE_VIEW_TIME curMaxValue:self.viewCreateTime];
+
self.interactionTime = self.interactionTime < diff ? diff :self.interactionTime;
}
@@ -186,8 +194,8 @@
[WXMonitor performanceFinishWithState:DebugAfterFSFinish instance:self];
self.performance.jsCreateFinishTime = CACurrentMediaTime()*1000;
self.isJSCreateFinish = TRUE;
- WX_MONITOR_PERF_SET(WXPTFsCallJsNum, self.performance.fsCallJsNum, self);
- WX_MONITOR_PERF_SET(WXPTFsCallJsTime, self.performance.fsCallJsTime, self);
+ WX_MONITOR_PERF_SET(WXPTFsCallJsNum, self.performance.callJsNum, self);
+ WX_MONITOR_PERF_SET(WXPTFsCallJsTime, self.performance.callJsTime, self);
WX_MONITOR_PERF_SET(WXPTFsCallNativeNum, self.performance.fsCallNativeNum, self);
WX_MONITOR_PERF_SET(WXPTFsCallNativeTime, self.performance.fsCallNativeTime, self);
WX_MONITOR_PERF_SET(WXPTFsReqNetNum, self.performance.fsReqNetNum, self);
diff --git a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h
index e0e07f6..c583916 100644
--- a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h
+++ b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h
@@ -63,6 +63,9 @@ extern NSString* const KEY_PAGE_STAGES_DESTROY;
extern NSString* const KEY_PAGE_STATS_BUNDLE_SIZE;
extern NSString* const KEY_PAGE_STATS_FS_CALL_JS_TIME;
extern NSString* const KEY_PAGE_STATS_FS_CALL_JS_NUM;
+extern NSString* const KEY_PAGE_STATS_EXECUTE_JS_TIME;
+extern NSString* const KEY_PAGE_STATS_CREATE_COMPONENT_TIME;
+extern NSString* const KEY_PAGE_STATS_CREATE_VIEW_TIME;
extern NSString* const KEY_PAGE_STATS_FS_TIMER_NUM;
extern NSString* const KEY_PAGE_STATS_FS_CALL_NATIVE_TIME;
extern NSString* const KEY_PAGE_STATS_FS_CALL_NATIVE_NUM;
diff --git a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
index 2ab2cb4..c9865f7 100644
--- a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
@@ -76,6 +76,9 @@ NSString* const KEY_PAGE_STAGES_DESTROY = @"wxDestroy";
NSString* const KEY_PAGE_STATS_BUNDLE_SIZE = @"wxBundleSize";
NSString* const KEY_PAGE_STATS_FS_CALL_JS_TIME = @"wxFSCallJsTotalTime";
NSString* const KEY_PAGE_STATS_FS_CALL_JS_NUM = @"wxFSCallJsTotalNum";
+NSString* const KEY_PAGE_STATS_EXECUTE_JS_TIME = @"wxExecJsCallBack";
+NSString* const KEY_PAGE_STATS_CREATE_COMPONENT_TIME = @"wxComponentCost";
+NSString* const KEY_PAGE_STATS_CREATE_VIEW_TIME = @"wxViewCost";
NSString* const KEY_PAGE_STATS_FS_TIMER_NUM = @"wxFSTimerCount";
NSString* const KEY_PAGE_STATS_FS_CALL_NATIVE_TIME = @"wxFSCallNativeTotalTime";
NSString* const KEY_PAGE_STATS_FS_CALL_NATIVE_NUM = @"wxFSCallNativeTotalNum";
diff --git a/weex_core/Source/base/log_defines.h b/weex_core/Source/base/log_defines.h
index 0bf840c..6f0028b 100644
--- a/weex_core/Source/base/log_defines.h
+++ b/weex_core/Source/base/log_defines.h
@@ -226,7 +226,7 @@ class LogImplement {
#else
#define LOGD_TAG(TAG, format, ...) ((void) 0)
-#define LOGD(format, ...) if(weex::base::LogImplement::getLog()->debugMode()) WEEX_CORE_LOG(WeexCore::LogLevel::Debug, TAG, format, ##__VA_ARGS__)
+#define LOGD(format, ...) ((void) 0)
#endif