[PATCH] /proc/loadavg: add running/total processes

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Mar 30 08:14:00 GMT 2011

On Mar 29 19:32, Yaakov (Cygwin/X) wrote:
> This patch adds the fourth component of Linux's /proc/loadavg[1], the
> current running/total processes count.  My only question is if states
> other than 'O' and 'R' should be considered "running" for this purpose.

That looks right.  But I don't see that get_process_state will ever
generate an 'O'.  Wouldn't that be the difference between StateReady (R)
and StateRunning (O)?

> -  return __small_sprintf (destbuf, "%u.%02u %u.%02u %u.%02u\n",
> -				    0, 0, 0, 0, 0, 0);
> +  return __small_sprintf (destbuf, "%u.%02u %u.%02u %u.%02u %u/%u\n",
> +				    0, 0, 0, 0, 0, 0, running, pids.npids);

What about the last column in /proc/loadavg, the last pid?  Shouldn't
this be added and set to 0 as well?


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list