idlestat 工具在Android上的使用

本文介绍了一个用于跟踪和分析CPU空闲状态的工具idlestat。详细解释了如何从GitHub获取源代码并进行编译,提供了使用该工具的具体命令示例及输出结果解析。此外,还提到了如何结合systrace来诊断CPU调度问题。
部署运行你感兴趣的模型镜像

1. idlestat 工具source code地址在github上面:https://github.com/samarxie/cpuidle/tree/master/idlestat

2. github上面写的很清楚,怎么编译的(可能会编译出错,因为很多系统都存在cpuhotplug目录,所以在遍历的时候需要将此目录过滤掉,文件为topology.c)如下:

        if(!strcmp(direntp->d_name, "cpuhotplug"))
            continue;

3.  使用方法很简单,如下:

Usage:
Trace mode:
	idlestat --trace -f|--trace-file <filename> -b|--baseline-trace <filename> -o|--output-file <filename> -t|--duration <seconds> -r|--report-format <format> -C|--csv-report -B|--boxless-report -c|--idle -p|--frequency -w|--wakeup
Reporting mode:
	idlestat --import -f|--trace-file <filename> -b|--baseline-trace <filename> -r|--report-format <format> -C|--csv-report -B|--boxless-report -o|--output-file <filename>

Examples:
1. Run a trace, post-process the results (default is to show only C-state statistics):
	sudo ./idlestat --trace -f /tmp/mytrace -t 10

2. Run a trace, post-process the results and print all statistics:
	sudo ./idlestat --trace -f /tmp/mytrace -t 10 -p -c -w

3. Run a trace with an external workload, post-process the results:
	sudo ./idlestat --trace -f /tmp/mytrace -t 10 -p -c -w -- rt-app /tmp/mp3.json

4. Post-process a trace captured earlier:
	./idlestat --import -f /tmp/mytrace

5. Run a trace, post-process the results and print all statistics into a file:
	sudo ./idlestat --trace -f /tmp/mytrace -t 10 -p -c -w -o /tmp/myreport

6. Run a comparison trace, say, before and after making changes to system behaviour
	sudo ./idlestat --trace -f /tmp/baseline -t 10
	sudo ./idlestat --trace -f /tmp/changedstate -t 10
	./idlestat --import -f /tmp/changedstate -b /tmp/baseline -r comparison

Report formats supported: default boxless csv comparison

4. 执行命令之后可以看到如下信息(./idlestat --trace -f trace.txt -p -c -t 10):

./idlestat --trace -f trace.txt -p -c -t 10                                                                                                                                              
failed to open '/sys/devices/system/cpu/cpuhotplug/dynamic_load_disable': m
failed to open '/sys/devices/system/cpu/cpuhotplug/dynamic_load_disable': m
Log is 10.010598 secs long with 30063 events
--------------------------------------------------------------------------------
| C-state  |   min    |   max    |   avg    |   total  | hits  |  over | under |
--------------------------------------------------------------------------------
| clusterA                                                                     |
--------------------------------------------------------------------------------
|      WFI |      1us |   8.19ms |   1.02ms |    3.72s |  3629 |     1 |   261 |
|  core_pd |    589us |   8.18ms |   6.49ms |    4.41s |   680 |    27 |     0 |
--------------------------------------------------------------------------------
|             cpu0                                                             |
--------------------------------------------------------------------------------
|      WFI |      5us |  10.48ms |   1.54ms |    3.64s |  2361 |     0 |   844 |
|  core_pd |    810us |   9.76ms |   6.60ms |    5.08s |   769 |    52 |     0 |
--------------------------------------------------------------------------------
|             cpu1                                                             |
--------------------------------------------------------------------------------
|      WFI |      3us |  21.13ms |   1.75ms |    3.23s |  1847 |     0 |   691 |
|  core_pd |    516us |  24.75ms |   7.60ms |    5.97s |   785 |    49 |     0 |
--------------------------------------------------------------------------------
|             cpu2                                                             |
--------------------------------------------------------------------------------
|      WFI |      3us |  21.49ms |   2.02ms |    2.32s |  1149 |     0 |   722 |
|  core_pd |     82us |  50.64ms |   9.89ms |    7.24s |   732 |    25 |     0 |
--------------------------------------------------------------------------------
|             cpu3                                                             |
--------------------------------------------------------------------------------
|      WFI |      4us |  65.09ms |   1.90ms | 613.13ms |   323 |     0 |   145 |
|  core_pd |    545us | 604.06ms |  62.26ms |    9.21s |   148 |    11 |     0 |
--------------------------------------------------------------------------------
| clusterB                                                                     |
--------------------------------------------------------------------------------
|      WFI |     30us |   5.03ms |   2.35ms | 131.60ms |    56 |     0 |    31 |
|  core_pd |    292us |    2.70s | 491.48ms |    9.83s |    20 |     3 |     0 |
--------------------------------------------------------------------------------
|             cpu4                                                             |
--------------------------------------------------------------------------------
|      WFI |     30us |   5.03ms |   2.70ms |  94.57ms |    35 |     0 |    24 |
|  core_pd |   3.06ms |    2.70s | 705.80ms |    9.88s |    14 |     0 |     0 |
--------------------------------------------------------------------------------
|             cpu5                                                             |
--------------------------------------------------------------------------------
|      WFI |   1.04ms |   3.95ms |   2.85ms |  22.78ms |     8 |     0 |     5 |
|  core_pd |    1.04s |    4.00s |    2.49s |    9.97s |     4 |     0 |     0 |
--------------------------------------------------------------------------------
|             cpu6                                                             |
--------------------------------------------------------------------------------
|      WFI |   2.50ms |   2.51ms |   2.50ms |   7.51ms |     3 |     0 |     2 |
|  core_pd |    2.46s |    4.00s |    3.33s |   10.00s |     3 |     0 |     0 |
--------------------------------------------------------------------------------
|             cpu7                                                             |
--------------------------------------------------------------------------------
|      WFI |   2.50ms |   3.96ms |   3.07ms |  21.47ms |     7 |     0 |     3 |
|  core_pd |   2.37ms |    4.00s |    2.50s |    9.98s |     4 |     1 |     0 |
--------------------------------------------------------------------------------

----------------------------------------------------------------
| P-state  |   min    |   max    |   avg    |   total  | hits  |
----------------------------------------------------------------
| clusterA                                                     |
----------------------------------------------------------------
| 768.00MHz |    136us |    2.35s |  87.44ms |    9.44s |   108 |
| 884.00MHz |    475us |   9.01ms |   2.09ms |  52.19ms |    25 |
|  1.00GHz |    475us |   8.69ms |   2.35ms |  63.54ms |    27 |
|  1.10GHz |    452us |   5.04ms |   1.35ms |  26.91ms |    20 |
|  1.20GHz |    439us |  23.97ms |   3.84ms | 425.71ms |   111 |
----------------------------------------------------------------
|             cpu0                                             |
----------------------------------------------------------------
| 768.00MHz |      6us |  11.62ms |    328us | 942.43ms |  2877 |
| 884.00MHz |     15us |   7.39ms |    346us |  24.23ms |    70 |
|  1.00GHz |     13us |   4.05ms |    386us |  24.68ms |    64 |
|  1.10GHz |     13us |   1.89ms |    339us |  15.61ms |    46 |
|  1.20GHz |     11us |  23.96ms |    860us | 293.19ms |   341 |
----------------------------------------------------------------
|             cpu1                                             |
----------------------------------------------------------------
| 768.00MHz |      5us |   8.02ms |    233us | 562.44ms |  2416 |
| 884.00MHz |     25us |   2.09ms |    485us |  22.30ms |    46 |
|  1.00GHz |     18us |   3.78ms |    520us |  24.94ms |    48 |
|  1.10GHz |     22us |   2.26ms |    514us |  16.98ms |    33 |
|  1.20GHz |     18us |  12.00ms |    552us | 183.86ms |   333 |
----------------------------------------------------------------
|             cpu2                                             |
----------------------------------------------------------------
| 768.00MHz |     15us |   2.62ms |    159us | 265.49ms |  1672 |
| 884.00MHz |     22us |   1.95ms |    280us |  12.62ms |    45 |
|  1.00GHz |     20us |   7.20ms |    565us |  25.44ms |    45 |
|  1.10GHz |     19us |   2.63ms |    297us |  10.39ms |    35 |
|  1.20GHz |      1us |  15.12ms |    473us | 136.33ms |   288 |
----------------------------------------------------------------
|             cpu3                                             |
----------------------------------------------------------------
| 768.00MHz |      2us |   2.61ms |    171us |  51.47ms |   301 |
| 884.00MHz |     25us |   3.74ms |    424us |  11.88ms |    28 |
|  1.00GHz |     22us |   4.00ms |    448us |  16.57ms |    37 |
|  1.10GHz |     24us |   1.15ms |    299us |   7.77ms |    26 |
|  1.20GHz |      9us |  13.04ms |    489us |  94.77ms |   194 |
----------------------------------------------------------------
| clusterB                                                     |
----------------------------------------------------------------
| 768.00MHz |   1.98ms |    2.47s | 506.39ms |    2.53s |     5 |
|  1.05GHz |   7.95ms |    2.72s |    1.36s |    2.73s |     2 |
|  1.50GHz |  12.01ms |    2.46s | 841.98ms |    2.53s |     3 |
|  1.57GHz |    2.23s |    2.23s |    2.23s |    2.23s |     1 |
----------------------------------------------------------------
|             cpu4                                             |
----------------------------------------------------------------
| 768.00MHz |     24us |   6.74ms |    333us |  13.67ms |    41 |
|  1.05GHz |     73us |   1.21ms |    577us |   4.04ms |     7 |
|  1.40GHz |  11.52ms |  11.52ms |  11.52ms |  11.52ms |     1 |
|  1.50GHz |     34us |   2.89ms |    557us |   7.80ms |    14 |
|  1.57GHz |     17us |    172us |     84us |    251us |     3 |
----------------------------------------------------------------
|             cpu5                                             |
----------------------------------------------------------------
| 768.00MHz |     24us |   7.46ms |    734us |   8.80ms |    12 |
|  1.57GHz |  10.59ms |  10.59ms |  10.59ms |  10.59ms |     1 |
----------------------------------------------------------------
|             cpu6                                             |
----------------------------------------------------------------
| 768.00MHz |     26us |   8.17ms |   1.47ms |   8.82ms |     6 |
|  1.50GHz |     22us |    215us |    119us |    237us |     2 |
----------------------------------------------------------------
|             cpu7                                             |
----------------------------------------------------------------
| 768.00MHz |     21us |   9.19ms |    922us |  11.06ms |    12 |
----------------------------------------------------------------

------------------------------------------------------------------------------------------------------------
| clusterA | 768.00MHz | 884.00MHz |   1.00GHz |   1.10GHz |   1.20GHz | P-State   | C-State   |
------------------------------------------------------------------------------------------------------------
| cpu0     |     9.411%|     0.242%|     0.246%|     0.156%|     2.928%|    12.983%|    87.017%|
| cpu1     |     5.617%|     0.223%|     0.249%|     0.170%|     1.836%|     8.094%|    91.906%|
| cpu2     |     2.653%|     0.126%|     0.254%|     0.104%|     1.362%|     4.499%|    95.501%|
| cpu3     |     0.514%|     0.119%|     0.166%|     0.078%|     0.947%|     1.823%|    98.177%|
------------------------------------------------------------------------------------------------------------
| clusterB | 768.00MHz |   1.05GHz |   1.40GHz |   1.50GHz |   1.57GHz | P-State   | C-State   |
------------------------------------------------------------------------------------------------------------
| cpu4     |     0.137%|     0.040%|     0.115%|     0.078%|     0.003%|     0.372%|    99.628%|
| cpu5     |     0.088%|     0.000%|     0.000%|     0.000%|     0.106%|     0.194%|    99.806%|
| cpu6     |     0.088%|     0.000%|     0.000%|     0.002%|     0.000%|     0.090%|    99.910%|
| cpu7     |     0.110%|     0.000%|     0.000%|     0.000%|     0.000%|     0.110%|    99.890%|
------------------------------------------------------------------------------------------------------------

5.  可以配合systrace抓取cpu schedule信息,查找schedule问题,cpu运行问题。

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

apt remove accountsservice at-spi2-core autoconf automake autopoint \ autotools-dev bubblewrap build-essential calf-plugins can-utils \ check cmake cmake-data cpp cpp-13 \ cpp-13-aarch64-linux-gnu cpp-aarch64-linux-gnu cups cups-client cups-common \ cups-core-drivers cups-daemon cups-filters cups-filters-core-drivers cups-ipp-utils \ cups-ppdc cups-server-common debhelper debugedit devscripts \ dh-autoreconf dh-exec dh-make dh-strip-nondeterminism diffstat \ dnsmasq-base docutils-common dwz evolution-data-server-common extra-cmake-modules \ feh flex freeglut3-dev fuse3 g++ \ g++-13 g++-13-aarch64-linux-gnu g++-aarch64-linux-gnu gcc-13 gcc-13-aarch64-linux-gnu \ gcc-13-base gcc-aarch64-linux-gnu gdal-data gdal-plugins gdisk \ ghostscript gir1.2-atspi-2.0 gir1.2-camel-1.2 gir1.2-ebackend-1.2 gir1.2-ebook-1.2 \ gir1.2-ebookcontacts-1.2 gir1.2-edatabook-1.2 gir1.2-edataserver-1.2 gir1.2-freedesktop gir1.2-freedesktop-dev \ gir1.2-gudev-1.0 gir1.2-ibus-1.0 gir1.2-ical-3.0 gir1.2-json-1.0 gir1.2-secret-1 \ gir1.2-snapd-2 gir1.2-soup-3.0 gir1.2-udisks-2.0 git git-man \ glibc-doc glibc-doc-reference gobject-introspection gobject-introspection-bin graphviz \ grim grimshot gstreamer1.0-gtk3 gstreamer1.0-plugins-ugly hardinfo \ hsetroot ibverbs-providers icu-devtools idlestat iperf \ iptables iw javascript-common jq libabsl20220623t64 \ libaccountsservice0 libaec0 libaliased-perl libann0 libapparmor-dev \ libarchive-zip-perl libarmadillo12 libarpack2t64 libasan8 libasound2-dev \ libasyncns-dev libatk-bridge2.0-dev libatk1.0-dev libatomic1 libatspi2.0-dev \ libaudit-dev libavahi-client-dev libavahi-common-dev libavcodec-dev libavformat-dev \ libavutil-dev libb-hooks-endofscope-perl libb-hooks-op-check-perl libberkeleydb-perl libblosc1 \ libbluetooth-dev libbrotli-dev libbs2b-dev libbz2-dev libcamel-1.2-64t64 \ libcamel1.2-dev libcanberra-dev libcap-dev libcap-ng-dev libcapture-tiny-perl \ libcc1-0 libcdio19t64 libcdt5 libcfitsio10t64 libcgi-pm-perl \ libcgraph6 libcharls2 libclang-18-dev libclang-common-18-dev libclang-dev \ libclang1-15t64 libclass-data-inheritable-perl libclass-method-modifiers-perl libclass-xsaccessor-perl libconfig-tiny-perl \ libconst-fast-perl libcpanel-json-xs-perl libcpdb-frontend2t64 libcpdb2t64 libcupsfilters2-common \ libcupsfilters2t64 libdata-dpath-perl libdata-messagepack-perl libdata-optlist-perl libdata-validate-domain-perl \ libdata-validate-ip-perl libdata-validate-uri-perl libdatrie-dev libdb-dev libdb5.3-dev \ libdbus-1-dev libdbus-glib-1-2 libdbus-glib-1-dev libdbus-glib-1-dev-bin libdc1394-dev \ libdebhelper-perl libdecor-0-dev libdeflate-dev libdevel-callchecker-perl libdevel-size-perl \ libdevel-stacktrace-perl libdmx-dev libdmx1 libdpkg-perl libdrm-dev \ libdrm-etnaviv1 libdrm-freedreno1 libdrm-nouveau2 libdrm-radeon1 libdrm-tegra0 \ libdw-dev libdynaloader-functions-perl libebackend-1.2-11t64 libebackend1.2-dev libebook-1.2-21t64 \ libebook-contacts-1.2-4t64 libebook-contacts1.2-dev libebook1.2-dev libebur128-dev libedata-book-1.2-27t64 \ libedata-book1.2-dev libedataserver-1.2-27t64 libedataserver1.2-dev libegl-dev libelf-dev \ libell-dev libell0 libemail-address-xs-perl libepoxy-dev liberror-perl \ yudit-common xdg-desktop-portal xorg-sgml-doctools xserver-xorg-dev xtrans-dev \qttools5-dev \ \-qtquick-window2 qml-module-qtquick2 \ Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: libegl1 : Depends: libegl-mesa0 but it is not going to be installed libgbm1 : Depends: mesa-libgallium (= 24.2.8-1ubuntu1~24.04.1) but it is not going to be installed E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
最新发布
09-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值