You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2018/05/10 11:46:24 UTC

incubator-weex git commit: * [iOS] add componentTime/Count monitor

Repository: incubator-weex
Updated Branches:
  refs/heads/master c7880b346 -> 35f3e703f


* [iOS] add componentTime/Count monitor

* [iOS] modify point

* [iOS] rm useless code


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/35f3e703
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/35f3e703
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/35f3e703

Branch: refs/heads/master
Commit: 35f3e703f39da229b47f89417dd31ce5097d66fb
Parents: c7880b3
Author: zhongcang <qh...@gmail.com>
Authored: Mon May 7 11:20:01 2018 +0800
Committer: zhongcang <qh...@gmail.com>
Committed: Thu May 10 18:26:23 2018 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm     | 10 ++++++++++
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h |  8 ++++++++
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m |  4 ++++
 ios/sdk/WeexSDK/Sources/Monitor/WXAnalyzerCenter.m        |  7 +++++--
 ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.h               |  4 ++++
 ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m               |  7 +++++--
 ios/sdk/WeexSDK/Sources/Protocol/WXAppMonitorProtocol.h   |  3 +++
 7 files changed, 39 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/35f3e703/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
index c8c6e3f..a955445 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXComponentManager.mm
@@ -548,6 +548,7 @@ static css_node_t * rootNodeGetChild(void *context, int i)
 
 - (WXComponent *)_buildComponentForData:(NSDictionary *)data supercomponent:(WXComponent *)supercomponent
 {
+    double buildSartTime = CACurrentMediaTime()*1000;
     NSString *ref = data[@"ref"];
     NSString *type = data[@"type"];
     NSDictionary *styles = data[@"style"];
@@ -592,6 +593,15 @@ static css_node_t * rootNodeGetChild(void *context, int i)
     
     [_indexDict setObject:component forKey:component.ref];
     [component readyToRender];// notify redyToRender event when init
+    
+    double diffTime = CACurrentMediaTime()*1000 - buildSartTime;
+    if (!(self.weexInstance.isJSCreateFinish)) {
+        self.weexInstance.performance.fsComponentCount++;
+        self.weexInstance.performance.fsComponentCreateTime+=diffTime;
+    }
+    self.weexInstance.performance.componentCount++;
+    self.weexInstance.performance.componentCreateTime+=diffTime;
+    
     return component;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/35f3e703/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h
index 03f1b99..b731797 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.h
@@ -48,6 +48,14 @@
 //time of user could interace : firsrScreen view or async load veiew(net lazyload) are show)
 @property (nonatomic, assign) double interactionTime;
 
+//in firsrScreen ,create component count
+@property (nonatomic,assign) double fsComponentCount;
+//in firsrScreen ,create component time
+@property (nonatomic,assign) double fsComponentCreateTime;
+//all componentCreate count in instance life
+@property (nonatomic,assign) double componentCount;
+//all componentCreate time in instance life
+@property (nonatomic,assign) double componentCreateTime;
 @end
 
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/35f3e703/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
index 6759fc7..0af52d1 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance_performance.m
@@ -38,6 +38,8 @@
     WX_MONITOR_PERF_SET(WXPTFsCallNativeTime, self.performance.fsCallNativeTime, self);
     WX_MONITOR_PERF_SET(WXPTFsReqNetNum, self.performance.fsReqNetNum, self);
     WX_MONITOR_PERF_SET(WXPTTimerNum, self.performance.timerNum, self);
+    WX_MONITOR_PERF_SET(WXPTFsComponentCount,self.performance.fsComponentCount,self);
+    WX_MONITOR_PERF_SET(WXPTFsComponentCreateTime,self.performance.fsComponentCreateTime,self);
 }
 
 
@@ -47,6 +49,8 @@
     WX_MONITOR_PERF_SET(WXPTMaxDeepVDom,self.performance.maxVdomDeep,self);
     WX_MONITOR_PERF_SET(WXPTImgWrongSizeNum,self.performance.imgWrongSizeNum,self);
     WX_MONITOR_PERF_SET(WXPTInteractionTime,self.performance.interactionTime,self);
+    WX_MONITOR_PERF_SET(WXPTComponentCount,self.performance.componentCount,self);
+    WX_MONITOR_PERF_SET(WXPTComponentCreateTime,self.performance.componentCreateTime,self);
 }
 
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/35f3e703/ios/sdk/WeexSDK/Sources/Monitor/WXAnalyzerCenter.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Monitor/WXAnalyzerCenter.m b/ios/sdk/WeexSDK/Sources/Monitor/WXAnalyzerCenter.m
index 1a84b71..643b620 100644
--- a/ios/sdk/WeexSDK/Sources/Monitor/WXAnalyzerCenter.m
+++ b/ios/sdk/WeexSDK/Sources/Monitor/WXAnalyzerCenter.m
@@ -122,7 +122,6 @@
                              CALLCREATEINSTANCETIME:        [NSNumber numberWithInt:DebugAfterFSFinish],
                              COMMUNICATETOTALTIME:          [NSNumber numberWithInt:DebugAfterExist],
                              FSRENDERTIME:                  [NSNumber numberWithInt:DebugAfterExist],
-                             COMPONENTCOUNT:                [NSNumber numberWithInt:DebugAfterExist],
                              CACHEPROCESSTIME:              [NSNumber numberWithInt:DebugAfterRequest],
                              CACHERATIO:                    [NSNumber numberWithInt:DebugAfterRequest],
                              M_FS_CALL_JS_TIME:             [NSNumber numberWithInt:DebugAfterFSFinish],
@@ -134,7 +133,11 @@
                              M_MAX_DEEP_VDOM:               [NSNumber numberWithInt:DebugAfterExist],
                              M_IMG_WRONG_SIZE_NUM:          [NSNumber numberWithInt:DebugAfterExist],
                              M_TIMER_NUM:                   [NSNumber numberWithInt:DebugAfterFSFinish],
-                             M_INTERACTION_TIME:            [NSNumber numberWithInt:DebugAfterExist]
+                             M_INTERACTION_TIME:            [NSNumber numberWithInt:DebugAfterExist],
+                             M_COMPONENT_FS_TIME:           @(DebugAfterFSFinish),
+                             M_COMPONENT_FS_COUNT:          @(DebugAfterFSFinish),
+                             COMPONENTCOUNT:                @(DebugAfterExist),
+                             M_COMPONENT_TIME:              @(DebugAfterExist)
                              };
         
     });

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/35f3e703/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.h b/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.h
index c5b27d8..cfc8b46 100644
--- a/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.h
+++ b/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.h
@@ -49,6 +49,10 @@ typedef enum : NSUInteger {
     WXPTTimerNum,
     WXPTInteractionTime,
     WXPTWrongImgSize,
+    WXPTFsComponentCount,
+    WXPTFsComponentCreateTime,
+    WXPTComponentCount,
+    WXPTComponentCreateTime,
     //end
     WXPTEnd
 } WXPerformanceTag;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/35f3e703/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m b/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m
index 0e8be8f..27a53b8 100644
--- a/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m
+++ b/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m
@@ -147,7 +147,6 @@ static WXThreadSafeMutableDictionary *globalPerformanceDict;
         }
     }
     WXPerformBlockOnComponentThread(^{
-        commitDict[COMPONENTCOUNT] = @([instance numberOfComponents]);
         WXPerformBlockOnMainThread(^{
             [self commitPerformanceWithDict:commitDict instance:instance comitState:state];
         });
@@ -181,7 +180,11 @@ static WXThreadSafeMutableDictionary *globalPerformanceDict;
                           @(WXPTCellExceedNum):M_CELL_EXCEED_NUM,
                           @(WXPTWrongImgSize):M_IMG_WRONG_SIZE_NUM,
                           @(WXPTInteractionTime):M_INTERACTION_TIME,
-                          @(WXPTFsReqNetNum):M_FS_REQUEST_NET_NUM
+                          @(WXPTFsReqNetNum):M_FS_REQUEST_NET_NUM,
+                          @(WXPTFsComponentCreateTime):M_COMPONENT_FS_TIME,
+                          @(WXPTFsComponentCount):M_COMPONENT_FS_COUNT,
+                          @(WXPTComponentCreateTime):M_COMPONENT_TIME,
+                          @(WXPTComponentCount):COMPONENTCOUNT
                           };
     });
     

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/35f3e703/ios/sdk/WeexSDK/Sources/Protocol/WXAppMonitorProtocol.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Protocol/WXAppMonitorProtocol.h b/ios/sdk/WeexSDK/Sources/Protocol/WXAppMonitorProtocol.h
index 65a86a2..56d901a 100644
--- a/ios/sdk/WeexSDK/Sources/Protocol/WXAppMonitorProtocol.h
+++ b/ios/sdk/WeexSDK/Sources/Protocol/WXAppMonitorProtocol.h
@@ -47,6 +47,7 @@
 #define COMMUNICATETOTALTIME    @"communicateTotalTime"
 #define FSRENDERTIME    @"fsRenderTime"
 #define COMPONENTCOUNT      @"componentCount"
+#define M_COMPONENT_TIME    @"componentCreateTime"
 
 #define CACHEPROCESSTIME    @"cacheProcessTime"
 #define CACHERATIO          @"cacheRatio"
@@ -64,6 +65,8 @@
 #define M_TIMER_NUM             @"timerCount"
 #define M_WRONG_IMG_NUM         @"imgSizeCount"
 #define M_INTERACTION_TIME      @"interactionTime"
+#define M_COMPONENT_FS_COUNT    @"fsComponentCount"
+#define M_COMPONENT_FS_TIME     @"fsComponentCreateTime"