X-Git-Url: http://git.madism.org/?p=apps%2Fpfixtools.git;a=blobdiff_plain;f=common%2Ftst-trie.c;h=739bd415e7a1e1575d1777e25be89c606648bbc0;hp=990b151e20ae08d5e1496546a84ed7ecaa99d43a;hb=ab82546953101224d09dcf2e44ff170e454e7282;hpb=193694fdba386a89b4b2a83ce803764302995e89 diff --git a/common/tst-trie.c b/common/tst-trie.c index 990b151..739bd41 100644 --- a/common/tst-trie.c +++ b/common/tst-trie.c @@ -54,8 +54,7 @@ static trie_t *create_trie_from_file(const char *file) --end; } if (end != map.end) { - syslog(LOG_WARNING, "file %s miss a final \\n, ignoring last line", - file); + warn("file %s miss a final \\n, ignoring last line", file); } db = trie_new(); @@ -130,6 +129,13 @@ int main(int argc, char *argv[]) if (argc > 1) { trie = create_trie_from_file(argv[1]); trie_inspect(trie, false); + if (argc > 2) { + time_t now = time(NULL); + for (uint32_t i = 0 ; i < 1000000000 ; ++i) { + trie_lookup(trie, argv[2]); + } + printf("%lu lookups per second\n", 1000000000 / (time(NULL) - now)); + } trie_delete(&trie); } return 0;