Skip to content

Commit

Permalink
Fixed: start time bug & AUTHORS\VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
hzhuangqingbin authored and andrewleo committed Dec 25, 2013
1 parent 611c969 commit 36da692
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 26 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* KevinKong <[email protected]> <weibo:@孔庆云Kevin> <github:kevinkong>
* andrewleo <[email protected]> <weibo:@A_o11> <github:andrewleo>
* bingoHuang <[email protected]> <weibo:@黄庆兵> <github:bingoHuang>
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.1
1.3.0
41 changes: 25 additions & 16 deletions gen/com/netease/qa/emmagee/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,31 @@ public static final class drawable {
public static final int meminfo=0x7f020004;
}
public static final class id {
public static final int Lin=0x7f050004;
public static final int Lin=0x7f050003;
public static final int b=0x7f050001;
public static final int cpu1=0x7f050013;
public static final int cpu2=0x7f050014;
public static final int cpu1=0x7f050017;
public static final int cpu2=0x7f050018;
public static final int cpu_info=0x7f050000;
public static final int floating=0x7f050011;
public static final int floating_Window=0x7f050010;
public static final int floating=0x7f050015;
public static final int floating_Window=0x7f050014;
public static final int image=0x7f05000a;
public static final int img1=0x7f050002;
public static final int img2=0x7f050003;
public static final int memoryinfo=0x7f05000e;
public static final int memtotal=0x7f050006;
public static final int memunused=0x7f050005;
public static final int memtotal=0x7f050005;
public static final int memunused=0x7f050004;
public static final int password=0x7f050011;
public static final int processList=0x7f05000c;
public static final int rb=0x7f050009;
public static final int save=0x7f050012;
public static final int recipients=0x7f050013;
public static final int save=0x7f050016;
public static final int sender=0x7f050010;
public static final int smtp=0x7f050012;
public static final int stop=0x7f050008;
public static final int test=0x7f05000d;
public static final int text=0x7f05000b;
public static final int time=0x7f05000f;
public static final int traffic=0x7f050007;
public static final int wifi=0x7f050008;
public static final int traffic=0x7f050006;
public static final int wifi=0x7f050007;
}
public static final class layout {
public static final int cpu=0x7f030000;
Expand All @@ -56,17 +60,22 @@ public static final class string {
public static final int app_name3=0x7f040004;
public static final int app_name4=0x7f040005;
public static final int bg=0x7f040009;
public static final int closewifi=0x7f040011;
public static final int closewifi=0x7f040015;
public static final int collect=0x7f04000c;
public static final int cpu=0x7f040008;
public static final int hello=0x7f040000;
public static final int memoryinfo=0x7f04000b;
public static final int ok=0x7f04000f;
public static final int openwifi=0x7f040010;
public static final int seconds=0x7f04000d;
public static final int ok=0x7f040013;
public static final int openwifi=0x7f040014;
public static final int password=0x7f04000f;
public static final int receiver=0x7f04000d;
public static final int seconds=0x7f040011;
public static final int sender=0x7f04000e;
public static final int smtp=0x7f040010;
public static final int start=0x7f040007;
public static final int stopTest=0x7f040016;
public static final int system=0x7f040006;
public static final int testmemory=0x7f04000a;
public static final int window=0x7f04000e;
public static final int window=0x7f040012;
}
}
23 changes: 14 additions & 9 deletions src/com/netease/qa/emmagee/service/EmmageeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ private void createResultCsv() {
String totalMemory = fomart.format((double) totalMemorySize / 1024);
bw.write("指定应用的CPU内存监控情况\r\n" + "应用包名:," + packageName + "\r\n" + "应用名称: ," + processName + "\r\n" + "应用PID: ," + pid + "\r\n"
+ "机器内存大小(MB):," + totalMemory + "MB\r\n" + "机器CPU型号:," + cpuInfo.getCpuName() + "\r\n" + "机器android系统版本:,"
+ memoryInfo.getSDKVersion() + "\r\n" + "手机型号:," + memoryInfo.getPhoneType() + "\r\n" + "UID:," + uid + "\r\n" + "启动时间:,"
+ START_TIME + "\r\n");
+ memoryInfo.getSDKVersion() + "\r\n" + "手机型号:," + memoryInfo.getPhoneType() + "\r\n" + "UID:," + uid + "\r\n" + START_TIME);
bw.write("时间" + "," + "应用占用内存PSS(MB)" + "," + "应用占用内存比(%)" + "," + " 机器剩余内存(MB)" + "," + "应用占用CPU率(%)" + "," + "CPU总使用率(%)" + ","
+ "流量(KB)" + "," + "电量(%)" + "," + "电流(mA)" + "," + "温度(C)" + "," + "电压(V)" + "\r\n");
} catch (IOException e) {
Expand Down Expand Up @@ -389,22 +388,24 @@ private void getStartTimeFromLogcat() {
String logcatCommand = "logcat -v time -d ActivityManager:I *:S";
Process process = Runtime.getRuntime().exec(logcatCommand);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
// StringBuilder strBuilder = new StringBuilder();
// StringBuilder strBuilder = new StringBuilder();
String line = "";

while ((line = bufferedReader.readLine()) != null) {
// strBuilder.append(line);
// strBuilder.append("\r\n");
// strBuilder.append(line);
// strBuilder.append("\r\n");
if (line.matches(".*Displayed.*\\+(.*)ms.*")) {
// TODO:regular pattern:Activity,startTime
if (line.contains("total")) {
line = line.substring(0, line.indexOf("total"));
}
startTime = line.substring(line.lastIndexOf("+") + 1, line.lastIndexOf("ms") + 2);
Toast.makeText(EmmageeService.this, "启动时间:" + startTime, Toast.LENGTH_LONG).show();
isGetStartTime = false;
}
}
getStartTimeCount++;
// Log.w(LOG_TAG, "Start Time Log:" + strBuilder.toString());
// Log.w(LOG_TAG, "getStartCount:" + getStartTimeCount);
// Log.w(LOG_TAG, "Start Time Log:" + strBuilder.toString());
Log.w(LOG_TAG, "getStartCount:" + getStartTimeCount);
} catch (IOException e) {
Log.d(LOG_TAG, e.getMessage());
}
Expand Down Expand Up @@ -502,7 +503,11 @@ public void onDestroy() {
handler.removeCallbacks(task);
closeOpenedStream();
// replace the start time in file
replaceFileString(resultFilePath, START_TIME, startTime);
if (!"".equals(startTime)) {
replaceFileString(resultFilePath, START_TIME, "启动时间:" + startTime + "\r\n");
} else {
replaceFileString(resultFilePath, START_TIME, "");
}
isStop = true;
unregisterReceiver(batteryBroadcast);
boolean isSendSuccessfully = false;
Expand Down

0 comments on commit 36da692

Please sign in to comment.