46 lines
933 B
C
46 lines
933 B
C
/*
|
|
* essai.c
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <time.h>
|
|
|
|
#include "core/utils.h"
|
|
#include "core/sysmetrics.h"
|
|
|
|
int verbosity;
|
|
|
|
/* --------------------------------------------------------------- */
|
|
/* --------------------------------------------------------------- */
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int opt, foo;
|
|
double loads[3];
|
|
int il[3];
|
|
|
|
while ((opt = getopt(argc, argv, "v")) != -1) {
|
|
switch (opt) {
|
|
case 'v': verbosity++; break;
|
|
default: break;
|
|
}
|
|
}
|
|
|
|
foo = get_loadavg(loads);
|
|
if (foo) fprintf(stderr, "get loadavg -> %d\n", foo);
|
|
for (foo=0; foo<3; foo++) {
|
|
il[foo] = ((int)(loads[foo] * 90.0)) & 0x3ff;
|
|
if (verbosity)
|
|
fprintf(stderr, "%f -> %d\n", loads[foo], il[foo]);
|
|
}
|
|
|
|
printf("%ld %d %d %d %d\n", time(NULL), getpid()%84, il[0], il[1], il[2]);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* --------------------------------------------------------------- */
|