mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
* fhandler_proc.cc (format_proc_loadavg): Add running/total
processes as fourth component of output. * fhandler_process.cc (get_process_state): Make non-static. Add FIXME about generating an 'O' flag.
This commit is contained in:
parent
40afcae356
commit
9ca65531e0
@ -1,3 +1,10 @@
|
||||
2011-04-01 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
|
||||
|
||||
* fhandler_proc.cc (format_proc_loadavg): Add running/total
|
||||
processes as fourth component of output.
|
||||
* fhandler_process.cc (get_process_state): Make non-static.
|
||||
Add FIXME about generating an 'O' flag.
|
||||
|
||||
2011-04-01 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* fhandler_random.cc (fhandler_dev_random::crypt_gen_random):
|
||||
|
@ -374,9 +374,21 @@ format_proc_version (void *, char *&destbuf)
|
||||
static _off64_t
|
||||
format_proc_loadavg (void *, char *&destbuf)
|
||||
{
|
||||
extern int get_process_state (DWORD dwProcessId);
|
||||
unsigned running = 0;
|
||||
winpids pids ((DWORD) 0);
|
||||
|
||||
for (unsigned i = 0; i < pids.npids; i++)
|
||||
switch (get_process_state (i)) {
|
||||
case 'O':
|
||||
case 'R':
|
||||
running++;
|
||||
break;
|
||||
}
|
||||
|
||||
destbuf = (char *) crealloc_abort (destbuf, 16);
|
||||
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);
|
||||
}
|
||||
|
||||
static _off64_t
|
||||
|
@ -79,8 +79,7 @@ static const virt_tab_t process_tab[] =
|
||||
|
||||
static const int PROCESS_LINK_COUNT =
|
||||
(sizeof (process_tab) / sizeof (virt_tab_t)) - 1;
|
||||
|
||||
static int get_process_state (DWORD dwProcessId);
|
||||
int get_process_state (DWORD dwProcessId);
|
||||
static bool get_mem_values (DWORD dwProcessId, unsigned long *vmsize,
|
||||
unsigned long *vmrss, unsigned long *vmtext,
|
||||
unsigned long *vmdata, unsigned long *vmlib,
|
||||
@ -928,7 +927,7 @@ format_process_mounts (void *data, char *&destbuf)
|
||||
return len;
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
get_process_state (DWORD dwProcessId)
|
||||
{
|
||||
/*
|
||||
@ -975,6 +974,7 @@ get_process_state (DWORD dwProcessId)
|
||||
state = 'S';
|
||||
for (unsigned i = 0; i < sp->ThreadCount; i++)
|
||||
{
|
||||
/* FIXME: at some point we should consider generating 'O' */
|
||||
if (st->State == StateRunning ||
|
||||
st->State == StateReady)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user