Search in sources :

Example 1 with WXPerformance

use of com.taobao.weex.common.WXPerformance in project weex-example by KalicyZhou.

the class WXBridgeManager method commitJSFrameworkAlarmMonitor.

public void commitJSFrameworkAlarmMonitor(final String type, final WXErrorCode errorCode, String errMsg) {
    final IWXUserTrackAdapter userTrackAdapter = WXSDKManager.getInstance().getIWXUserTrackAdapter();
    if (userTrackAdapter == null || TextUtils.isEmpty(type) || errorCode == null) {
        return;
    }
    WXPerformance performance = new WXPerformance();
    performance.errCode = errorCode.getErrorCode();
    if (errorCode != WXErrorCode.WX_SUCCESS) {
        performance.appendErrMsg(TextUtils.isEmpty(errMsg) ? errorCode.getErrorMsg() : errMsg);
        WXLogUtils.e("wx_monitor", performance.toString());
    }
    userTrackAdapter.commit(WXEnvironment.getApplication(), null, type, performance, null);
}
Also used : WXPerformance(com.taobao.weex.common.WXPerformance) IWXUserTrackAdapter(com.taobao.weex.adapter.IWXUserTrackAdapter)

Example 2 with WXPerformance

use of com.taobao.weex.common.WXPerformance in project weex-example by KalicyZhou.

the class WXSDKInstance method onRenderSuccess.

public void onRenderSuccess(final int width, final int height) {
    firstScreenRenderFinished();
    long time = System.currentTimeMillis() - mRenderStartTime;
    WXLogUtils.renderPerformanceLog("onRenderSuccess", time);
    WXLogUtils.renderPerformanceLog("   invokeCreateInstance", mWXPerformance.communicateTime);
    WXLogUtils.renderPerformanceLog("   TotalCallNativeTime", mWXPerformance.callNativeTime);
    WXLogUtils.renderPerformanceLog("       TotalJsonParseTime", mWXPerformance.parseJsonTime);
    WXLogUtils.renderPerformanceLog("   TotalBatchTime", mWXPerformance.batchTime);
    WXLogUtils.renderPerformanceLog("       TotalCssLayoutTime", mWXPerformance.cssLayoutTime);
    WXLogUtils.renderPerformanceLog("       TotalApplyUpdateTime", mWXPerformance.applyUpdateTime);
    WXLogUtils.renderPerformanceLog("       TotalUpdateDomObjTime", mWXPerformance.updateDomObjTime);
    mWXPerformance.totalTime = time;
    if (mWXPerformance.screenRenderTime < 0.001) {
        mWXPerformance.screenRenderTime = time;
    }
    mWXPerformance.componentCount = WXComponent.mComponentNum;
    if (WXEnvironment.isApkDebugable()) {
        WXLogUtils.d(WXLogUtils.WEEX_PERF_TAG, "mComponentNum:" + WXComponent.mComponentNum);
    }
    WXComponent.mComponentNum = 0;
    if (mRenderListener != null && mContext != null) {
        runOnUiThread(new Runnable() {

            @Override
            public void run() {
                if (mRenderListener != null && mContext != null) {
                    mRenderListener.onRenderSuccess(WXSDKInstance.this, width, height);
                    if (mUserTrackAdapter != null) {
                        WXPerformance performance = new WXPerformance();
                        performance.errCode = WXErrorCode.WX_SUCCESS.getErrorCode();
                        performance.args = getBundleUrl();
                        mUserTrackAdapter.commit(mContext, null, IWXUserTrackAdapter.JS_BRIDGE, performance, getUserTrackParams());
                    }
                    if (WXEnvironment.isApkDebugable()) {
                        WXLogUtils.d(WXLogUtils.WEEX_PERF_TAG, mWXPerformance.toString());
                    }
                }
            }
        });
    }
    if (!WXEnvironment.isApkDebugable()) {
        Log.e("weex_perf", mWXPerformance.getPerfData());
    }
}
Also used : WXPerformance(com.taobao.weex.common.WXPerformance)

Example 3 with WXPerformance

use of com.taobao.weex.common.WXPerformance in project weex-example by KalicyZhou.

the class WXSDKInstance method init.

public void init(Context context) {
    mContext = context;
    mNativeInvokeHelper = new NativeInvokeHelper(mInstanceId);
    mWXPerformance = new WXPerformance();
    mWXPerformance.WXSDKVersion = WXEnvironment.WXSDK_VERSION;
    mWXPerformance.JSLibInitTime = WXEnvironment.sJSLibInitTime;
    mUserTrackAdapter = WXSDKManager.getInstance().getIWXUserTrackAdapter();
}
Also used : NativeInvokeHelper(com.taobao.weex.bridge.NativeInvokeHelper) WXPerformance(com.taobao.weex.common.WXPerformance)

Example 4 with WXPerformance

use of com.taobao.weex.common.WXPerformance in project weex-example by KalicyZhou.

the class WXSoInstallMgrSdk method commit.

static void commit(IWXUserTrackAdapter utAdapter, String errCode, String errMsg) {
    if (utAdapter == null) {
        return;
    }
    if (errCode != null && errMsg != null) {
        WXPerformance p = new WXPerformance();
        p.errCode = errCode;
        p.errMsg = errMsg;
        utAdapter.commit(null, null, WXEnvironment.ENVIRONMENT, p, null);
    } else {
        utAdapter.commit(null, null, WXEnvironment.ENVIRONMENT, null, null);
    }
}
Also used : WXPerformance(com.taobao.weex.common.WXPerformance)

Example 5 with WXPerformance

use of com.taobao.weex.common.WXPerformance in project weex-example by KalicyZhou.

the class WXBridgeManager method commitJSBridgeAlarmMonitor.

public void commitJSBridgeAlarmMonitor(String instanceId, WXErrorCode errCode, String errMsg) {
    WXSDKInstance instance = WXSDKManager.getInstance().getSDKInstance(instanceId);
    IWXUserTrackAdapter adapter = WXSDKManager.getInstance().getIWXUserTrackAdapter();
    if (instance == null || adapter == null || errCode == null) {
        return;
    }
    WXPerformance performance = new WXPerformance();
    performance.args = instance.getBundleUrl();
    performance.errCode = errCode.getErrorCode();
    if (errCode != WXErrorCode.WX_SUCCESS) {
        performance.appendErrMsg(TextUtils.isEmpty(errMsg) ? errCode.getErrorMsg() : errMsg);
        WXLogUtils.e("wx_monitor", performance.toString());
    }
    adapter.commit(WXEnvironment.getApplication(), null, IWXUserTrackAdapter.JS_BRIDGE, performance, instance.getUserTrackParams());
}
Also used : WXSDKInstance(com.taobao.weex.WXSDKInstance) WXPerformance(com.taobao.weex.common.WXPerformance) IWXUserTrackAdapter(com.taobao.weex.adapter.IWXUserTrackAdapter)

Aggregations

WXPerformance (com.taobao.weex.common.WXPerformance)5 IWXUserTrackAdapter (com.taobao.weex.adapter.IWXUserTrackAdapter)2 WXSDKInstance (com.taobao.weex.WXSDKInstance)1 NativeInvokeHelper (com.taobao.weex.bridge.NativeInvokeHelper)1