Xinqi Bao's Git
projects
/
slstatus.git
/ blob
summary
|
log
|
commit
|
diff
|
tree
history
|
raw
|
HEAD
Add basic backlight percentage support
[slstatus.git]
/
components
/
load_avg.c
1
/* See LICENSE file for copyright and license details. */
2
#include <stdio.h>
3
#include <stdlib.h>
4
5
#include
"../util.h"
6
7
const char
*
8
load_avg
(
void
)
9
{
10
double
avgs
[
3
];
11
12
if
(
getloadavg
(
avgs
,
3
) <
0
) {
13
warn
(
"getloadavg: Failed to obtain load average"
);
14
return
NULL
;
15
}
16
17
return
bprintf
(
"%.2f %.2f %.2f"
,
avgs
[
0
],
avgs
[
1
],
avgs
[
2
]);
18
}