blob: 07d8f4a92ee2c449fa5bf138ccb8f0477105cc8e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "cmd_loadavg.h"
void *cmd_loadavg(void *data)
{
char *ret = NULL;
int fret=-1;
const int buf_size = 128;
char buf[buf_size+1];
double loadavg_d[3];
printf("LOADAVG\n");
fret = getloadavg(loadavg_d, 3);
if (fret<0)
{
ret = alloc_new_str("Cant get load avg mate\n");
}
printf("1M %lf 5M %lf 15M %lf\n", loadavg_d[0], loadavg_d[1], loadavg_d[2]);
snprintf(buf, buf_size,"1M %.1f 5M %.1f 15M %.1f", loadavg_d[0], loadavg_d[1], loadavg_d[2]);
ret = alloc_new_str(buf);
return ret;
}
|