[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Question: different process's %cpu output via top from busybox and procps-ng
From: Jie Zhang <wangyoucao577 () gmail ! com>
Date: 2016-12-16 3:03:55
Message-ID: CANzmr8hbiLBXmEV9dxVHJ3m_jOVc4JhA70smShNzN5ZDjm5k3Q () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hello everyone,
I have an `Embedded Linux(Kernel 2.6.37)` running on `ARM`. There's a
default `top` from `busybox 1.13.2`. And I build a `procps-ng 3.3.11` via
cross compile to run on this `Linux`. I found that the process's `%cpu` via
`top` output from `busybox` and `procps-ng` are different.
For example, the `%cpu` of one process, `procps-ng top` display about 30%,
but `busybox top` display only about 10%. The total `%cpu` from `procps-ng
top` and `busybox top` are the same.
Then I read the calculation source code of `busybox` and `procps-ng`. I
found that they really have different calculation formula for one process's
`%cpu`.
<pre><code>
- busybox top:
CPU% = s->pcpu/sum(s->pcpu) * busy_cpu_ticks/total_cpu_ticks
(pcpu is delta of sys+user time between samples)
- procps-ng top:
CPU% = s->pcpu/total_cpu_ticks
</code></pre>
Why the two projects choose different calculation formula? Do they designed
for different application case?
Looking forward to your reply.
Thanks very much!
[Attachment #5 (text/html)]
<div dir="ltr"><div class="gmail_default" \
style="font-family:verdana,sans-serif;font-size:small;color:#000000">Hello everyone, \
<br></div><div class="gmail_quote"><div dir="ltr"><div><font color="#000000" \
face="verdana, sans-serif"><br></font></div><div><font color="#000000" face="verdana, \
sans-serif">I have an `Embedded Linux(Kernel 2.6.37)` running on `ARM`. There's a \
default `top` from `busybox 1.13.2`. And I build a `procps-ng 3.3.11` via cross \
compile to run on this `Linux`. I found that the process's `%cpu` via `top` \
output from `busybox` and `procps-ng` are different. </font></div><div><font \
color="#000000" face="verdana, sans-serif"><br></font></div><div><font \
color="#000000" face="verdana, sans-serif">For example, the `%cpu` of one process, \
`procps-ng top` display about 30%, but `busybox top` display only about 10%. The \
total `%cpu` from `procps-ng top` and `busybox top` are the same. \
</font></div><div><font color="#000000" face="verdana, sans-serif">Then I read the \
calculation source code of `busybox` and `procps-ng`. I found that they really have \
different calculation formula for one process's `%cpu`. </font></div><div><font \
color="#000000" face="verdana, sans-serif"><br></font></div><div><font \
color="#000000" face="verdana, \
sans-serif"><pre><code></font></div><div><font color="#000000" \
face="verdana, sans-serif">- busybox top: </font></div><div><font color="#000000" \
face="verdana, sans-serif"> CPU% = s->pcpu/sum(s->pcpu) * \
busy_cpu_ticks/total_cpu_ticks </font></div><div><font color="#000000" \
face="verdana, sans-serif"> (pcpu is delta of sys+user time between samples) \
</font></div><div><font color="#000000" face="verdana, \
sans-serif"><br></font></div><div><font color="#000000" face="verdana, sans-serif">- \
procps-ng top: </font></div><div><font color="#000000" face="verdana, sans-serif"> \
CPU% = s->pcpu/total_cpu_ticks </font></div><div><font color="#000000" \
face="verdana, sans-serif"></code></pre></font></div><div><font \
color="#000000" face="verdana, sans-serif"><br></font></div><div><font \
color="#000000" face="verdana, sans-serif">Why the two projects choose different \
calculation formula? Do they designed for different application case? \
</font></div><div><font color="#000000" face="verdana, \
sans-serif"><br></font></div><div><font color="#000000" face="verdana, \
sans-serif"><br></font></div><div><font color="#000000" face="verdana, \
sans-serif">Looking forward to your reply. </font></div><div><font color="#000000" \
face="verdana, sans-serif">Thanks very much!</font></div></div> </div><br></div>
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic