Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
No build reason found for images:local
openSUSE:12.2:PowerPC
procps
procps-v3.3.3-accuracy.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File procps-v3.3.3-accuracy.dif of Package procps
--- ps/common.h +++ ps/common.h 2012-06-01 15:30:43.880009972 +0000 @@ -302,6 +302,7 @@ extern int running_only; extern int screen_cols; extern int screen_rows; extern time_t seconds_since_boot; +extern unsigned long long jiffies_since_boot; extern selection_node *selection_list; extern unsigned simple_select; extern sort_node *sort_list; --- ps/global.c +++ ps/global.c 2012-06-01 15:32:10.488010283 +0000 @@ -79,6 +79,7 @@ int prefer_bsd_defaults = -1 int screen_cols = -1; int screen_rows = -1; time_t seconds_since_boot = -1; +unsigned long long jiffies_since_boot = -1; selection_node *selection_list = (selection_node *)0xdeadbeef; unsigned simple_select = 0xffffffff; sort_node *sort_list = (sort_node *)0xdeadbeef; /* ready-to-use sort list */ @@ -369,6 +370,7 @@ static const char *set_personality(void) /************ Call this to reinitialize everything ***************/ void reset_global(void){ static proc_t p; + double uptime_secs; reset_selection_list(); look_up_our_self(&p); set_screen_size(); @@ -392,7 +394,8 @@ void reset_global(void){ negate_selection = 0; page_size = getpagesize(); running_only = 0; - seconds_since_boot = uptime(0,0); + seconds_since_boot = uptime(&uptime_secs,0); + jiffies_since_boot = ((long double)uptime_secs * Hertz); selection_list = NULL; simple_select = 0; sort_list = NULL; --- ps/output.c +++ ps/output.c 2012-06-01 15:40:35.160510179 +0000 @@ -471,11 +471,11 @@ static int pr_etimes(char *restrict cons static int pr_c(char *restrict const outbuf, const proc_t *restrict const pp){ unsigned long long total_time; /* jiffies used by this process */ unsigned pcpu = 0; /* scaled %cpu, 99 means 99% */ - unsigned long long seconds; /* seconds of process life */ + unsigned long long jiffies; /* jiffies of process life */ total_time = pp->utime + pp->stime; if(include_dead_children) total_time += (pp->cutime + pp->cstime); - seconds = seconds_since_boot - pp->start_time / Hertz; - if(seconds) pcpu = (total_time * 100ULL / Hertz) / seconds; + jiffies = jiffies_since_boot - pp->start_time; + if(jiffies) pcpu = (total_time * 100ULL) / jiffies; if (pcpu > 99U) pcpu = 99U; return snprintf(outbuf, COLWID, "%2u", pcpu); } @@ -483,24 +483,24 @@ static int pr_c(char *restrict const out static int pr_pcpu(char *restrict const outbuf, const proc_t *restrict const pp){ unsigned long long total_time; /* jiffies used by this process */ unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */ - unsigned long long seconds; /* seconds of process life */ + unsigned long long jiffies; /* jiffies of process life */ total_time = pp->utime + pp->stime; if(include_dead_children) total_time += (pp->cutime + pp->cstime); - seconds = seconds_since_boot - pp->start_time / Hertz; - if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds; - if (pcpu > 999U) - return snprintf(outbuf, COLWID, "%u", pcpu/10U); + jiffies = jiffies_since_boot - pp->start_time; + if(jiffies) pcpu = (total_time * 1000ULL) / jiffies; + if (pcpu/10U >= 100U) /* do not confuse the user by scale effects */ + return snprintf(outbuf, COLWID, "100"); return snprintf(outbuf, COLWID, "%u.%u", pcpu/10U, pcpu%10U); } /* this is a "per-mill" format, like %cpu with no decimal point */ static int pr_cp(char *restrict const outbuf, const proc_t *restrict const pp){ unsigned long long total_time; /* jiffies used by this process */ unsigned pcpu = 0; /* scaled %cpu, 999 means 99.9% */ - unsigned long long seconds; /* seconds of process life */ + unsigned long long jiffies; /* jiffies of process life */ total_time = pp->utime + pp->stime; if(include_dead_children) total_time += (pp->cutime + pp->cstime); - seconds = seconds_since_boot - pp->start_time / Hertz ; - if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds; + jiffies = jiffies_since_boot - pp->start_time; + if(jiffies) pcpu = (total_time * 1000ULL) / jiffies; if (pcpu > 999U) pcpu = 999U; return snprintf(outbuf, COLWID, "%3u", pcpu); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor