summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--mico-dump.c15
-rw-r--r--mico-store.c3
2 files changed, 15 insertions, 3 deletions
diff --git a/mico-dump.c b/mico-dump.c
index ce13a3e..37ed025 100644
--- a/mico-dump.c
+++ b/mico-dump.c
@@ -1,6 +1,7 @@
 #include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include <zip.h>
@@ -105,9 +106,17 @@ main()
 		int64_t t = 0, td = 0;
 		double v = 0.0;
 
-		while (!ts.eof) {
-			int32_t tdd = get1(&ts);
-			int32_t vd = get1(&vs);
+		int64_t len = get1(&ts);
+		int64_t lenv = get1(&vs);
+
+		if (len != lenv) {
+			fprintf(stderr, "time and value length don't agree");
+			exit(-1);
+		}
+
+		for (int64_t j = 0; j < len; j++) {
+			int64_t tdd = get1(&ts);
+			int64_t vd = get1(&vs);
 
 			td += tdd;
 			t += td;
diff --git a/mico-store.c b/mico-store.c
index f2dd221..b39c258 100644
--- a/mico-store.c
+++ b/mico-store.c
@@ -178,6 +178,9 @@ main()
 		int64_t t, pt = 0, ppt = 0;
 		double v, pv = 0.0;
 
+		put1(&ts, arrlen(metrics[m].value));
+		put1(&vs, arrlen(metrics[m].value));
+
 		for (ssize_t i = 0; i < arrlen(metrics[m].value); i++) {
 			t = metrics[m].value[i].t;
 			v = metrics[m].value[i].v;