android - Read CPU usage for multi core cpu -
i been trying read cpu usage in application using @szcoder answer how memory usage , cpu usage in android? here @ sof.
his solution used work on samsung galaxy s2 (dual-core cpu), not working on htc 1 m7 quad core.
most of readings (value @szcoder's method*100 i.e percentage cpu usage) either negative, less 10% , few more 100%.
in comment answer dave suggests should use multiple readings accurate value.
can 1 please suggest possible solution problem?
edit :
i tried use fabian knapp's solution uses top -n 1
command determine cpu usage in testing parsing /proc/stat
faster top -n 1
(0.3xx seconds comapred 3.xx seconds) in case 1 suggests it, won't using top command because of time consumption.
if top command gives correct value, suggest @ android's source code top , pull out bit need cpu, takes less time second. can works because did once.
Comments
Post a Comment