Changes in uspace/lib/c/generic/stats.c [1ab8539:d4d74dc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/stats.c
r1ab8539 rd4d74dc 291 291 } 292 292 293 /** Get system uptime 294 * 295 * @return System uptime (in seconds). 296 * 297 */ 298 sysarg_t stats_get_uptime(void) 299 { 300 sysarg_t uptime; 301 if (sysinfo_get_value("system.uptime", &uptime) != EOK) 302 uptime = 0; 303 304 return uptime; 305 } 306 293 307 /** Print load fixed-point value 294 308 * … … 302 316 void stats_print_load_fragment(load_t upper, unsigned int dec_length) 303 317 { 318 /* Magic value from BSD */ 319 load_t lower = 65536; 320 304 321 /* Print the whole part */ 305 printf("%u.", upper / LOAD_UNIT);306 307 load_t rest = (upper % LOAD_UNIT) * 10;322 printf("%u.", upper / lower); 323 324 load_t rest = (upper % lower) * 10; 308 325 309 326 unsigned int i; 310 327 for (i = 0; i < dec_length; i++) { 311 printf("%u", rest / LOAD_UNIT);312 rest = (rest % LOAD_UNIT) * 10;328 printf("%u", rest / lower); 329 rest = (rest % lower) * 10; 313 330 } 314 331 }
Note:
See TracChangeset
for help on using the changeset viewer.