示例#1
0
        public void gameApmTest(Text text)
        {
            gameApmTest_count++;
            text.text = "gameApmTest start, count: " + gameApmTest_count + "\n";

            GameAttribute attribute = new GameAttribute("new scene", GameAttribute.LoadingState.NOT_LOADING);

            text.text += "create new attribute success\n";

            APMS.getInstance().startGamePlugin();
            text.text += "GameAPM start\n";

            APMS.getInstance().enableGamePlugin(true);
            text.text += "enableGamePlugin: true\n";

            sceneHandler = APMS.getInstance().startLoadingScene(attribute);
            text.text   += "startLoadingScene, sceneHandler= " + sceneHandler + "\n";

            APMS.getInstance().setCurrentGameAttribute(attribute);
            text.text += "setCurrentGameAttribute\n";

            APMS.getInstance().setReportRate(1);
            text.text += "setReportRate\n";

            text.text += "gameApmTest success\n\n";
        }
示例#2
0
        public void addNetworkMonitor()
        {
            string httpUrl = "https://www.developer.huawei.com";
            // 1. Create a networkMeasure for this special network request
            NetworkMeasure networkMeasure = APMS.getInstance().createNetworkMeasure(httpUrl, "GET");

            NetworkPropertyTest(networkMeasure);
            // 2. Add custom property for this network measure
            networkMeasure.putProperty("activityName", "MainActivity");
            // 3. start this network measure
            Debug.Log("networkMeasure start");
            networkMeasure.start();

            networkMeasure.setBytesSent(1024);
            networkMeasure.setContentType("UTF-8");

            Debug.Log("start the fake url request process");
            for (int i = 0; i < 1024; i++)
            {
            }

            int bodysize = 1024;

            // 4. Set response body size for this network measure
            networkMeasure.setBytesReceived(bodysize);

            // 5. Set network response code for this network measure
            int responseCode = 400;

            networkMeasure.setStatusCode(responseCode);

            // 6. Stop this network measure
            networkMeasure.stop();
            Debug.Log("networkMeasure stop");
        }
示例#3
0
 public void switchGamePluginStatus(bool status)
 {
     if (status == false)
     {
         Debug.Log("switch enableCollection status from false -> true");
         APMS.getInstance().enableGamePlugin(true);
     }
     else if (status == true)
     {
         Debug.Log("switch enableCollection status from true -> false");
         APMS.getInstance().enableGamePlugin(false);
     }
 }
示例#4
0
        public void stopLoadingScene(Text text)
        {
            stopLoadingSceneTest_count++;
            text.text = "stopLoadingSceneTest start, count: " + stopLoadingSceneTest_count + "\n";

            APMS.getInstance().stopLoadingScene(sceneHandler);
            text.text += "stopLoadingScene\n";

            APMS.getInstance().stopGamePlugin();
            text.text += "GameAPM stop\n";

            text.text += "stopLoadingSceneTest success\n";
        }
示例#5
0
 public void switchAnrMonitorStatus(bool status)
 {
     if (status == false)
     {
         Debug.Log("switch enableAnrMonitor status from false -> true");
         APMS.getInstance().enableAnrMonitor(true);
     }
     else if (status == true)
     {
         Debug.Log("switch enableAnrMonitor status from true -> false");
         APMS.getInstance().enableAnrMonitor(false);
     }
 }
示例#6
0
        public void sendCustomEvent()
        {
            CustomTrace customTrace = APMS.getInstance().createCustomTrace("CustomEvent1");

            if (customTrace != null)
            {
                UnityEngine.Debug.Log("customTrace is not null");
            }

            customTrace.start();
            // code you want trace

            CustomTracePropertyTest(customTrace);
            CustomTraceMeasureTest(customTrace);
            customTrace.stop();
        }