diff options
author | Richard Braun <rbraun@sceen.net> | 2014-01-16 23:59:00 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2014-01-16 23:59:00 +0100 |
commit | 9bebcd38f42da289a3eaf9f473a9529f8d3c4664 (patch) | |
tree | f043005ce43b176c57f9b773817381271c217506 /libps/spec.c | |
parent | 9a7776ddef6626536f21c09090b8329168a053ce (diff) | |
download | hurd-9bebcd38f42da289a3eaf9f473a9529f8d3c4664.tar.gz hurd-9bebcd38f42da289a3eaf9f473a9529f8d3c4664.tar.bz2 hurd-9bebcd38f42da289a3eaf9f473a9529f8d3c4664.zip |
libps: fix task/thread times fetching
Introduce PSTAT_TIMES to force the retrieval of both PSTAT_TASK_BASIC
and PSTAT_THREAD_BASIC. Task basic info contain the user and system
times of terminated threads which the code wrongly assumes is always
present along with process info.
* libps/procstat.c (add_preconditions): Set both PSTAT_TASK_BASIC and
PSTAT_THREAD_BASIC as preconditions for PSTAT_TIMES.
(summarize_thread_basic_info): Add terminated threads times only if
task basic info are available.
(set_procinfo_flags): Provide summarize_thread_basic_info with flags of
available info.
(proc_stat_set_flags): Set PSTAT_TIMES as available if it was needed and
any of PSTAT_TASK_BASIC or PSTAT_THREAD_BASIC could be fetched.
* libps/ps.h (PSTAT_TIMES): New macro.
* libps/spec.c (ps_get_usr_time): Indicate the getter needs PSTAT_TIMES
instead of PSTAT_THREAD_BASIC.
(ps_sys_time_getter): Likewise.
(ps_tot_time_getter): Likewise.
Diffstat (limited to 'libps/spec.c')
-rw-r--r-- | libps/spec.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libps/spec.c b/libps/spec.c index 146aba55..d645b825 100644 --- a/libps/spec.c +++ b/libps/spec.c @@ -196,7 +196,7 @@ ps_get_usr_time (struct proc_stat *ps, struct timeval *tv) tv->tv_usec = tvt.microseconds; } const struct ps_getter ps_usr_time_getter = -{"usr_time", PSTAT_THREAD_BASIC, ps_get_usr_time}; +{"usr_time", PSTAT_TIMES, ps_get_usr_time}; static void ps_get_sys_time (struct proc_stat *ps, struct timeval *tv) @@ -206,7 +206,7 @@ ps_get_sys_time (struct proc_stat *ps, struct timeval *tv) tv->tv_usec = tvt.microseconds; } const struct ps_getter ps_sys_time_getter = -{"sys_time", PSTAT_THREAD_BASIC, ps_get_sys_time}; +{"sys_time", PSTAT_TIMES, ps_get_sys_time}; static void ps_get_tot_time (struct proc_stat *ps, struct timeval *tv) @@ -217,7 +217,7 @@ ps_get_tot_time (struct proc_stat *ps, struct timeval *tv) tv->tv_usec = tvt.microseconds; } const struct ps_getter ps_tot_time_getter = -{"tot_time", PSTAT_THREAD_BASIC, ps_get_tot_time}; +{"tot_time", PSTAT_TIMES, ps_get_tot_time}; static void ps_get_start_time (struct proc_stat *ps, struct timeval *tv) |