You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2018/11/15 07:58:41 UTC

[incubator-weex] branch master updated: [iOS] add performance debug (#1763)

This is an automated email from the ASF dual-hosted git repository.

cxfeng 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 69c795c  [iOS] add performance debug (#1763)
69c795c is described below

commit 69c795caa386a35283055cd6f1b60a7120c25db7
Author: jianhan-he <41...@users.noreply.github.com>
AuthorDate: Thu Nov 15 15:58:37 2018 +0800

    [iOS] add performance debug (#1763)
---
 ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m       |  2 ++
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m          | 10 ++++++++--
 ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h |  1 +
 ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m |  2 ++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
index 5920dd8..dd186de 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
@@ -412,6 +412,7 @@ _Pragma("clang diagnostic pop") \
         WXPerformBlockOnComponentThread(^{
             [WXCoreBridge createDataRenderInstance:instanceIdString template:jsBundleString options:options data:data];
             WX_MONITOR_INSTANCE_PERF_END(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
+            [sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_LOAD_BUNDLE_END];
         });
         return;
     }
@@ -584,6 +585,7 @@ _Pragma("clang diagnostic pop") \
         WXPerformBlockOnComponentThread(^{
             [WXCoreBridge createDataRenderInstance:instanceIdString contents:contents options:options data:data];
             WX_MONITOR_INSTANCE_PERF_END(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
+            [sdkInstance.apmInstance onStage:KEY_PAGE_STAGES_LOAD_BUNDLE_END];
         });
         return;
     }
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index 7c9529f..e0cc3b8 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -251,7 +251,10 @@ typedef enum : NSUInteger {
     _jsData = data;
     
     self.needValidate = [[WXHandlerFactory handlerForProtocol:@protocol(WXValidateProtocol)] needValidate:self.scriptURL];
-    
+    if (self.dataRender) {
+        [self.apmInstance setProperty:KEY_PAGE_PROPERTIES_RENDER_TYPE withValue:@"wxEagle"];
+    }
+
     if ([source isKindOfClass:[NSString class]]) {
         WXLogDebug(@"Render source: %@, data:%@", self, [WXUtility JSONString:data]);
         [self _renderWithMainBundleString:source];
@@ -283,6 +286,7 @@ typedef enum : NSUInteger {
     self.apmInstance.isStartRender = YES;
 
     self.performance.renderTimeOrigin = CACurrentMediaTime()*1000;
+    self.performance.renderUnixTimeOrigin = [WXUtility getUnixFixTimeMillis];
     [self.apmInstance onStage:KEY_PAGE_STAGES_RENDER_ORGIGIN];
 
     if (![WXUtility isBlankString:self.pageName]) {
@@ -488,7 +492,9 @@ typedef enum : NSUInteger {
         newOptions[bundleUrlOptionKey] = ((NSURL*)newOptions[bundleUrlOptionKey]).absoluteString;
     }
     _options = [newOptions copy];
-  
+    if (self.dataRender) {
+        [self.apmInstance setProperty:KEY_PAGE_PROPERTIES_RENDER_TYPE withValue:@"wxEagle"];
+    }
     request.userAgent = [WXUtility userAgent];
     
     WX_MONITOR_INSTANCE_PERF_START(WXPTJSDownload, self);
diff --git a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h
index e5fd690..68890a4 100644
--- a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h
+++ b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.h
@@ -37,6 +37,7 @@ extern NSString* const KEY_PAGE_PROPERTIES_BUNDLE_TYPE;
 extern NSString* const KEY_PAGE_PROPERTIES_CONTAINER_NAME;
 extern NSString* const KEY_PAGE_PROPERTIES_INSTANCE_TYPE;
 extern NSString* const KEY_PAGE_PROPERTIES_PARENT_PAGE;
+extern NSString* const KEY_PAGE_PROPERTIES_RENDER_TYPE;
 
 
 ///************** stages *****************/
diff --git a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
index 0bd74e3..04d6abf 100644
--- a/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Performance/WXApmForInstance.m
@@ -48,6 +48,8 @@ NSString* const KEY_PAGE_PROPERTIES_BUNDLE_TYPE = @"wxBundleType";
 NSString* const KEY_PAGE_PROPERTIES_CONTAINER_NAME = @"wxContainerName";
 NSString* const KEY_PAGE_PROPERTIES_INSTANCE_TYPE = @"wxInstanceType";
 NSString* const KEY_PAGE_PROPERTIES_PARENT_PAGE = @"wxParentPage";
+NSString* const KEY_PAGE_PROPERTIES_RENDER_TYPE = @"wxRenderType";
+
 
 
 ///************** stages *****************/