Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
4acfae84
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4acfae84
编写于
9月 03, 2018
作者:
李
李寅
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add simpleperf tool
上级
3a316eb4
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
82 addition
and
15 deletion
+82
-15
tools/bazel_adb_run.py
tools/bazel_adb_run.py
+7
-1
tools/sh_commands.py
tools/sh_commands.py
+75
-14
未找到文件。
tools/bazel_adb_run.py
浏览文件 @
4acfae84
...
...
@@ -110,6 +110,11 @@ def parse_args():
'--address_sanitizer'
,
action
=
"store_true"
,
help
=
"Whether to enable AddressSanitizer"
)
parser
.
add_argument
(
"--simpleperf"
,
type
=
str2bool
,
default
=
False
,
help
=
"Whether to use simpleperf stat"
)
return
parser
.
parse_known_args
()
...
...
@@ -151,7 +156,8 @@ def main(unused_args):
vlog_level
=
0
,
device_bin_path
=
"/data/local/tmp/mace"
,
out_of_range_check
=
True
,
address_sanitizer
=
FLAGS
.
address_sanitizer
)
address_sanitizer
=
FLAGS
.
address_sanitizer
,
simpleperf
=
FLAGS
.
simpleperf
)
device_properties
=
sh_commands
.
adb_getprop_by_serialno
(
serialno
)
globals
()[
FLAGS
.
stdout_processor
](
stdouts
,
device_properties
,
...
...
tools/sh_commands.py
浏览文件 @
4acfae84
...
...
@@ -199,7 +199,8 @@ def adb_run(abi,
vlog_level
=
0
,
device_bin_path
=
"/data/local/tmp/mace"
,
out_of_range_check
=
True
,
address_sanitizer
=
False
):
address_sanitizer
=
False
,
simpleperf
=
False
):
host_bin_full_path
=
"%s/%s"
%
(
host_bin_path
,
bin_name
)
device_bin_full_path
=
"%s/%s"
%
(
device_bin_path
,
bin_name
)
props
=
adb_getprop_by_serialno
(
serialno
)
...
...
@@ -219,12 +220,41 @@ def adb_run(abi,
adb_push
(
find_asan_rt_library
(
abi
),
device_bin_path
,
serialno
)
ld_preload
=
"LD_PRELOAD=%s/%s"
%
(
device_bin_path
,
asan_rt_library_names
(
abi
)),
opencl_profiling
=
1
if
opencl_profiling
else
0
out_of_range_check
=
1
if
out_of_range_check
else
0
print
(
"Run %s"
%
device_bin_full_path
)
stdout_buff
=
[]
process_output
=
make_output_processor
(
stdout_buff
)
if
simpleperf
:
adb_push
(
find_simpleperf_library
(
abi
),
device_bin_path
,
serialno
)
simpleperf_cmd
=
"%s/simpleperf"
%
device_bin_path
sh
.
adb
(
"-s"
,
serialno
,
"shell"
,
ld_preload
,
"MACE_OUT_OF_RANGE_CHECK=%d"
%
out_of_range_check
,
"MACE_OPENCL_PROFILING=%d"
%
opencl_profiling
,
"MACE_CPP_MIN_VLOG_LEVEL=%d"
%
vlog_level
,
simpleperf_cmd
,
"stat"
,
"--group"
,
"raw-l1-dcache,raw-l1-dcache-refill"
,
"--group"
,
"raw-l2-dcache,raw-l2-dcache-refill"
,
"--group"
,
"raw-l1-dtlb,raw-l1-dtlb-refill"
,
"--group"
,
"raw-l2-dtlb,raw-l2-dtlb-refill"
,
device_bin_full_path
,
args
,
_tty_in
=
True
,
_out
=
process_output
,
_err_to_out
=
True
)
else
:
sh
.
adb
(
"-s"
,
serialno
,
...
...
@@ -269,6 +299,37 @@ def find_asan_rt_library(abi, asan_rt_path=''):
return
"%s/%s"
%
(
asan_rt_path
,
asan_rt_library_names
(
abi
))
def
simpleperf_abi_dir_names
(
abi
):
simpleperf_dir_names
=
{
"armeabi-v7a"
:
"arm"
,
"arm64-v8a"
:
"arm64"
,
}
return
simpleperf_dir_names
[
abi
]
def
find_simpleperf_library
(
abi
,
simpleperf_path
=
''
):
if
not
simpleperf_path
:
find_path
=
os
.
environ
[
'ANDROID_NDK_HOME'
]
candidates
=
split_stdout
(
sh
.
find
(
find_path
,
"-name"
,
"simpleperf"
))
if
len
(
candidates
)
==
0
:
common
.
MaceLogger
.
error
(
"Toolchain"
,
"Can't find Simpleperf runtime library in % s"
%
find_path
)
found
=
False
for
candidate
in
candidates
:
if
candidate
.
find
(
simpleperf_abi_dir_names
(
abi
)
+
"/"
)
!=
-
1
:
found
=
True
return
candidate
if
not
found
:
common
.
MaceLogger
.
error
(
"Toolchain"
,
"Can't find Simpleperf runtime library in % s"
%
find_path
)
return
"%s/simpleperf"
%
simpleperf_path
################################
# bazel commands
################################
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录