Browse Source

makinf a foo.dat fake file

master
phyto 3 years ago
parent
commit
22fdf52ccb
2 changed files with 8 additions and 1 deletions
  1. +1
    -0
      .gitignore
  2. +7
    -1
      essai.c

+ 1
- 0
.gitignore View File

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


+ 7
- 1
essai.c 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;
}


Loading…
Cancel
Save