diff options
author | Jan Huwald <jh@sotun.de> | 2012-05-07 19:53:27 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2012-05-07 19:53:27 (GMT) |
commit | 00b209240138660db1ded3ef3870023964ce6e4e (patch) | |
tree | 8ffaec780b060bdc478929aa714b8af2ee760671 /code/glue/repeat-trace-cmd.c |
Diffstat (limited to 'code/glue/repeat-trace-cmd.c')
-rw-r--r-- | code/glue/repeat-trace-cmd.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/code/glue/repeat-trace-cmd.c b/code/glue/repeat-trace-cmd.c new file mode 100644 index 0000000..ac35733 --- /dev/null +++ b/code/glue/repeat-trace-cmd.c @@ -0,0 +1,27 @@ +#include <stdio.h> + +int main(int argc, char **argv) { + double t, dt; + long n; + + if (argc != 4) { + fprintf(stderr, "ERROR: wrong argument count\nUse %s total_time time_per_trace \"trace command(s) \"\n", argv[0]); + return -1; + } + + if ((sscanf(argv[1], "%lf", &t) != 1) || + (sscanf(argv[2], "%lf", &dt) != 1)) { + fprintf(stderr, "failed to read arg 1/2\n"); + return -1; + } + printf("%f, %f\n", t, dt); + // print the full command once + + // now print enough newline (= command repetitions) + // TODO: be faster than lame-duck-speed + n = (long) (t / dt); // on step already passed because of above printf statement + while (n>1) { + printf("\n"); + n--; + } +} |