Browse Source

htable: update tools for time changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell 11 years ago
parent
commit
d9b63547c1
3 changed files with 12 additions and 12 deletions
  1. 4 4
      ccan/htable/tools/hsearchspeed.c
  2. 4 4
      ccan/htable/tools/speed.c
  3. 4 4
      ccan/htable/tools/stringspeed.c

+ 4 - 4
ccan/htable/tools/hsearchspeed.c

@@ -15,17 +15,17 @@
 #include <search.h>
 
 /* Nanoseconds per operation */
-static size_t normalize(const struct timespec *start,
-			const struct timespec *stop,
+static size_t normalize(const struct timeabs *start,
+			const struct timeabs *stop,
 			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[])
 {
 	size_t i, j, num;
-	struct timespec start, stop;
+	struct timeabs start, stop;
 	char **w;
 	ENTRY *words, *misswords;
 

+ 4 - 4
ccan/htable/tools/speed.c

@@ -94,11 +94,11 @@ static size_t count_deleted(const struct htable *ht)
 }
 
 /* Nanoseconds per operation */
-static size_t normalize(const struct timespec *start,
-			const struct timespec *stop,
+static size_t normalize(const struct timeabs *start,
+			const struct timeabs *stop,
 			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)
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
 {
 	struct object *objs;
 	size_t i, j, num, deleted;
-	struct timespec start, stop;
+	struct timeabs start, stop;
 	struct htable_obj ht;
 	bool make_dumb = false;
 

+ 4 - 4
ccan/htable/tools/stringspeed.c

@@ -34,17 +34,17 @@ static bool cmp(const char *obj, const char *key)
 HTABLE_DEFINE_TYPE(char, strkey, hash_str, cmp, htable_str);
 
 /* Nanoseconds per operation */
-static size_t normalize(const struct timespec *start,
-			const struct timespec *stop,
+static size_t normalize(const struct timeabs *start,
+			const struct timeabs *stop,
 			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[])
 {
 	size_t i, j, num;
-	struct timespec start, stop;
+	struct timeabs start, stop;
 	struct htable_str ht;
 	char **words, **misswords;