getloadavg fixed
This commit is contained in:
parent
81a303cdca
commit
6aa4dcde7b
@ -4,12 +4,10 @@
|
|||||||
int main(void) {
|
int main(void) {
|
||||||
double avg[3] = {0, 0, 0};
|
double avg[3] = {0, 0, 0};
|
||||||
|
|
||||||
#ifndef __ANDROID__
|
|
||||||
if (getloadavg(avg, sizeof(avg) / sizeof(avg[0])) < 0) {
|
if (getloadavg(avg, sizeof(avg) / sizeof(avg[0])) < 0) {
|
||||||
fprintf(stderr, "getloadavg: getloadavg() failed\n");
|
fprintf(stderr, "getloadavg: getloadavg() failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
printf("%.2f %.2f %.2f\n", avg[0], avg[1], avg[2]);
|
printf("%.2f %.2f %.2f\n", avg[0], avg[1], avg[2]);
|
||||||
}
|
}
|
||||||
|
@ -42,12 +42,10 @@ int main(void) {
|
|||||||
/* Print 1, 5 and 15 minute load averages */
|
/* Print 1, 5 and 15 minute load averages */
|
||||||
double avg[3] = {0, 0, 0};
|
double avg[3] = {0, 0, 0};
|
||||||
|
|
||||||
#ifndef __ANDROID__
|
|
||||||
if (getloadavg(avg, sizeof(avg) / sizeof(avg[0])) < 0) {
|
if (getloadavg(avg, sizeof(avg) / sizeof(avg[0])) < 0) {
|
||||||
fprintf(stderr, "getloadavg: getloadavg() failed\n");
|
fprintf(stderr, "getloadavg: getloadavg() failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
printf(" load average: %.2f %.2f %.2f\n", avg[0], avg[1], avg[2]);
|
printf(" load average: %.2f %.2f %.2f\n", avg[0], avg[1], avg[2]);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user