Lines 570-586
Link Here
|
570 |
} else { |
570 |
} else { |
571 |
posix_compatible_load = -0.0; |
571 |
posix_compatible_load = -0.0; |
572 |
} |
572 |
} |
573 |
|
|
|
574 |
return posix_compatible_load; |
573 |
return posix_compatible_load; |
575 |
} |
574 |
} |
576 |
#else |
575 |
#else |
577 |
double GetLoadAverage() { |
576 |
double GetLoadAverage() { |
578 |
double loadavg[3] = { 0.0f, 0.0f, 0.0f }; |
577 |
double loadavg[3] = { 0.0f, 0.0f, 0.0f }; |
|
|
578 |
/* loadavg for uclibc on linux, actually works lib independant on all linux... */ |
579 |
#if defined(__UCLIBC__) && defined(__linux__) |
580 |
int fh; |
581 |
char fb[16]; |
582 |
if ( (fh=open("/proc/loadavg",O_RDONLY)) !=-1 ){ /* it's a pitty /proc can't be mmapped */ |
583 |
if (read(fh,fb,sizeof(fb)-1)!=-1){ |
584 |
fb[15]='\0'; /* ensure string termination */ |
585 |
loadavg[0]=strtod(fb,NULL); /* nasty but only the first val is used anyway */ |
586 |
} |
587 |
close(fh); |
588 |
} |
589 |
#else |
590 |
|
579 |
if (getloadavg(loadavg, 3) < 0) { |
591 |
if (getloadavg(loadavg, 3) < 0) { |
580 |
// Maybe we should return an error here or the availability of |
592 |
// Maybe we should return an error here or the availability of |
581 |
// getloadavg(3) should be checked when ninja is configured. |
593 |
// getloadavg(3) should be checked when ninja is configured. |
582 |
return -0.0f; |
594 |
return -0.0f; |
583 |
} |
595 |
} |
|
|
596 |
#endif |
584 |
return loadavg[0]; |
597 |
return loadavg[0]; |
585 |
} |
598 |
} |
586 |
#endif // _WIN32 |
599 |
#endif // _WIN32 |