Search in sources :

Example 16 with Client

use of com.tencent.wstt.gt.manager.Client in project GT by Tencent.

the class GTBinder method setTimedOutPara.

@Override
public void setTimedOutPara(String key, long time, String value) throws RemoteException {
    Client client = ClientManager.getInstance().getClient(getCallingUid());
    OutPara para = client.getOutPara(key);
    if (null != para) {
        para.setValue(time, value);
        // add on 20130923 为了出参支持历史曲线
        if (para.isMonitor()) {
            try {
                long lValue = Long.parseLong(value);
                OpPerfBridge.addHistory(para, value, time, lValue);
            } catch (Exception e) {
                // 非数字,直接直接重置
                para.setMonitor(false);
                OpPerfBridge.removeProfilerData(key);
            }
        }
    }
}
Also used : Client(com.tencent.wstt.gt.manager.Client) RemoteException(android.os.RemoteException)

Example 17 with Client

use of com.tencent.wstt.gt.manager.Client in project GT by Tencent.

the class GTBinder method setGlobalInPara.

@Override
public void setGlobalInPara(String key, String newValue) throws RemoteException {
    Client client = ClientManager.getInstance().getClient(ClientManager.GLOBAL_CLIENT);
    InPara iv = client.getInPara(key);
    if (null != iv) {
        iv.getValues().remove(newValue);
        iv.getValues().add(0, newValue);
    }
}
Also used : Client(com.tencent.wstt.gt.manager.Client)

Example 18 with Client

use of com.tencent.wstt.gt.manager.Client in project GT by Tencent.

the class GTAutoTestInternal method startSample.

/**
	 * 采集指定的指标
	 * @param pkgName 指定的被测应用
	 * @param pid 被测应用指定的被测进程,当pid为-1时,会采集应用所有进程的指定性能指标
	 * @param target 指定的采集指标,包括:
	 * <p>GTAutoTestInternal.INTENT_KEY_PSS</p>
	 * <p>GTAutoTestInternal.INTENT_KEY_PRI</p>
	 * <p>GTAutoTestInternal.INTENT_KEY_NET</p>
	 * <p>GTAutoTestInternal.INTENT_KEY_JIF</p>
	 * <p>GTAutoTestInternal.INTENT_KEY_CPU</p>
	 */
public static void startSample(String pkgName, int pid, String target) {
    Client client = ClientManager.getInstance().getAUTClient();
    if (client == null) {
        return;
    }
    List<OutPara> opList = new ArrayList<OutPara>();
    if (target.equals(INTENT_KEY_PSS)) {
        opList = GTAUTFragment.registerOutpara(AUTManager.SEQ_PSS, pid);
    } else if (target.equals(INTENT_KEY_NET)) {
        opList = GTAUTFragment.registerOutpara(AUTManager.SEQ_NET, -1);
    } else if (target.equals(INTENT_KEY_FPS)) {
        // FPS从属的Client是DefaultClient
        OutPara opFps = ClientManager.getInstance().getDefaultClient().getOutPara(CommonString.FPS_key);
        // 将FPS挪到已关注出参中
        if (AidlEntry.DISPLAY_DISABLE == opFps.getDisplayProperty()) {
            opFps.setMonitor(true);
            opFps.setDisplayProperty(AidlEntry.DISPLAY_NORMAL);
            OpUIManager.setItemToNormal(opFps);
        }
        // 如果FPS非观察状态,重置为观察状态
        if (!opFps.isMonitor()) {
            opFps.setMonitor(true);
        }
        OpPerfBridge.registMonitor(opFps);
        opList.add(opFps);
    } else if (target.equals(INTENT_KEY_JIF)) {
        opList = GTAUTFragment.registerOutpara(AUTManager.SEQ_JIF, pid);
    } else if (target.equals(INTENT_KEY_CPU)) {
        opList = GTAUTFragment.registerOutpara(AUTManager.SEQ_CPU, pid);
    } else if (target.equals(INTENT_KEY_PRI)) {
        opList = GTAUTFragment.registerOutpara(AUTManager.SEQ_PD, pid);
    }
    tempMap.put(new ProOutParaQueryEntry(pkgName, pid, target), opList);
    // 主动刷新出参页面的列表
    GTApp.getOpHandler().sendEmptyMessage(5);
    GTApp.getOpEditHandler().sendEmptyMessage(0);
}
Also used : OutPara(com.tencent.wstt.gt.OutPara) ArrayList(java.util.ArrayList) Client(com.tencent.wstt.gt.manager.Client)

Example 19 with Client

use of com.tencent.wstt.gt.manager.Client in project GT by Tencent.

the class ProcPerfParaRunEngine method getCurEnableProcPerfParas.

private List<OutPara> getCurEnableProcPerfParas() {
    Client client = ClientManager.getInstance().getAUTClient();
    if (client == null) {
        return EMPTY_LIST;
    }
    List<OutPara> ops = ClientManager.getInstance().getAUTClient().getAllOutParas();
    enable_procPerf_ops.clear();
    for (OutPara op : ops) {
        if (OutPara.DISPLAY_DISABLE != op.getDisplayProperty()) {
            enable_procPerf_ops.add(op);
        }
    }
    return enable_procPerf_ops;
}
Also used : OutPara(com.tencent.wstt.gt.OutPara) Client(com.tencent.wstt.gt.manager.Client)

Example 20 with Client

use of com.tencent.wstt.gt.manager.Client in project GT by Tencent.

the class SMDataService method onHandleIntent.

@Override
protected void onHandleIntent(Intent intent) {
    String pkgName = intent.getStringExtra("pkgName");
    String key = "SM:" + pkgName;
    //		String SFKey = "SF:" + pkgName;
    Client globalClient = ClientManager.getInstance().getGlobalClient();
    globalClient.registerOutPara(key, "SM");
    globalClient.setOutparaMonitor(key, true);
    OpPerfBridge.startProfier(globalClient.getOutPara(key), Functions.PERF_DIGITAL_NORMAL, "", "");
    /*
		 * SM设置默认的告警阈值为40,
		 * TODO 这里设置是简单支持SM的告警需求,SDK命令支持比较麻烦,就先加在这里了
		 */
    OpPerfBridge.getProfilerData(key).getThresholdEntry().setThreshold(1, Integer.MAX_VALUE, 40);
    // 主动刷新出参页面的列表
    GTApp.getOpHandler().sendEmptyMessage(5);
    GTApp.getOpEditHandler().sendEmptyMessage(0);
    //		
    while (true) {
        if (pause) {
            break;
        }
        int x = count.getAndSet(0);
        // 卡顿大于60时,要将之前几次SM计数做修正
        if (x > 60) {
            int n = x / 60;
            int v = x % 60;
            TagTimeEntry tte = OpPerfBridge.getProfilerData(key);
            int len = tte.getRecordSize();
            // 补偿参数
            //Math.min(len, n);
            int p = n;
            /*
				 * n > len是刚启动测试的情况,日志中的亡灵作祟,这种情况不做补偿;
				 * 并且本次也记为60。本逻辑在两次测试间会清理数据的情况生效。
				 */
            if (n > len) {
                globalClient.setOutPara(key, 60);
            //					globalClient.setOutPara(SFKey, 0);
            } else {
                for (int i = 0; i < p; i++) {
                    TimeEntry te = tte.getRecord(len - 1 - i);
                    te.reduce = 0;
                }
                globalClient.setOutPara(key, 60 - v);
            //					globalClient.setOutPara(SFKey, v);
            }
        } else {
            int sm = 60 - x;
            globalClient.setOutPara(key, sm);
        //				globalClient.setOutPara(SFKey, x);
        }
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
Also used : TagTimeEntry(com.tencent.wstt.gt.ui.model.TagTimeEntry) TagTimeEntry(com.tencent.wstt.gt.ui.model.TagTimeEntry) TimeEntry(com.tencent.wstt.gt.ui.model.TimeEntry) Client(com.tencent.wstt.gt.manager.Client)

Aggregations

Client (com.tencent.wstt.gt.manager.Client)20 OutPara (com.tencent.wstt.gt.OutPara)4 RemoteException (android.os.RemoteException)3 CommonString (com.tencent.wstt.gt.utils.CommonString)2 ArrayList (java.util.ArrayList)2 Context (android.content.Context)1 Message (android.os.Message)1 CpuUtils (com.tencent.wstt.gt.api.utils.CpuUtils)1 NetUtils (com.tencent.wstt.gt.api.utils.NetUtils)1 ClientFactory (com.tencent.wstt.gt.manager.ClientFactory)1 ConnectedClientFactory (com.tencent.wstt.gt.manager.ConnectedClientFactory)1 TagTimeEntry (com.tencent.wstt.gt.ui.model.TagTimeEntry)1 TimeEntry (com.tencent.wstt.gt.ui.model.TimeEntry)1