This is the mail archive of the cygwin-patches mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Implement getloadavg()

On 17/03/2017 17:50, Jon Turney wrote:
 winsup/cygwin/              |   5 +-
 winsup/cygwin/common.din               |   1 +
 winsup/cygwin/         |  10 ++-
 winsup/cygwin/include/cygwin/stdlib.h  |   4 +
 winsup/cygwin/include/cygwin/version.h |   3 +-
 winsup/cygwin/               | 135 +++++++++++++++++++++++++++++++++
 winsup/doc/posix.xml                   |   1 +
 7 files changed, 154 insertions(+), 5 deletions(-)
 create mode 100644 winsup/cygwin/

Note that this doesn't build for x86 at the moment, due to an issue with pdh.h in w32api (See [1])

Furthermore, there are a few problems with this implementation:

The first time a process calls getloadavg(), it always gets 0 (so 'cat /proc/loadavg' always shows a load of 0). This is a consequence of having no global state, and the fact that we can't measure %CPU instantaneously, only over an interval.

I'm not the only person on the internet who thinks that (%CPU*#cores)+PQL is they way to calculate a load value, and while this gives reasonable values when when the load is between 0 and (number of cores), the PQL seems to get unexpectedly large when CPU is saturated on an otherwise idle system.

e.g. if I saturate the CPU with tasks of "normal" priority, PQL goes to ~20; saturate with tasks of "below normal" priority, PQL goes to ~5, but there isn't actually any real demand there; if the CPU saturating tasks are killed, load drops close to 0. I don't know how to interpret that...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]