Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewleo committed Mar 12, 2013
1 parent 9cb8904 commit d0cb989
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
14 changes: 10 additions & 4 deletions src/com/netease/qa/emmagee/utils/CpuInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.netease.qa.emmagee.service.EmmageeService;

import android.content.Context;
import android.os.Build;
import android.util.Log;

/**
Expand Down Expand Up @@ -148,9 +149,14 @@ public ArrayList<String> getCpuRatioInfo() {
cpuUsedRatio.clear();

try {
String mDateTime2;
Calendar cal = Calendar.getInstance();
String mDateTime2 = formatterFile.format(cal.getTime().getTime()
+ 8 * 60 * 60 * 1000);
// if ((Build.MODEL.equals("sdk"))
// || (Build.MODEL.equals("google_sdk"))) {
// mDateTime2 = formatterFile.format(cal.getTime().getTime() + 8
// * 60 * 60 * 1000);
// } else
mDateTime2 = formatterFile.format(cal.getTime().getTime());

if (isInitialStatics) {
initialTraffic = trafficInfo.getTrafficInfo();
Expand All @@ -164,8 +170,8 @@ public ArrayList<String> getCpuRatioInfo() {
processCpuRatio = fomart
.format(100 * ((double) (processCpu - processCpu2) / (double) (totalCpu - totalCpu2)));
totalCpuRatio = fomart
.format(100 * ((double) ((totalCpu - idleCpu) - (totalCpu2 - idleCpu2))
/ (double) (totalCpu - totalCpu2)));
.format(100 * ((double) ((totalCpu - idleCpu) -
(totalCpu2 - idleCpu2)) / (double) (totalCpu - totalCpu2)));
long pidMemory = mi.getPidMemorySize(pid, context);
String pMemory = fomart.format((double) pidMemory / 1024);
long freeMemory = mi.getFreeMemorySize(context);
Expand Down
11 changes: 7 additions & 4 deletions src/com/netease/qa/emmagee/utils/TrafficInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/**
* information of network traffic
*
*
*/
public class TrafficInfo {

Expand All @@ -40,7 +40,7 @@ public TrafficInfo(String uid) {
/**
* get total network traffic, which is the sum of upload and download
* traffic.
*
*
* @return total traffic include received and send traffic
*/
public long getTrafficInfo() {
Expand All @@ -66,8 +66,11 @@ public long getTrafficInfo() {
e.printStackTrace();
} finally {
try {
rafRcv.close();
rafSnd.close();
if (rafRcv != null) {
rafRcv.close();
}
if (rafSnd != null)
rafSnd.close();
} catch (IOException e) {
Log.i(LOG_TAG,
"close randomAccessFile exception: " + e.getMessage());
Expand Down

0 comments on commit d0cb989

Please sign in to comment.