提交 d0cb9890 编写于 作者: A andrewleo2013

fix bug

上级 9cb8904c
......@@ -27,6 +27,7 @@ import java.util.Calendar;
import com.netease.qa.emmagee.service.EmmageeService;
import android.content.Context;
import android.os.Build;
import android.util.Log;
/**
......@@ -148,9 +149,14 @@ public class CpuInfo {
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();
......@@ -164,8 +170,8 @@ public class CpuInfo {
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);
......
......@@ -24,7 +24,7 @@ import android.util.Log;
/**
* information of network traffic
*
*
*/
public class TrafficInfo {
......@@ -40,7 +40,7 @@ public class TrafficInfo {
/**
* get total network traffic, which is the sum of upload and download
* traffic.
*
*
* @return total traffic include received and send traffic
*/
public long getTrafficInfo() {
......@@ -66,8 +66,11 @@ public class TrafficInfo {
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());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册