Simpleperf 使用簡單總結(jié)

腳本目錄

1、腳本目錄

D:\Android\SDK\ndk\21.4.7075529\simpleperf

2、在此目錄中右鍵"在終端中打開"

3、輸入命令

python app_profiler.py -p xxxx.android.launcher

PS D:\Android\SDK\ndk\21.4.7075529\simpleperf> python app_profiler.py -p xxx.android.launcher
INFO:root:prepare profiling
INFO:root:start profiling
INFO:root:run adb cmd: ['adb', 'shell', '/data/local/tmp/simpleperf', 'record', '-o', '/data/local/tmp/perf.data', '-e task-clock:u -f 1000 -g --duration 10', '--log', 'info', '--app', 'xxxx.android.launcher']
....
INFO:root:profiling is finished.

4、.data轉(zhuǎn) html

python report_html.py

......
INFO:root:Report generated at 'report.html'.

5、這個(gè)時(shí)候轉(zhuǎn)的report.html打不開的,需要修改一些內(nèi)容
打開html文件
生成的html替換前:

<html><head><link rel="stylesheet" type="text/css" ></link>
<link rel="stylesheet" type="text/css" ></link>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script>google.charts.load('current', {'packages': ['corechart', 'table']});</script>
<style type="text/css">
.colForLine { width: 50px; }
.colForCount { width: 100px; }
.tableCell { font-size: 17px; }
.boldTableCell { font-weight: bold; font-size: 17px; }
</style>
</head>
<body><script>
替換后:

<html><head><link rel="stylesheet" type="text/css" ></link>
<link rel="stylesheet" type="text/css" ></link>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.1.2/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script>google.charts.load('current', {'packages': ['corechart', 'table']});</script>
<style type="text/css">
.colForLine { width: 50px; }
.colForCount { width: 100px; }
.tableCell { font-size: 17px; }
.boldTableCell { font-weight: bold; font-size: 17px; }
</style>
</head>
<body><script>

6、重新打開report.html 就可以看到界面了

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容