Skip to content

Commit

Permalink
Merge pull request ninja-build#1220 from phajdan/master
Browse files Browse the repository at this point in the history
Fix build with uclibc
  • Loading branch information
nico authored Jan 8, 2017
2 parents 7d705a3 + 76abf78 commit 95ddaa1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,13 @@ double GetLoadAverage() {
// Calculation taken from comment in libperfstats.h
return double(cpu_stats.loadavg[0]) / double(1 << SBITS);
}
#elif defined(__UCLIBC__)
double GetLoadAverage() {
struct sysinfo si;
if (sysinfo(&si) != 0)
return -0.0f;
return 1.0 / (1 << SI_LOAD_SHIFT) * si.loads[0];
}
#else
double GetLoadAverage() {
double loadavg[3] = { 0.0f, 0.0f, 0.0f };
Expand Down

0 comments on commit 95ddaa1

Please sign in to comment.