handle large values for process time

This commit is contained in:
Hisham Muhammad 2011-03-28 19:06:06 +00:00
parent 391eab2866
commit 219bb9ccff
4 changed files with 12 additions and 11 deletions

View File

@ -103,10 +103,10 @@ typedef struct Process_ {
unsigned long int majflt; unsigned long int majflt;
unsigned long int cmajflt; unsigned long int cmajflt;
#endif #endif
unsigned long int utime; unsigned long long int utime;
unsigned long int stime; unsigned long long int stime;
long int cutime; unsigned long long int cutime;
long int cstime; unsigned long long int cstime;
long int priority; long int priority;
long int nice; long int nice;
long int nlwp; long int nlwp;
@ -263,7 +263,7 @@ static void Process_printLargeNumber(Process* this, RichString* str, unsigned lo
static double jiffy = 0.0; static double jiffy = 0.0;
static void Process_printTime(RichString* str, unsigned long t) { static void Process_printTime(RichString* str, unsigned long long t) {
if(jiffy == 0.0) jiffy = sysconf(_SC_CLK_TCK); if(jiffy == 0.0) jiffy = sysconf(_SC_CLK_TCK);
double jiffytime = 1.0 / jiffy; double jiffytime = 1.0 / jiffy;

View File

@ -105,10 +105,10 @@ typedef struct Process_ {
unsigned long int majflt; unsigned long int majflt;
unsigned long int cmajflt; unsigned long int cmajflt;
#endif #endif
unsigned long int utime; unsigned long long int utime;
unsigned long int stime; unsigned long long int stime;
long int cutime; unsigned long long int cutime;
long int cstime; unsigned long long int cstime;
long int priority; long int priority;
long int nice; long int nice;
long int nlwp; long int nlwp;

View File

@ -344,7 +344,7 @@ static bool ProcessList_readStatFile(Process *process, const char* dirname, cons
"%c %d %u %u %u " "%c %d %u %u %u "
"%d %lu " "%d %lu "
"%*u %*u %*u %*u " "%*u %*u %*u %*u "
"%lu %lu %ld %ld " "%llu %llu %llu %llu "
"%ld %ld %ld " "%ld %ld %ld "
"%*d %*u %*u %*d %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u " "%*d %*u %*u %*d %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u %*u "
"%d %d", "%d %d",

3
htop.c
View File

@ -427,8 +427,9 @@ int main(int argc, char** argv) {
refreshTimeout--; refreshTimeout--;
if (prev == ch && !recalculate) { if (prev == ch && !recalculate) {
closeTimeout++; closeTimeout++;
if (closeTimeout == 10) if (closeTimeout == 100) {
break; break;
}
} else } else
closeTimeout = 0; closeTimeout = 0;
continue; continue;