X-Git-Url: http://git.madism.org/?p=apps%2Fpfixtools.git;a=blobdiff_plain;f=common%2Ftst-trie.c;h=739bd415e7a1e1575d1777e25be89c606648bbc0;hp=78977a845c85c7e24a524ff2941c8ddb813bde5d;hb=ab82546953101224d09dcf2e44ff170e454e7282;hpb=3df18edc2580a1cc3e95d427337e5afef042a83d diff --git a/common/tst-trie.c b/common/tst-trie.c index 78977a8..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(); @@ -129,7 +128,14 @@ int main(int argc, char *argv[]) */ if (argc > 1) { trie = create_trie_from_file(argv[1]); - trie_inspect(trie, true); + 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;