diff options
Diffstat (limited to 'libps/procstat.c')
-rw-r--r-- | libps/procstat.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libps/procstat.c b/libps/procstat.c index 4cb77473..7b5c2fd5 100644 --- a/libps/procstat.c +++ b/libps/procstat.c @@ -186,10 +186,12 @@ proc_stat_set_flags(proc_stat_t ps, int flags) tbi->system_time.microseconds += bi->system_time.microseconds; } - tsi->base_priority /= pi->nthreads; - tsi->cur_priority /= pi->nthreads; - - tbi->sleep_time /= pi->nthreads; + if (pi->nthreads > 0) + { + tsi->base_priority /= pi->nthreads; + tsi->cur_priority /= pi->nthreads; + tbi->sleep_time /= pi->nthreads; + } tbi->user_time.seconds += tbi->user_time.microseconds / 1000000; tbi->user_time.microseconds %= 1000000; |