DD2-monitor/essai.c

39 lines
710 B
C
Raw Normal View History

2018-12-08 23:02:24 +11:00
/*
* essai.c
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include "funcs.h"
int verbosity;
/* --------------------------------------------------------------- */
int main(int argc, char *argv[])
{
int opt, foo;
int type = 0;
double loads[3];
while ((opt = getopt(argc, argv, "vst:")) != -1) {
switch (opt) {
case 'v': verbosity++; break;
case 's': srand(getpid()); break;
case 't': type = atoi(optarg); break;
default: break;
}
}
foo = get_loadavg(loads);
if (foo) fprintf(stderr, "get loadavg -> %d\n", foo);
printf("%f %f %f %f\n", dtime(), loads[0], loads[1], loads[2]);
return 0;
}
/* --------------------------------------------------------------- */