summaryrefslogtreecommitdiff
path: root/code/glue/repeat-trace-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/glue/repeat-trace-cmd.c')
-rw-r--r--code/glue/repeat-trace-cmd.c27
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--;
+ }
+}
contact: Jan Huwald // Impressum