Browse Source

makinf a foo.dat fake file

phyto 1 year 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
2 2
 *.o
3 3
 fake-values
4 4
 essai
5
+foo.dat
5 6
 serial/t
6 7
 core/t
7 8
 

+ 7
- 1
essai.c View File

@@ -6,6 +6,7 @@
6 6
 #include  <unistd.h>
7 7
 #include  <stdlib.h>
8 8
 #include    <string.h>
9
+#include  <time.h>
9 10
 
10 11
 #include  "core/utils.h"
11 12
 
@@ -40,6 +41,7 @@ int main(int argc, char *argv[])
40 41
 {
41 42
 int		opt, foo;
42 43
 double		loads[3];
44
+int		il[3];
43 45
 
44 46
 while ((opt = getopt(argc, argv, "v")) != -1) {
45 47
 	switch (opt) {
@@ -50,8 +52,12 @@ while ((opt = getopt(argc, argv, "v")) != -1) {
50 52
 
51 53
 foo = get_loadavg(loads);
52 54
 if (foo) fprintf(stderr, "get loadavg -> %d\n", foo);
55
+for (foo=0; foo<3; foo++) {
56
+	il[foo] = ((int)(loads[foo] * 900.0)) & 0x3ff;
57
+	fprintf(stderr, "%f -> %d\n", loads[foo], il[foo]);
58
+	}
53 59
 
54
-printf("%f %f %f %f\n", dtime(), loads[0], loads[1], loads[2]);
60
+printf("T %ld %d %d %d %d\n", time(NULL), getpid()%1024, il[0], il[1], il[2]);
55 61
 
56 62
 return 0;
57 63
 }

Loading…
Cancel
Save