makinf a foo.dat fake file

This commit is contained in:
phyto 2019-01-18 15:39:07 +01:00
parent 7c8067fc5a
commit 22fdf52ccb
2 changed files with 8 additions and 1 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ a.out
*.o
fake-values
essai
foo.dat
serial/t
core/t

View File

@ -6,6 +6,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "core/utils.h"
@ -40,6 +41,7 @@ int main(int argc, char *argv[])
{
int opt, foo;
double loads[3];
int il[3];
while ((opt = getopt(argc, argv, "v")) != -1) {
switch (opt) {
@ -50,8 +52,12 @@ while ((opt = getopt(argc, argv, "v")) != -1) {
foo = get_loadavg(loads);
if (foo) fprintf(stderr, "get loadavg -> %d\n", foo);
for (foo=0; foo<3; foo++) {
il[foo] = ((int)(loads[foo] * 900.0)) & 0x3ff;
fprintf(stderr, "%f -> %d\n", loads[foo], il[foo]);
}
printf("%f %f %f %f\n", dtime(), loads[0], loads[1], loads[2]);
printf("T %ld %d %d %d %d\n", time(NULL), getpid()%1024, il[0], il[1], il[2]);
return 0;
}