Browse Source

working on fakevalues generator

master
tth 2 years ago
parent
commit
639adde484
2 changed files with 25 additions and 2 deletions
  1. +14
    -2
      exemple.sh
  2. +11
    -0
      funcs.c

+ 14
- 2
exemple.sh View File

@ -4,7 +4,7 @@ DATAFILE=/tmp/fake-datafile
#----- collect the datas
> ${DATAFILE}
for s in $(seq 1 20)
for s in $(seq 1 2000)
do
v=$(./fake-values -s -t 1 2> /dev/null)
echo $s $v >> ${DATAFILE}
@ -13,7 +13,19 @@ done
#----- do dome useless computations
awk '
NR==1 { debut = $2 }
{ print $2-debut, $3 }
{
# print $2-debut, $3
v = int($3/25);
bucket[v]++;
}
END {
for (v=0; v<40; v++) {
for (foo=0; foo<bucket[v]; foo++) {
printf "-";
}
print "*"
}
}
' \
< ${DATAFILE}


+ 11
- 0
funcs.c View File

@ -3,14 +3,25 @@
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include "funcs.h"
extern int verbosity;
/* --------------------------------------------------------------- */
int seed_my_rand(int foo)
{
long v1, v2;
v1 = getpid(); v2 = time(NULL);
return v1 ^ v2;
}
/* --------------------------------------------------------------- */
int random1000(int type)


Loading…
Cancel
Save