提交 669de8a9 编写于 作者: A andrewleo

Added: add ftp to csv

上级 2d2a44f9
......@@ -41,6 +41,7 @@
<string name="current">电流(mA)</string>
<string name="temperature">温度(C)</string>
<string name="voltage">电压(V)</string>
<string name="fps">帧率</string>
<string name="stat_error">统计出错</string>
<string name="comment1">注释:已知部分不支持的机型可在此查阅:https://github.com/NetEase/Emmagee/wiki/Some-devices-are-not-supported</string>
......
......@@ -41,6 +41,7 @@
<string name="current">Current(mA)</string>
<string name="temperature">Temperature(C)</string>
<string name="voltage">Voltage(V)</string>
<string name="fps">FPS</string>
<string name="stat_error">Stat Error</string>
<string name="comment1">Note: for unsupported devices refer to: https://github.com/NetEase/Emmagee/wiki/Some-devices-are-not-supported</string>
......
......@@ -65,6 +65,7 @@ import com.netease.qa.emmagee.utils.Constants;
import com.netease.qa.emmagee.utils.CpuInfo;
import com.netease.qa.emmagee.utils.CurrentInfo;
import com.netease.qa.emmagee.utils.EncryptData;
import com.netease.qa.emmagee.utils.FpsInfo;
import com.netease.qa.emmagee.utils.MailSender;
import com.netease.qa.emmagee.utils.MemoryInfo;
import com.netease.qa.emmagee.utils.MyApplication;
......@@ -122,6 +123,7 @@ public class EmmageeService extends Service {
private String temperature;
private String voltage;
private CurrentInfo currentInfo;
private FpsInfo fpsInfo;
private BatteryInfoBroadcastReceiver batteryBroadcast = null;
// get start time
......@@ -139,6 +141,7 @@ public class EmmageeService extends Service {
super.onCreate();
isServiceStop = false;
isStop = false;
fpsInfo = new FpsInfo();
memoryInfo = new MemoryInfo();
procInfo = new ProcessInfo();
fomart = new DecimalFormat();
......@@ -300,7 +303,7 @@ public class EmmageeService extends Service {
+ getString(R.string.mobile_free_mem) + Constants.COMMA + getString(R.string.app_used_cpu_ratio) + Constants.COMMA
+ getString(R.string.total_used_cpu_ratio) + multiCpuTitle + Constants.COMMA + getString(R.string.traffic) + Constants.COMMA
+ getString(R.string.battery) + Constants.COMMA + getString(R.string.current) + Constants.COMMA + getString(R.string.temperature)
+ Constants.COMMA + getString(R.string.voltage) + Constants.LINE_END);
+ Constants.COMMA + getString(R.string.voltage) + Constants.COMMA + getString(R.string.fps) + Constants.LINE_END);
} catch (IOException e) {
Log.e(LOG_TAG, e.getMessage());
}
......@@ -457,7 +460,7 @@ public class EmmageeService extends Service {
} catch (Exception e) {
currentBatt = Constants.NA;
}
ArrayList<String> processInfo = cpuInfo.getCpuRatioInfo(totalBatt, currentBatt, temperature, voltage, isRoot);
ArrayList<String> processInfo = cpuInfo.getCpuRatioInfo(totalBatt, currentBatt, temperature, voltage, String.valueOf(fpsInfo.fps()), isRoot);
if (isFloating) {
String processCpuRatio = "0.00";
String totalCpuRatio = "0.00";
......
......@@ -225,7 +225,7 @@ public class CpuInfo {
* @return network traffic ,used ratio of process CPU and total CPU in
* certain interval
*/
public ArrayList<String> getCpuRatioInfo(String totalBatt, String currentBatt, String temperature, String voltage,boolean isRoot) {
public ArrayList<String> getCpuRatioInfo(String totalBatt, String currentBatt, String temperature, String voltage, String fps, boolean isRoot) {
String heapData = "";
DecimalFormat fomart = new DecimalFormat();
......@@ -315,7 +315,7 @@ public class CpuInfo {
EmmageeService.bw.write(mDateTime2 + Constants.COMMA + ProcessInfo.getTopActivity(context) + Constants.COMMA +heapData+ pMemory
+ Constants.COMMA + percent + Constants.COMMA + fMemory + Constants.COMMA + processCpuRatio + Constants.COMMA
+ totalCpuBuffer.toString() + trafValue + Constants.COMMA + totalBatt + Constants.COMMA + currentBatt + Constants.COMMA
+ temperature + Constants.COMMA + voltage + Constants.LINE_END);
+ temperature + Constants.COMMA + voltage + Constants.COMMA + fps + Constants.LINE_END);
totalCpu2 = (ArrayList<Long>) totalCpu.clone();
processCpu2 = processCpu;
idleCpu2 = (ArrayList<Long>) idleCpu.clone();
......
package com.netease.qa.emmagee.utils;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class FpsInfo {
private static Process process;
private static BufferedReader ir;
private static DataOutputStream os = null;
private static long startTime = 0L;
private static int lastFrameNum = 0;
/**
* get frame per second
* @return frame per second
*/
public static float fps() {
long nowTime = System.nanoTime();
float f = (float) (nowTime - startTime) / 1000000.0F;
startTime = nowTime;
int nowFrameNum = getFrameNum();
final float fps = Math.round((nowFrameNum - lastFrameNum) * 1000 / f);
lastFrameNum = nowFrameNum;
return fps;
}
/**
* get frame value
*
* @return frame value
*/
public static final int getFrameNum() {
try {
if (process == null) {
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
ir = new BufferedReader(new InputStreamReader(
process.getInputStream()));
}
os.writeBytes("service call SurfaceFlinger 1013" + "\n");
os.flush();
String str1 = ir.readLine();
if (str1 == null) {
return -1;
}
int start = str1.indexOf("(");
int end = str1.indexOf(" ");
if ((start != -1) & (end > start)) {
String str2 = str1.substring(start + 1, end);
return Integer.parseInt((String) str2, 16);
}
return -1;
} catch (IOException e) {
e.printStackTrace();
return -1;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册