NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/51937: getrusage(2) should supply blocking time



>Number:         51937
>Category:       kern
>Synopsis:       getrusage(2) should supply blocking time
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 01 22:50:00 +0000 2017
>Originator:     David A. Holland
>Release:        NetBSD 7.99.44 (details irrelevant)
>Organization:
>Environment:
System: NetBSD macaran 7.99.44 NetBSD 7.99.44 (MACARAN) #40: Thu Dec 8 17:57:53 EST 2016 dholland@macaran:/usr/src/sys/arch/amd64/compile/MACARAN amd64
Architecture: x86_64
Machine: amd64
>Description:

getrusage(2) supplies the time spent executing in userspace and in the
kernel. One can, and time(1) does, readily supplement that with the
total elapsed wall clock time.

Historically people often compare the elapsed wall lcock time to the
execution time to figure out how much time is spent waiting in the
kernel. This has never been a particularly reliable method to begin
with, and with a multithreaded process it breaks down entirely.

In a multithreaded process the total execution time reported is the
sum over all threads, but unless you know how many cores were running
those threads *and* the history of thread migration between cores,
which you don't, you can't deduce how much time was spent waiting.

If you pin every thread to a core you might be able to reconstruct
some information, but that (a) isn't always possible, (b) isn't always
advisable, and (c) seems chancy.

It ought to be straightforward for the kernel to collect and report
wait times; it just doesn't.

>How-To-Repeat:
n/a
>Fix:
bikeshed first, then code away



Home | Main Index | Thread Index | Old Index