Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_47647075
emmagee
提交
fd1ebf25
E
emmagee
项目概览
weixin_47647075
/
emmagee
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
emmagee
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fd1ebf25
编写于
2月 10, 2015
作者:
A
andrewleo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed: #32 negative network traffic
上级
4c2dc6d7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
16 addition
and
13 deletion
+16
-13
src/com/netease/qa/emmagee/service/EmmageeService.java
src/com/netease/qa/emmagee/service/EmmageeService.java
+8
-8
src/com/netease/qa/emmagee/utils/CpuInfo.java
src/com/netease/qa/emmagee/utils/CpuInfo.java
+8
-5
未找到文件。
src/com/netease/qa/emmagee/service/EmmageeService.java
浏览文件 @
fd1ebf25
...
...
@@ -389,7 +389,7 @@ public class EmmageeService extends Service {
while
((
line
=
bufferedReader
.
readLine
())
!=
null
)
{
strBuilder
.
append
(
line
);
strBuilder
.
append
(
"\r\n"
);
strBuilder
.
append
(
Constants
.
LINE_END
);
String
regex
=
".*Displayed.*"
+
startActivity
+
".*\\+(.*)ms.*"
;
if
(
line
.
matches
(
regex
))
{
Log
.
w
(
"my logs"
,
line
);
...
...
@@ -434,10 +434,10 @@ public class EmmageeService extends Service {
// 异常数据过滤
try
{
if
(
Math
.
abs
(
Double
.
parseDouble
(
currentBatt
))
>=
500
)
{
currentBatt
=
"N/A"
;
currentBatt
=
Constants
.
NA
;
}
}
catch
(
Exception
e
)
{
currentBatt
=
"N/A"
;
currentBatt
=
Constants
.
NA
;
}
ArrayList
<
String
>
processInfo
=
cpuInfo
.
getCpuRatioInfo
(
totalBatt
,
currentBatt
,
temperature
,
voltage
);
if
(
isFloating
)
{
...
...
@@ -464,7 +464,7 @@ public class EmmageeService extends Service {
txtTotalMem
.
setText
(
getString
(
R
.
string
.
process_overall_cpu
)
+
processCpuRatio
+
"%/"
+
totalCpuRatio
+
"%"
);
String
batt
=
getString
(
R
.
string
.
current
)
+
currentBatt
;
if
(
"-1"
.
equals
(
trafficSize
))
{
txtTraffic
.
setText
(
batt
+
","
+
getString
(
R
.
string
.
traffic
)
+
"N/A"
);
txtTraffic
.
setText
(
batt
+
","
+
getString
(
R
.
string
.
traffic
)
+
Constants
.
NA
);
}
else
if
(
isMb
)
txtTraffic
.
setText
(
batt
+
","
+
getString
(
R
.
string
.
traffic
)
+
fomart
.
format
(
trafficMb
)
+
"MB"
);
else
...
...
@@ -498,8 +498,8 @@ public class EmmageeService extends Service {
public
void
closeOpenedStream
()
{
try
{
if
(
bw
!=
null
)
{
bw
.
write
(
getString
(
R
.
string
.
comment1
)
+
"\r\n"
+
getString
(
R
.
string
.
comment2
)
+
"\r\n"
+
getString
(
R
.
string
.
comment3
)
+
"\r\n"
+
getString
(
R
.
string
.
comment4
)
+
"\r\n"
);
bw
.
write
(
getString
(
R
.
string
.
comment1
)
+
Constants
.
LINE_END
+
getString
(
R
.
string
.
comment2
)
+
Constants
.
LINE_END
+
getString
(
R
.
string
.
comment3
)
+
Constants
.
LINE_END
+
getString
(
R
.
string
.
comment4
)
+
Constants
.
LINE_END
);
bw
.
close
();
}
if
(
osw
!=
null
)
...
...
@@ -523,7 +523,7 @@ public class EmmageeService extends Service {
// replace the start time in file
if
(
isGrantedReadLogsPermission
())
{
if
(!
BLANK_STRING
.
equals
(
startTime
))
{
replaceFileString
(
resultFilePath
,
START_TIME
,
getString
(
R
.
string
.
start_time
)
+
startTime
+
"\r\n"
);
replaceFileString
(
resultFilePath
,
START_TIME
,
getString
(
R
.
string
.
start_time
)
+
startTime
+
Constants
.
LINE_END
);
}
else
{
replaceFileString
(
resultFilePath
,
START_TIME
,
BLANK_STRING
);
}
...
...
@@ -561,7 +561,7 @@ public class EmmageeService extends Service {
String
line
=
BLANK_STRING
;
String
oldtext
=
BLANK_STRING
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
oldtext
+=
line
+
"\r\n"
;
oldtext
+=
line
+
Constants
.
LINE_END
;
}
reader
.
close
();
// replace a word in a file
...
...
src/com/netease/qa/emmagee/utils/CpuInfo.java
浏览文件 @
fd1ebf25
...
...
@@ -54,7 +54,7 @@ public class CpuInfo {
private
SimpleDateFormat
formatterFile
;
private
MemoryInfo
mi
;
private
long
totalMemorySize
;
private
long
initial
Traffic
;
private
long
pre
Traffic
;
private
long
lastestTraffic
;
private
long
traffic
;
private
TrafficInfo
trafficInfo
;
...
...
@@ -252,17 +252,20 @@ public class CpuInfo {
}
else
mDateTime2
=
formatterFile
.
format
(
cal
.
getTime
().
getTime
());
if
(
isInitialStatics
)
{
initial
Traffic
=
trafficInfo
.
getTrafficInfo
();
pre
Traffic
=
trafficInfo
.
getTrafficInfo
();
isInitialStatics
=
false
;
}
else
{
lastestTraffic
=
trafficInfo
.
getTrafficInfo
();
if
(
initial
Traffic
==
-
1
)
if
(
pre
Traffic
==
-
1
)
traffic
=
-
1
;
else
{
traffic
=
(
lastestTraffic
-
initialTraffic
+
1023
)
/
1024
;
if
(
lastestTraffic
>
preTraffic
)
{
traffic
+=
(
lastestTraffic
-
preTraffic
+
1023
)
/
1024
;
}
}
preTraffic
=
lastestTraffic
;
Log
.
d
(
LOG_TAG
,
"lastestTraffic==="
+
lastestTraffic
);
Log
.
d
(
LOG_TAG
,
"
initialTraffic==="
+
initial
Traffic
);
Log
.
d
(
LOG_TAG
,
"
preTraffic==="
+
pre
Traffic
);
StringBuffer
totalCpuBuffer
=
new
StringBuffer
();
if
(
null
!=
totalCpu2
&&
totalCpu2
.
size
()
>
0
)
{
processCpuRatio
=
fomart
.
format
(
100
*
((
double
)
(
processCpu
-
processCpu2
)
/
((
double
)
(
totalCpu
.
get
(
0
)
-
totalCpu2
.
get
(
0
)))));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录