From 192b5d79a24c36f0c1247bf837e2e837098145f6 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 29 Nov 2011 15:51:22 +0800 Subject: refactor test cases --- tests/storage/test_phrase_index.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'tests/storage/test_phrase_index.cpp') diff --git a/tests/storage/test_phrase_index.cpp b/tests/storage/test_phrase_index.cpp index 8f22a7d..066176c 100644 --- a/tests/storage/test_phrase_index.cpp +++ b/tests/storage/test_phrase_index.cpp @@ -1,29 +1,10 @@ +#include "timer.h" #include -#include #include -#include #include "pinyin_internal.h" size_t bench_times = 100000; -guint32 record_time () -{ - timeval tv; - gettimeofday (&tv, NULL); - return (guint32) tv.tv_sec * 1000000 + tv.tv_usec; -} - -void print_time (guint32 old_time, guint32 times) -{ - timeval tv; - gettimeofday (&tv, NULL); - - guint32 wasted = (guint32) tv.tv_sec * 1000000 + tv.tv_usec - old_time; - - printf("Spent %d us for %d operations, %f us/op, %f times/s.\n\n" , wasted , times , ((double) wasted)/times , times * 1000000.0/wasted ); -} - - int main(int argc, char * argv[]){ PhraseItem phrase_item; utf16_t string1 = 2; -- cgit