X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftal%2Fbenchmark%2Fspeed.c;h=fd2d9cc71314570569a2e242160a4a698796c857;hp=0b4815fed4b82598fca562072f6df14a9c338f4e;hb=d16685e327c01b79bf4b49793f56cbe3e33ff179;hpb=de8e8cf2e214b880e14b20817e665477a5dc5bdb diff --git a/ccan/tal/benchmark/speed.c b/ccan/tal/benchmark/speed.c index 0b4815fe..fd2d9cc7 100644 --- a/ccan/tal/benchmark/speed.c +++ b/ccan/tal/benchmark/speed.c @@ -24,6 +24,7 @@ */ #include #include +#include #include #include #include @@ -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: