Commit d9b63547 authored by Rusty Russell's avatar Rusty Russell

htable: update tools for time changes.

Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 95ff2139
...@@ -15,17 +15,17 @@ ...@@ -15,17 +15,17 @@
#include <search.h> #include <search.h>
/* Nanoseconds per operation */ /* Nanoseconds per operation */
static size_t normalize(const struct timespec *start, static size_t normalize(const struct timeabs *start,
const struct timespec *stop, const struct timeabs *stop,
unsigned int num) unsigned int num)
{ {
return time_to_nsec(time_divide(time_sub(*stop, *start), num)); return time_to_nsec(time_divide(time_between(*stop, *start), num));
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
size_t i, j, num; size_t i, j, num;
struct timespec start, stop; struct timeabs start, stop;
char **w; char **w;
ENTRY *words, *misswords; ENTRY *words, *misswords;
......
...@@ -94,11 +94,11 @@ static size_t count_deleted(const struct htable *ht) ...@@ -94,11 +94,11 @@ static size_t count_deleted(const struct htable *ht)
} }
/* Nanoseconds per operation */ /* Nanoseconds per operation */
static size_t normalize(const struct timespec *start, static size_t normalize(const struct timeabs *start,
const struct timespec *stop, const struct timeabs *stop,
unsigned int num) unsigned int num)
{ {
return time_to_nsec(time_divide(time_sub(*stop, *start), num)); return time_to_nsec(time_divide(time_between(*stop, *start), num));
} }
static size_t worst_run(struct htable *ht, size_t *deleted) static size_t worst_run(struct htable *ht, size_t *deleted)
...@@ -128,7 +128,7 @@ int main(int argc, char *argv[]) ...@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
{ {
struct object *objs; struct object *objs;
size_t i, j, num, deleted; size_t i, j, num, deleted;
struct timespec start, stop; struct timeabs start, stop;
struct htable_obj ht; struct htable_obj ht;
bool make_dumb = false; bool make_dumb = false;
......
...@@ -34,17 +34,17 @@ static bool cmp(const char *obj, const char *key) ...@@ -34,17 +34,17 @@ static bool cmp(const char *obj, const char *key)
HTABLE_DEFINE_TYPE(char, strkey, hash_str, cmp, htable_str); HTABLE_DEFINE_TYPE(char, strkey, hash_str, cmp, htable_str);
/* Nanoseconds per operation */ /* Nanoseconds per operation */
static size_t normalize(const struct timespec *start, static size_t normalize(const struct timeabs *start,
const struct timespec *stop, const struct timeabs *stop,
unsigned int num) unsigned int num)
{ {
return time_to_nsec(time_divide(time_sub(*stop, *start), num)); return time_to_nsec(time_divide(time_between(*stop, *start), num));
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
size_t i, j, num; size_t i, j, num;
struct timespec start, stop; struct timeabs start, stop;
struct htable_str ht; struct htable_str ht;
char **words, **misswords; char **words, **misswords;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment