]> git.ozlabs.org Git - ccan/blobdiff - ccan/tal/benchmark/speed.c
tal: fix up benchmarks for interface changes.
[ccan] / ccan / tal / benchmark / speed.c
index 0b4815fed4b82598fca562072f6df14a9c338f4e..fd2d9cc71314570569a2e242160a4a698796c857 100644 (file)
@@ -24,6 +24,7 @@
 */
 #include <ccan/talloc/talloc.h>
 #include <ccan/tal/tal.h>
+#include <ccan/tal/str/str.h>
 #include <ccan/time/time.h>
 #include <ccan/err/err.h>
 #include <string.h>
@@ -35,7 +36,7 @@ int main(int argc, char *argv[])
        void *ctx;
        unsigned count;
        int i, j;
-       struct timespec tv;
+       struct timeabs tv;
        void *p1, *p2[100], *p3[100];
        bool run_talloc = true, run_tal = true, run_malloc = true;
 
@@ -66,7 +67,7 @@ int main(int argc, char *argv[])
                        talloc_free(p1);
                }
                count += (1 + 200) * LOOPS;
-       } while (time_sub(time_now(), tv).tv_sec < 5);
+       } while (time_between(time_now(), tv).ts.tv_sec < 5);
 
        fprintf(stderr, "talloc: %.0f ops/sec\n", count/5.0);
 
@@ -89,7 +90,7 @@ after_talloc:
                        tal_free(p1);
                }
                count += (1 + 200) * LOOPS;
-       } while (time_sub(time_now(), tv).tv_sec < 5);
+       } while (time_between(time_now(), tv).ts.tv_sec < 5);
        fprintf(stderr, "tal:    %.0f ops/sec\n", count/5.0);
 
        tal_free(ctx);
@@ -114,7 +115,7 @@ after_tal:
                        free(p1);
                }
                count += (1 + 200) * LOOPS;
-       } while (time_sub(time_now(), tv).tv_sec < 5);
+       } while (time_between(time_now(), tv).ts.tv_sec < 5);
        fprintf(stderr, "malloc: %.0f ops/sec\n", count/5.0);
 
 after_malloc: