X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Ftest_bihash_template.c;h=86039d8408a6383688e69500124ec09c42bcc251;hb=16e4a4a0ae39ebc1ded1b6dba2799b176aee1828;hp=c1a446919667df4a1a8b75d455f57f0e54036c9a;hpb=b9753540d2a69bbab807653fc3d0c1b43ec4d6d5;p=vpp.git diff --git a/src/vppinfra/test_bihash_template.c b/src/vppinfra/test_bihash_template.c index c1a44691966..86039d8408a 100644 --- a/src/vppinfra/test_bihash_template.c +++ b/src/vppinfra/test_bihash_template.c @@ -337,6 +337,16 @@ test_bihash (test_main_t * tm) { for (i = 0; i < tm->nitems; i++) { + /* Prefetch buckets 8 iterations ahead */ + if (1 && (i < (tm->nitems - 8))) + { + BVT (clib_bihash_kv) pref_kv; + u64 pref_hash; + pref_kv.key = tm->keys[i + 8]; + pref_hash = BV (clib_bihash_hash) (&pref_kv); + BV (clib_bihash_prefetch_bucket) (h, pref_hash); + } + kv.key = tm->keys[i]; if (BV (clib_bihash_search) (h, &kv, &kv) < 0) if (BV (clib_bihash_search) (h, &kv, &kv) < 0) @@ -356,8 +366,10 @@ test_bihash (test_main_t * tm) total_searches = (uword) tm->search_iter * (uword) tm->nitems; if (delta > 0) - fformat (stdout, "%.f searches per second\n", - ((f64) total_searches) / delta); + fformat (stdout, + "%.f searches per second, %.2f nsec per search\n", + ((f64) total_searches) / delta, + 1e9 * (delta / ((f64) total_searches))); fformat (stdout, "%lld searches in %.6f seconds\n", total_searches, delta); @@ -409,6 +421,16 @@ test_bihash (test_main_t * tm) { for (j = 0; j < tm->nitems; j++) { + /* Prefetch buckets 8 iterations ahead */ + if (1 && (j < (tm->nitems - 8))) + { + BVT (clib_bihash_kv) pref_kv; + u64 pref_hash; + pref_kv.key = tm->keys[j + 8]; + pref_hash = BV (clib_bihash_hash) (&pref_kv); + BV (clib_bihash_prefetch_bucket) (h, pref_hash); + } + kv.key = tm->keys[j]; rv = BV (clib_bihash_search) (h, &kv, &kv); if (j <= i && rv >= 0)