1

我正在尝试测量 Micromax C4 设备中每个内核的 CPU 利用率(以 % 为单位)。我无法cpu_utilization/sys/devices/system/cpu/cpu0/cpufreq.

有谁知道如何cpu_utilization在 C4 中找到该文件,或者任何相关文件可以提供每个内核的 CPU 利用率百分比?

等待答复。任何人的任何输入???

4

1 回答 1

3

I am not sure if there is any file which will be able to directly report the percentage CPU utilization but you can use /proc/stat to calculate the CPU utilization.

adb shell cat /proc/stat gives the following output


cpu 22251 758 19056 1170320 2786 0 243

cpu0 13628 401 14782 275769 1645 0 237

cpu1 4712 147 2394 295111 622 0 5

cpu2 2451 116 1149 298977 291 0 1

cpu3 1460 94 731 300463 228 0 0

intr 724661 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 184059 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 337 0 0 0 0 0 0 0 0 0 0 0 14401 0 0 21902 0 0 6 0 0 0 0 0 0 0 0 0 0 48850 175 0 0 0 0 0 0 0 0 0 0 0 0 2901 16819 5708 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8879 0 31124 0 0 0 0 5431 0 579 0 5 0 0 0 0 0 15043 0 0 0 0 0 6644 328 13085 0 6779 0 70695 1279 47348 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 6290 0 890 0 0 0 0 6 0 0 0 0 0 0 0 0 16846 0 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10519 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3158 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 4 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

ctxt 1806341

btime 1378286111

processes 8249

procs_running 3

procs_blocked 0

softirq 323561 207 115027 207 2024 207 207 56793 19244 45 129600


first five lines are of interest. The first line represents the total time spent by all of the cores in different operating modes since boot and it is the aggregate of lines (cpu0/cpu1/cpu2/cpu3). The lines after the first correspond to the time spents in different modes by individual cores.

The meanings of the columns are as follows, from left to right:

user: normal processes executing in user mode

nice: niced processes executing in user mode

system: processes executing in kernel mode

idle: twiddling thumbs

iowait: waiting for I/O to complete

irq: servicing interrupts

softirq: servicing softirqs

Now CPU Utilization since boot = (user + nice + system +iowait + irq + softirq) / (user + nice + system +iowait + irq + softirq + idle)

Check this aswell: http://www.linuxhowtos.org/System/procstat.htm

于 2013-09-04T10:09:29.553 回答