Dr. Werner Fink 2013-12-17 13:19:30 +00:00 committed by Git OBS Bridge
parent 87ef93990c
commit 0aabce4219
2 changed files with 10 additions and 4 deletions

View File

@ -42,7 +42,7 @@
#define cook_time(P) (P->utime + P->stime) / Hertz
#define cook_etime(P) (((unsigned long long)seconds_since_boot >= (P->start_time / Hertz)) ? ((unsigned long long)seconds_since_boot - (P->start_time / Hertz)) : 0)
+#define cook_jtime(P) (((unsigned long long)jiffies_since_boot >= (P->start_time / Hertz)) ? ((unsigned long long)jiffies_since_boot - (P->start_time / Hertz)) : 0)
+#define cook_jtime(P) (((unsigned long long)jiffies_since_boot >= (P->start_time)) ? ((unsigned long long)jiffies_since_boot - (P->start_time)) : 0)
#define CMP_COOKED_TIME(NAME) \
static int sr_ ## NAME (const proc_t* P, const proc_t* Q) { \
@ -57,7 +57,7 @@
- seconds = cook_etime(pp);
- if(seconds) pcpu = (total_time * 100ULL / Hertz) / seconds;
+ jiffies = cook_jtime(pp);
+ if(jiffies) pcpu = (total_time * 100ULL / Hertz) / jiffies;
+ if(jiffies) pcpu = (total_time * 100ULL) / jiffies;
if (pcpu > 99U) pcpu = 99U;
return snprintf(outbuf, COLWID, "%2u", pcpu);
}
@ -72,7 +72,7 @@
- seconds = cook_etime(pp);
- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds;
+ jiffies = cook_jtime(pp);
+ if(jiffies) pcpu = (total_time * 1000ULL / Hertz) / jiffies;
+ if(jiffies) pcpu = (total_time * 1000ULL) / jiffies;
if (pcpu > 999U)
return snprintf(outbuf, COLWID, "%u", pcpu/10U);
return snprintf(outbuf, COLWID, "%u.%u", pcpu/10U, pcpu%10U);
@ -87,7 +87,7 @@
- seconds = cook_etime(pp);
- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds;
+ jiffies = cook_jtime(pp);
+ if(jiffies) pcpu = (total_time * 1000ULL / Hertz) / jiffies;
+ if(jiffies) pcpu = (total_time * 1000ULL) / jiffies;
if (pcpu > 999U) pcpu = 999U;
return snprintf(outbuf, COLWID, "%3u", pcpu);
}

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Dec 17 13:17:36 UTC 2013 - werner@suse.de
- Change patch procps-ng-3.3.8-accuracy.dif to really use finally
jiffies to calculate %CPU output (bnc#855861)
-------------------------------------------------------------------
Mon Oct 7 13:35:36 UTC 2013 - werner@suse.de