[ 
https://issues.apache.org/jira/browse/WEEX-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16574450#comment-16574450
 ] 

ASF GitHub Bot commented on WEEX-554:
-------------------------------------

YorkShen closed pull request #1413: [WEEX-554][Android] fix fsRender Time
URL: https://github.com/apache/incubator-weex/pull/1413
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java 
b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
index 54795ef48f..abfd1547dc 100644
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -580,7 +580,7 @@ private void renderInternal(String pageName,
     if (mRendered || TextUtils.isEmpty(template)) {
       return;
     }
-    
+
     
mApmForInstance.onStage(WXInstanceApm.KEY_PAGE_STAGES_RENDER_ORGIGIN,System.currentTimeMillis());
 
     mWXPerformance.pageName = (TextUtils.isEmpty(pageName) ? 
"defaultBundleUrl":pageName);
@@ -1334,27 +1334,37 @@ public void callActionAddElementTime(long time) {
       mWXPerformance.mActionAddElementSumTime += time;
   }
 
-  public void firstScreenRenderFinished() {
-      if (mEnd)
-          return;
-
+  public void onOldFsRenderTimeLogic(){
+      if (mEnd){
+        return;
+      }
       mEnd = true;
-
-      mApmForInstance.arriveFSRenderTime();
-
       if (mStatisticsListener != null && mContext != null) {
-          runOnUiThread(new Runnable() {
-              @Override
-              public void run() {
-                  if (mStatisticsListener != null && mContext != null) {
-                      Trace.beginSection("onFirstScreen");
-                      mStatisticsListener.onFirstScreen();
-                      Trace.endSection();
-                  }
-              }
-          });
+        runOnUiThread(new Runnable() {
+        @Override
+        public void run() {
+            if (mStatisticsListener != null && mContext != null) {
+              Trace.beginSection("onFirstScreen");
+              mStatisticsListener.onFirstScreen();
+              Trace.endSection();
+            }
+          }
+        });
       }
+      mApmForInstance.arriveFSRenderTime();
+      mWXPerformance.fsRenderTime = System.currentTimeMillis();
+      mWXPerformance.screenRenderTime = System.currentTimeMillis() - 
mRenderStartTime;
+      long[] fitstScreenPerformance = 
WXBridgeManager.getInstance().getFirstScreenRenderTime(getInstanceId());
+      WXLogUtils.renderPerformanceLog("firstScreenRenderFinished", 
mWXPerformance.screenRenderTime);
+      WXLogUtils.renderPerformanceLog("    firstScreenJSFExecuteTime", 
mWXPerformance.firstScreenJSFExecuteTime);
+      WXLogUtils.renderPerformanceLog("    firstScreenCallBridgeTime", 
fitstScreenPerformance[0]);
+      WXLogUtils.renderPerformanceLog("    firstScreenCssLayoutTime", 
fitstScreenPerformance[1]);
+      WXLogUtils.renderPerformanceLog("    firstScreenParseJsonTime", 
fitstScreenPerformance[2]);
+  }
+
+  public void firstScreenRenderFinished() {
 
+      mApmForInstance.arriveFSRenderTime();
       mWXPerformance.screenRenderTime = System.currentTimeMillis() - 
mRenderStartTime;
       if (!mHasSetCreateFinishFsTime) {
         mWXPerformance.fsRenderTime = System.currentTimeMillis();
@@ -1362,13 +1372,6 @@ public void run() {
           mHasSetCreateFinishFsTime = true;
       }
       mWXPerformance.newFsRenderTime = System.currentTimeMillis() - 
mRenderStartTime;
-      long[] fitstScreenPerformance = 
WXBridgeManager.getInstance().getFirstScreenRenderTime(getInstanceId());
-      WXLogUtils.renderPerformanceLog("firstScreenRenderFinished", 
mWXPerformance.screenRenderTime);
-      WXLogUtils.renderPerformanceLog("newFsRenderTime", 
mWXPerformance.newFsRenderTime);
-      WXLogUtils.renderPerformanceLog("    firstScreenJSFExecuteTime", 
mWXPerformance.firstScreenJSFExecuteTime);
-      WXLogUtils.renderPerformanceLog("    firstScreenCallBridgeTime", 
fitstScreenPerformance[0]);
-      WXLogUtils.renderPerformanceLog("    firstScreenCssLayoutTime", 
fitstScreenPerformance[1]);
-      WXLogUtils.renderPerformanceLog("    firstScreenParseJsonTime", 
fitstScreenPerformance[2]);
   }
 
   private void destroyView(View rootView) {
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java 
b/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
index 7971e0dc79..13db4f2b6c 100644
--- a/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
+++ b/android/sdk/src/main/java/com/taobao/weex/performance/WXInstanceApm.java
@@ -50,6 +50,7 @@
     public static final String KEY_PAGE_STAGES_LOAD_BUNDLE_START = 
"wxStartLoadBundle";
     public static final String KEY_PAGE_STAGES_LOAD_BUNDLE_END = 
"wxEndLoadBundle";
     public static final String KEY_PAGE_STAGES_FSRENDER = "wxFsRender";
+    public static final String KEY_PAGE_STAGES_NEW_FSRENDER = "wxNewFsRender";
     public static final String KEY_PAGE_STAGES_INTERACTION = "wxInteraction";
     public static final String KEY_PAGE_STAGES_DESTROY = "wxDestroy";
 
@@ -192,7 +193,11 @@ public void onEnd() {
     }
 
     public void arriveFSRenderTime() {
-        if (null == apmInstance || isFSEnd) {
+        if (null == apmInstance){
+            return;
+        }
+        onStage(WXInstanceApm.KEY_PAGE_STAGES_NEW_FSRENDER, 
System.currentTimeMillis());
+        if (isFSEnd) {
             return;
         }
         isFSEnd = true;
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateFinish.java
 
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateFinish.java
index a3b2620d0a..06491fe391 100644
--- 
a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateFinish.java
+++ 
b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionCreateFinish.java
@@ -69,5 +69,6 @@ public void executeAction() {
     if (null != instance.getWXPerformance()){
       instance.getWXPerformance().callCreateFinishTime = 
System.currentTimeMillis()-instance.getWXPerformance().renderTimeOrigin;
     }
+    instance.onOldFsRenderTimeLogic();
   }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> [Android] fix fsRender Time
> ---------------------------
>
>                 Key: WEEX-554
>                 URL: https://issues.apache.org/jira/browse/WEEX-554
>             Project: Weex
>          Issue Type: Bug
>          Components: Android
>            Reporter: peihan
>            Assignee: YorkShen
>            Priority: Blocker
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to