[Bug 4081] New: CPU usage for threads not displayed correctly in top (only with NPTL threads)

bugzilla at busybox.net bugzilla at busybox.net
Wed Aug 24 15:00:50 UTC 2011


           Summary: CPU usage for threads not displayed correctly in top
                    (only with NPTL threads)
           Product: Busybox
           Version: 1.18.x
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: ronald.wahl at raritan.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0

Created attachment 3541
  --> https://bugs.busybox.net/attachment.cgi?id=3541
small test programm

When calling top and enabling the display of threads by pressing 'h' then the
CPU usage for a multi-threaded process is distributed over all threads of the
process equally. For example if I have a process with three threads where one
thread is taking ~100% CPU and the other threads sleep then top shows ~33% CPU
usage for each thread which is plainly wrong. The CPU usage reported for each
thread should reflect the reality.

Checking /proc/<pid>/stat and /proc/<pid>/task/<tid> directly everything is
fine, i.e. /proc/<pid>/stat shows the CPU usage of the whole process including
all threads respective proc/<pid>/task/<tid> shows the CPU usage of each thread

This whole issue exists only when using NPTL threads.

For quick testing you can use the attached test program which starts two extra
threads - one thread eating all cpu time and one thread which is sleeping. The
main thread is sleeping as well.

Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the busybox-cvs mailing list