Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.2
procinfo
procinfo-float.dif
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File procinfo-float.dif of Package procinfo
--- procinfo.c +++ procinfo.c 2007-07-30 16:53:29.249722825 +0200 @@ -186,7 +186,7 @@ first_page (long sl) the DIFF macro, so that we'll end up with nice multiples of 4 when using the -d option. */ -#define rate (sl>1000000 ? sl/1000000 : 1) +#define rate (sl>1000000 ? (float)(sl/1000000) : (float)1.0) printf ("Mem: %12ld%12ld%12ld%12ld%12ld", DIFF (m_to), DIFF (m_us), DIFF (m_fr), DIFF (m_sh), DIFF (m_bu)); if (have_m_c) @@ -1059,9 +1206,11 @@ then = now; gettimeofday (&now, 0); - if (per_sec) - rate = (float) now.tv_sec + (float) now.tv_usec / 1.0e6 - - (float) then.tv_sec - (float) then.tv_usec / 1.0e6; + if (per_sec) { + struct timeval sub; + timersub(&now, &then, &sub); + rate = (float)sub.tv_sec+(float)sub.tv_usec/1.0e6; + } } else { putchar ('\n'); --- routines.c +++ routines.c 2007-07-30 16:50:08.564263479 +0200 @@ -388,7 +388,7 @@ hms (unsigned long t) { unsigned int d, h, m, s; - static char buf[22]; + static char buf[256]; t = (t*100ULL) / usr_hz; d = (unsigned int) (t / 8640000); @@ -400,9 +400,11 @@ s = (unsigned int) (t / 100); t = t - (unsigned long) (s * 100); if (d > 0) - sprintf (buf, "%3ud %2u:%02u:%02u.%02u", d, h, m, s, (unsigned int) t); + snprintf (buf, sizeof(buf)-1, + "%3ud %2u:%02u:%02u.%02u", d, h, m, s, (unsigned int) t); else - sprintf (buf, " %2u:%02u:%02u.%02u", h, m, s, (unsigned int) t); + snprintf (buf, sizeof(buf)-1, + " %2u:%02u:%02u.%02u", h, m, s, (unsigned int) t); return buf; } @@ -411,7 +413,7 @@ perc (unsigned long i, unsigned long t, int cpus) { unsigned int v; - static char buf[16]; + static char buf[128]; if ((signed long) i == -1 || t == 0) return "---.-%"; @@ -424,7 +426,7 @@ /* if (v > 1000) return "+++.+%"; else */ - sprintf (buf, "%3u.%u%%", v / 10, v % 10); + snprintf (buf, sizeof(buf)-1, "%3u.%u%%", v / 10, v % 10); return buf; }
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