use of com.tencent.wstt.gt.ui.model.TagTimeEntry in project GT by Tencent.
the class GTMulOpPerfDetailView method setInput.
/**
* 设置数据源,参数是数据源的起点
* 有三种情况会进入该方法:
* 1.GTPerfDetailView初始化时,参数会传入preStart=0,preEnd=0
* 2.Activity自动更新数据
* 3.划动图表刷新数据
*
* @param preStart
* 预先估算的在数据源中的起始位置,实际位置需要在本方法中修正
*/
@SuppressWarnings("rawtypes")
public void setInput(int preStart) {
start = preStart;
end = preStart + xMax;
isReachDataSetEnd = false;
// 滑动图表或进入时出现预期结束位置大于总数据长度情况,说明划到尾部以后了,需修正
// add on 20131127 极小概率会出现一组record的长度不同的情况
int minRecordSize = dataSet.getChildren()[0].getRecordSize();
for (TagTimeEntry tte : dataSet.getChildren()) {
minRecordSize = Math.min(minRecordSize, tte.getRecordSize());
}
if (end >= minRecordSize) {
end = minRecordSize;
// 用修正后的end更新start
start = Math.max(end - xMax, 0);
isReachDataSetEnd = true;
}
List[] tempList = new List[dataSet.getChildren().length];
for (int i = 0; i < dataSet.getChildren().length; i++) {
tempList[i] = dataSet.getChildren()[i].getRecordList(start, end);
}
setInput(tempList);
}
use of com.tencent.wstt.gt.ui.model.TagTimeEntry 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();
}
}
}
use of com.tencent.wstt.gt.ui.model.TagTimeEntry in project GT by Tencent.
the class GTAUTFragment method hasAppHistory.
private static boolean hasAppHistory(int type) {
if (!(type >= 0 && type < cb_alias.length)) {
return false;
}
String outparaname = cb_alias[type];
boolean hasdata = true;
ArrayList<String> tempL = new ArrayList<String>();
tempL = (ArrayList<String>) AUTManager.registOpTable.get(outparaname);
if (tempL != null) {
for (int i = 0; i < tempL.size(); i++) {
TagTimeEntry tte = OpPerfBridge.getProfilerData((String) tempL.get(i));
if (tte == null) {
hasdata = false;
} else {
if (tte.hasChild() && tte.getChildren()[0].getRecordSize() <= 0) {
hasdata = false;
} else if (tte.getRecordSize() <= 0) {
hasdata = false;
}
}
}
} else {
hasdata = false;
}
return hasdata;
}
use of com.tencent.wstt.gt.ui.model.TagTimeEntry in project GT by Tencent.
the class GTOpSinglePerfActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gt_perf_op_detail);
Intent intent = this.getIntent();
Bundle extras = intent.getExtras();
final String name = extras.getString("name");
final String alias = extras.getString("alias");
final String client = extras.getString("client");
// 出参的性能数据源取法
dataSet = OpPerfBridge.getProfilerData(name);
// 保存对应的出参变量,以便刷值
op = ClientManager.getInstance().getClient(client).getOutPara(name);
// 在onCreat之前数据源可能被清理了,这样就不打开页面
if (null == dataSet) {
// finish();
// return;
dataSet = new TagTimeEntry(null);
dataSet.setName(name);
dataSet.setExkey(ClientManager.getInstance().getClientKey(client));
}
about = dataSet.getDesc();
tvTitle = (TextView) findViewById(R.id.perf_detail_title);
tvTitle.setText(alias);
tvKey = (TextView) findViewById(R.id.op_perf_detail_key);
tvKey.setText(name);
tvAbout = (TextView) findViewById(R.id.op_perf_detail_about);
tvAbout.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
GTOutParaPerfDialog dialog = new GTOutParaPerfDialog(v.getContext(), alias, name, about);
dialog.show();
}
});
btn_back = (ImageButton) findViewById(R.id.perf_detail_back);
btn_back.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
}
});
// btn_save = (ImageButton)findViewById(R.id.perf_detail_save);
// btn_save.setOnClickListener(new OnClickListener() {
//
// public void onClick(View v) {
// String lastSaveLog = GTGWInternal.getLastSaveFolder();
// if (lastSaveLog != null && lastSaveLog.contains(".")
// && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX))
// {
// lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
// }
// et_savePath3.setText(lastSaveLog.trim());
// dlg_save.show();
// }
// });
btn_delete = (ImageButton) findViewById(R.id.perf_detail_delete);
btn_delete.setOnClickListener(showDeleteDlg);
// 告警区
final LinearLayout ll_warnArea = (LinearLayout) findViewById(R.id.op_perf_detail_warnarea);
img_bottom_arrow = (ImageView) findViewById(R.id.bottom_arrow);
if (dataSet.getThresholdEntry().isEnable()) {
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
} else {
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
}
// 告警抬头文本
tvWaringArea = (TextView) findViewById(R.id.op_perf_detail_interval_toast);
if (!dataSet.getThresholdEntry().isEnable()) {
tvWaringArea.setText(getString(R.string.warning_title_disable));
}
// 折叠线
ll_fold = (LinearLayout) findViewById(R.id.warning_fold);
ll_fold.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (dataSet.getThresholdEntry().isEnable()) {
dataSet.getThresholdEntry().setEnable(false);
img_bottom_arrow.setBackgroundResource(R.drawable.fold_arrow);
ll_warnArea.setVisibility(View.GONE);
tvWaringArea.setText(getString(R.string.warning_title_disable));
} else {
dataSet.getThresholdEntry().setEnable(true);
img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
ll_warnArea.setVisibility(View.VISIBLE);
tvWaringArea.setText(getString(R.string.warning_title));
}
}
});
etUpperInterval = (EditText) findViewById(R.id.op_perf_detail_upper_interval);
etUpperValue = (EditText) findViewById(R.id.op_perf_detail_upper_value);
etLowerValue = (EditText) findViewById(R.id.op_perf_detail_lower_value);
// 从未开始统计过的出参,不允许设置告警
if (!op.hasMonitorOnce) {
etUpperInterval.setEnabled(false);
etUpperValue.setEnabled(false);
etLowerValue.setEnabled(false);
// isfoldWarnArea = true;
// img_bottom_arrow.setBackgroundResource(R.drawable.unfold_arrow);
// ll_warnArea.setVisibility(View.GONE);
} else {
etUpperInterval.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etLowerValue.setInputType(EditorInfo.TYPE_CLASS_PHONE);
etUpperInterval.setOnKeyListener(thresholdKeyListener);
etUpperValue.setOnKeyListener(thresholdKeyListener);
etLowerValue.setOnKeyListener(thresholdKeyListener);
int upperDuration = dataSet.getThresholdEntry().getduration();
if (upperDuration != Integer.MAX_VALUE) {
etUpperInterval.setText(Integer.toString(upperDuration));
}
double upperValue = dataSet.getThresholdEntry().getUpperValue();
if (upperValue != Integer.MAX_VALUE) {
etUpperValue.setText(Double.toString(upperValue));
}
double lowerValue = dataSet.getThresholdEntry().getLowerValue();
if (lowerValue != Integer.MIN_VALUE) {
etLowerValue.setText(Double.toString(lowerValue));
}
}
RelativeLayout rl_save = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.gt_dailog_save_gw, null, false);
ImageButton btn_cleanSavePath = (ImageButton) rl_save.findViewById(R.id.save_clean);
btn_cleanSavePath.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
et_savePath3.setText("");
}
});
et_savePath3 = (EditText) rl_save.findViewById(R.id.save_editor);
String lastSaveLog = GTGWInternal.getLastSaveFolder();
if (lastSaveLog != null && lastSaveLog.contains(".") && lastSaveLog.endsWith(LogUtils.TLOG_POSFIX)) {
lastSaveLog = lastSaveLog.substring(0, lastSaveLog.lastIndexOf("."));
}
et_savePath3.setText(lastSaveLog);
et_savePath1 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent1);
et_savePath1.setText(Env.CUR_APP_NAME);
et_savePath2 = (EditText) rl_save.findViewById(R.id.save_editor_folder_parent2);
et_savePath2.setText(Env.CUR_APP_VER);
et_saveTestDesc = (EditText) rl_save.findViewById(R.id.save_editor_desc);
dlg_save = new Builder(this).setTitle(getString(R.string.save)).setView(rl_save).setPositiveButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).setNegativeButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String path1 = et_savePath1.getText().toString().trim();
if (!StringUtil.isLetter(path1)) {
ToastUtil.ShowShortToast(GTOpSinglePerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String path2 = et_savePath2.getText().toString().trim();
if (!StringUtil.isLetter(path1)) {
ToastUtil.ShowShortToast(GTOpSinglePerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String path3 = et_savePath3.getText().toString().trim();
if (!StringUtil.isLetter(path3)) {
ToastUtil.ShowShortToast(GTOpSinglePerfActivity.this, getString(R.string.save_folder_valid));
return;
}
String testDesc = et_saveTestDesc.getText().toString().trim();
GWSaveEntry saveEntry = new GWSaveEntry(path1, path2, path3, testDesc);
GTGWInternal.saveGWData(saveEntry, dataSet);
dialog.dismiss();
}
}).create();
tvValue = (TextView) findViewById(R.id.op_perf_detail_value);
tvTimes = (TextView) findViewById(R.id.bh_perf_detail_times);
tvMin = (TextView) findViewById(R.id.bh_perf_detail_min);
tvMax = (TextView) findViewById(R.id.bh_perf_detail_max);
tvAve = (TextView) findViewById(R.id.bh_perf_detail_ave);
tvWarningCnt = (TextView) findViewById(R.id.bh_perf_detail_warning_cnt);
if (op == null) {
tvValue.setText(dataSet.getLastValue());
} else {
tvValue.setText(op.getValue());
}
TagTimeEntry anchorEntry = dataSet;
if (dataSet.getSubTagEntrys().length > 0) {
anchorEntry = dataSet.getSubTagEntrys()[0];
}
tvTimes.setText(anchorEntry.getRecordSizeText());
tvMin.setText(anchorEntry.getMin());
tvMax.setText(anchorEntry.getMax());
tvAve.setText(anchorEntry.getAve());
tvWarningCnt.setText(Integer.toString(anchorEntry.getThresholdEntry().getUpperWariningCount() + anchorEntry.getThresholdEntry().getLowerWariningCount()));
LinearLayout ll_chart = (LinearLayout) findViewById(R.id.bh_perf_detail_chart);
chartView = new GTPerfDetailView(this, dataSet);
chartView.setInput(0);
ll_chart.addView(chartView);
}
use of com.tencent.wstt.gt.ui.model.TagTimeEntry in project GT by Tencent.
the class GTParamOutFragment method onListItemClick.
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
OutPara ov = OpUIManager.list_op.get(position);
final String key = ov.getKey();
if (key.equals(ParamConst.PROMPT_TITLE) || key.equals(ParamConst.DIVID_TITLE) || key.equals(ParamConst.PROMPT_DISABLE_TITLE)) {
return;
}
ov.setAlert(false);
GTServiceController.INSTANCE.show_alert = false;
TagTimeEntry opProfilerData = OpPerfBridge.getProfilerData(key);
if (null != opProfilerData && OpPerfBridge.getProfilerData(key).hasChild()) {
Intent intent = new Intent(getActivity(), GTOpMulPerfActivity.class);
intent.putExtra("name", key);
intent.putExtra("alias", ov.getAlias());
intent.putExtra("client", ov.getClient());
getActivity().startActivity(intent);
} else {
Intent intent = new Intent(getActivity(), GTOpSinglePerfActivity.class);
if (ov.getAlias().equals("SM")) {
intent = new Intent(getActivity(), GTOpSMActivity.class);
}
intent.putExtra("name", key);
intent.putExtra("alias", ov.getAlias());
intent.putExtra("client", ov.getClient());
getActivity().startActivity(intent);
}
}
Aggregations