summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory
AgeCommit message (Expand)AuthorFilesLines
2017-12-01session: allocate cb messages from client ringFlorin Coras1-0/+2
2017-10-31Fix typo (double unlock)Dave Barach1-2/+1
2017-10-25VCL-LDPRELOAD: statically link VPP objects into libvcl_ldpreload.soDave Wallace1-6/+0
2017-10-18CSIT-844: fix binary api rx pthread heap push/popDave Barach2-6/+27
2017-10-10API versioning: Fix coverity errors from strncpy()Ole Troan1-1/+1
2017-10-09vppapigen: support per-file (major,minor,patch) version stampsDave Barach2-1/+60
2017-10-06Coverity fixes for API socketChris Luke1-3/+3
2017-10-05Clean up "show api ring" debug CLIDave Barach1-3/+11
2017-10-03api: fix internal client registrationsFlorin Coras1-0/+2
2017-10-03Repair vlib API socket serverDave Barach8-271/+1824
2017-09-26Add thread-safe event signaller, use RPC where requiredDave Barach1-1/+12
2017-09-25Fix sending GARP/NA on Bonded Interface Active/Backup Link Up/DownJohn Lo1-3/+27
2017-09-25Add binary API documentationDave Barach1-1/+3
2017-09-19Add new C APIKlement Sekera2-5/+71
2017-09-13API message table inspection utilitiesDave Barach1-60/+433
2017-09-11Recombine diags and minimum barrier open time changes (VPP-968)Colin Tregenza Dancer1-0/+5
2017-08-23Fix vl_map_shmem() root_path dangling reference.Dave Wallace1-5/+8
2017-08-18API: More gracefully fail when opening shared memory segment fails.Ole Troan1-2/+6
2017-08-14jvpp: make shm_prefix configurable (VPP-591)Jan Srnicek1-3/+16
2017-08-10TCP proxy prototypeDave Barach2-0/+39
2017-07-01Refactor API message handling codeKlement Sekera2-106/+139
2017-06-01Improve fifo allocator performanceDave Barach2-4/+44
2017-05-10completelly deprecate os_get_cpu_number, replace new occurencesDamjan Marion1-1/+1
2017-05-09Fix remaining 32-bit compile issuesDamjan Marion2-2/+3
2017-05-03A sprinkling of const in vlibmemory/api.h and friendsNeale Ranns4-21/+23
2017-04-25"autoreply" flag: autogenerate standard xxx_reply_t messagesDave Barach2-10/+5
2017-04-11move binary-api client-only routines to memory_client.cDave Barach2-250/+241
2017-03-14Clean up dead API client reaper callack schemeDave Barach1-7/+15
2017-03-09vlib_mains == 0 special cases be goneDave Barach1-0/+471
2017-03-07Python API: Synchronous mode.Ole Troan1-2/+15
2017-03-03Improve api trace replay consistency checkingDave Barach1-2/+32
2017-03-01VPP-598: tcp stack initial commitDave Barach2-9/+5
2017-02-28Trace plugin binary API message range allocationDave Barach2-8/+89
2017-01-09Self-service garbage collection for the API message allocatorDave Barach3-3/+28
2017-01-05Fix uninitialized stack local, VPP-581Dave Barach1-0/+3
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion9-0/+3202
span class="o">* h; BVT (clib_bihash_kv) kv; h = &tm->hash; BV (clib_bihash_init) (h, "test", tm->nbuckets, 3ULL << 30); fformat (stdout, "Pick %lld unique %s keys...\n", tm->nitems, tm->non_random_keys ? "non-random" : "random"); for (i = 0; i < tm->nitems; i++) { u8 *random_vec8; if (tm->non_random_keys == 0) { u32 len; again: do { len = random_u32 (&tm->seed); len %= 64; } while (len == 0); random_vec8 = random_string (&tm->seed, len); vec_add1 (random_vec8, 0); p = hash_get_mem (tm->key_hash, random_vec8); if (p) goto again; } else { random_vec8 = format (0, "String%d%c", i, 0); } hash_set_mem (tm->key_hash, random_vec8, i + 1); vec_add1 (tm->keys, random_vec8); } fformat (stdout, "Add items...\n"); for (i = 0; i < tm->nitems; i++) { kv.key = (u64) tm->keys[i]; kv.value = i + 1; BV (clib_bihash_add_del) (h, &kv, 1 /* is_add */ ); if (tm->verbose > 1) { fformat (stdout, "--------------------\n"); fformat (stdout, "After adding key %llu value %lld...\n", tm->keys[i], (u64) (i + 1)); fformat (stdout, "%U", BV (format_bihash), h, 2 /* very verbose */ ); } } fformat (stdout, "%U", BV (format_bihash), h, 0 /* very verbose */ ); fformat (stdout, "Search for items %d times...\n", tm->search_iter); before = clib_time_now (&tm->clib_time); for (j = 0; j < tm->search_iter; j++) { for (i = 0; i < tm->nitems; i++) { kv.key = (u64) tm->keys[i]; if (BV (clib_bihash_search) (h, &kv, &kv) < 0) if (BV (clib_bihash_search) (h, &kv, &kv) < 0) clib_warning ("[%d] search for key %lld failed unexpectedly\n", i, tm->keys[i]); if (kv.value != (u64) (i + 1)) clib_warning ("[%d] search for key %lld returned %lld, not %lld\n", i, tm->keys, kv.value, (u64) (i + 1)); } } delta = clib_time_now (&tm->clib_time) - before; 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, "%lld searches in %.6f seconds\n", total_searches, delta); fformat (stdout, "Standard E-hash search for items %d times...\n", tm->search_iter); before = clib_time_now (&tm->clib_time); for (j = 0; j < tm->search_iter; j++) { for (i = 0; i < tm->nitems; i++) { p = hash_get_mem (tm->key_hash, tm->keys[i]); if (p == 0 || p[0] != (uword) (i + 1)) clib_warning ("ugh, couldn't find %lld\n", tm->keys[i]); } } delta = clib_time_now (&tm->clib_time) - before; total_searches = (uword) tm->search_iter * (uword) tm->nitems; fformat (stdout, "%lld searches in %.6f seconds\n", total_searches, delta); if (delta > 0) fformat (stdout, "%.f searches per second\n", ((f64) total_searches) / delta); fformat (stdout, "Delete items...\n"); for (i = 0; i < tm->nitems; i++) { int j; int rv; kv.key = (u64) tm->keys[i]; kv.value = (u64) (i + 1); rv = BV (clib_bihash_add_del) (h, &kv, 0 /* is_add */ ); if (rv < 0) clib_warning ("delete key %lld not ok but should be", tm->keys[i]); if (tm->careful_delete_tests) { for (j = 0; j < tm->nitems; j++) { kv.key = (u64) tm->keys[j]; rv = BV (clib_bihash_search) (h, &kv, &kv); if (j <= i && rv >= 0) { clib_warning ("i %d j %d search ok but should not be, value %lld", i, j, kv.value); } if (j > i && rv < 0) { clib_warning ("i %d j %d search not ok but should be", i, j); } } } } fformat (stdout, "After deletions, should be empty...\n"); fformat (stdout, "%U", BV (format_bihash), h, 0 /* very verbose */ ); return 0; } clib_error_t * test_bihash_main (test_main_t * tm) { unformat_input_t *i = tm->input; clib_error_t *error; int which = 0; while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { if (unformat (i, "seed %u", &tm->seed)) ; else if (unformat (i, "nbuckets %d", &tm->nbuckets)) ; else if (unformat (i, "non-random-keys")) tm->non_random_keys = 1; else if (unformat (i, "nitems %d", &tm->nitems)) ; else if (unformat (i, "careful %d", &tm->careful_delete_tests)) ; else if (unformat (i, "verbose %d", &tm->verbose)) ; else if (unformat (i, "search %d", &tm->search_iter)) ; else if (unformat (i, "vec64")) which = 1; else if (unformat (i, "cache")) which = 2; else if (unformat (i, "verbose")) tm->verbose = 1; else return clib_error_return (0, "unknown input '%U'", format_unformat_error, i); } switch (which) { case 0: error = test_bihash (tm); break; default: return clib_error_return (0, "no such test?"); } return error; } #ifdef CLIB_UNIX int main (int argc, char *argv[]) { unformat_input_t i; clib_error_t *error; test_main_t *tm = &test_main; clib_mem_init (0, 3ULL << 30); tm->input = &i; tm->seed = 0xdeaddabe; tm->nbuckets = 2; tm->nitems = 5; tm->verbose = 1; tm->search_iter = 1; tm->careful_delete_tests = 0; tm->key_hash = hash_create_string (0, sizeof (uword)); clib_time_init (&tm->clib_time); unformat_init_command_line (&i, argv); error = test_bihash_main (tm); unformat_free (&i); if (error) { clib_error_report (error); return 1; } return 0; } #endif /* CLIB_UNIX */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */