Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_47647075
emmagee
提交
def4df80
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 搜索 >>
提交
def4df80
编写于
12月 30, 2015
作者:
A
andrewleo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed: cpu name of arm and refine fps
上级
a24e18d7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
29 deletion
+33
-29
src/com/netease/qa/emmagee/utils/CpuInfo.java
src/com/netease/qa/emmagee/utils/CpuInfo.java
+7
-12
src/com/netease/qa/emmagee/utils/FpsInfo.java
src/com/netease/qa/emmagee/utils/FpsInfo.java
+24
-17
src/com/netease/qa/emmagee/utils/ProcessInfo.java
src/com/netease/qa/emmagee/utils/ProcessInfo.java
+2
-0
未找到文件。
src/com/netease/qa/emmagee/utils/CpuInfo.java
浏览文件 @
def4df80
...
...
@@ -141,19 +141,14 @@ public class CpuInfo {
try
{
RandomAccessFile
cpuStat
=
new
RandomAccessFile
(
CPU_INFO_PATH
,
"r"
);
// check cpu type
if
(
Build
.
CPU_ABI
.
equalsIgnoreCase
(
CPU_X86
))
{
String
line
;
while
(
null
!=
(
line
=
cpuStat
.
readLine
()))
{
String
[]
values
=
line
.
split
(
":"
);
if
(
values
[
0
].
contains
(
INTEL_CPU_NAME
))
{
cpuStat
.
close
();
return
values
[
1
];
}
String
line
;
while
(
null
!=
(
line
=
cpuStat
.
readLine
()))
{
String
[]
values
=
line
.
split
(
":"
);
if
(
values
[
0
].
contains
(
INTEL_CPU_NAME
)
||
values
[
0
].
contains
(
"Processor"
))
{
cpuStat
.
close
();
Log
.
d
(
LOG_TAG
,
"CPU name="
+
values
[
1
]);
return
values
[
1
];
}
}
else
{
String
[]
cpu
=
cpuStat
.
readLine
().
split
(
":"
);
// cpu信息的前一段是含有processor字符串,此处替换为不显示
cpuStat
.
close
();
return
cpu
[
1
];
}
}
catch
(
IOException
e
)
{
Log
.
e
(
LOG_TAG
,
"IOException: "
+
e
.
getMessage
());
...
...
src/com/netease/qa/emmagee/utils/FpsInfo.java
浏览文件 @
def4df80
...
...
@@ -12,19 +12,27 @@ public class FpsInfo {
private
static
DataOutputStream
os
=
null
;
private
static
long
startTime
=
0L
;
private
static
int
lastFrameNum
=
0
;
private
static
boolean
ok
=
true
;
/**
* get frame per second
*
* @return frame per second
*/
public
static
float
fps
()
{
long
nowTime
=
System
.
nanoTime
();
float
f
=
(
float
)
(
nowTime
-
startTime
)
/
1000000.0
F
;
startTime
=
nowTime
;
int
nowFrameNum
=
getFrameNum
();
final
float
fps
=
Math
.
round
((
nowFrameNum
-
lastFrameNum
)
*
1000
/
f
);
lastFrameNum
=
nowFrameNum
;
return
fps
;
if
(
ok
)
{
long
nowTime
=
System
.
nanoTime
();
float
f
=
(
float
)
(
nowTime
-
startTime
)
/
1000000.0
F
;
startTime
=
nowTime
;
int
nowFrameNum
=
getFrameNum
();
final
float
fps
=
Math
.
round
((
nowFrameNum
-
lastFrameNum
)
*
1000
/
f
);
lastFrameNum
=
nowFrameNum
;
return
fps
;
}
else
{
return
-
1
;
}
}
/**
...
...
@@ -43,19 +51,18 @@ public class FpsInfo {
os
.
writeBytes
(
"service call SurfaceFlinger 1013"
+
"\n"
);
os
.
flush
();
String
str1
=
ir
.
readLine
();
if
(
str1
==
null
)
{
return
-
1
;
if
(
str1
!=
null
)
{
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
);
}
}
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
;
}
ok
=
false
;
return
-
1
;
}
}
src/com/netease/qa/emmagee/utils/ProcessInfo.java
浏览文件 @
def4df80
...
...
@@ -97,6 +97,7 @@ public class ProcessInfo {
Log
.
i
(
LOG_TAG
,
"start getLaunchedPid"
);
ActivityManager
am
=
(
ActivityManager
)
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
// Note: getRunningAppProcesses return itself in API 22
if
(
Build
.
VERSION
.
SDK_INT
<
ANDROID_M
)
{
List
<
RunningAppProcessInfo
>
run
=
am
.
getRunningAppProcesses
();
for
(
RunningAppProcessInfo
runningProcess
:
run
)
{
...
...
@@ -208,6 +209,7 @@ public class ProcessInfo {
public
static
String
getTopActivity
(
Context
context
)
{
ActivityManager
manager
=
(
ActivityManager
)
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
// Note: getRunningTasks is deprecated in API 21(Official)
List
<
RunningTaskInfo
>
runningTaskInfos
=
manager
.
getRunningTasks
(
1
);
if
(
runningTaskInfos
!=
null
)
return
(
runningTaskInfos
.
get
(
0
).
topActivity
).
toString
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录