summaryrefslogtreecommitdiffstats
path: root/tests/storage
diff options
context:
space:
mode:
Diffstat (limited to 'tests/storage')
-rw-r--r--tests/storage/test_parser2.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/storage/test_parser2.cpp b/tests/storage/test_parser2.cpp
index 2ba2511..3748338 100644
--- a/tests/storage/test_parser2.cpp
+++ b/tests/storage/test_parser2.cpp
@@ -20,6 +20,7 @@
*/
+#include "timer.h"
#include <errno.h>
#include <stdio.h>
#include <assert.h>
@@ -28,6 +29,8 @@
#include "pinyin_parser2.h"
+size_t bench_times = 1000;
+
using namespace pinyin;
static const char * help_msg =
@@ -107,8 +110,14 @@ int main(int argc, char * argv[]) {
#endif
#if 1
- int len = parser->parse(options, keys, key_rests,
+ int len = 0;
+ guint32 start_time = record_time();
+ for ( size_t i = 0; i < bench_times; ++i)
+ len = parser->parse(options, keys, key_rests,
linebuf, strlen(linebuf));
+
+ print_time(start_time, bench_times);
+
printf("parsed %d chars, %d keys.\n", len, keys->len);
assert(keys->len == key_rests->len);