summaryrefslogtreecommitdiffstats
path: root/src/examples
AgeCommit message (Expand)AuthorFilesLines
2019-08-01docs: Small fixes and orderingNathan Skrzypczak1-1/+1
2019-07-29misc: add vnet/pipeline.h exampleDave Barach1-1/+89
2019-07-09vat: unload unused vat pluginsDave Barach1-27/+11
2019-06-24vlib: packet tracer support for pkt thread handoffsDave Barach5-0/+536
2019-05-30sample-plugin: refactor .api to use explicit typesOle Troan1-8/+9
2019-05-16init / exit function orderingDave Barach1-8/+7
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach1-28/+28
2018-11-13vlib rename vlib_frame_args(...) to vlib_frame_scalar_args(..)Damjan Marion1-2/+2
2018-10-23c11 safe string handling supportDave Barach2-2/+2
2018-09-14cpack: add deb/rpm packaging to VPP moduleDamjan Marion2-0/+8
2018-09-12cmake: create cmake VPP module, update sample-plugin so it uses itDamjan Marion5-126/+32
2018-08-22Consolidate the [un]format_mac_address implementationsNeale Ranns1-7/+1
2018-08-01Store USE_DLMALLOC in vppinfra/config.hDamjan Marion2-4/+1
2018-07-26Improve the sample plugin node dispatch functionDave Barach1-128/+473
2018-07-20fix issue with missing sample_main in sample pluginDamjan Marion1-0/+2
2018-07-18Add config option to use dlmalloc instead of mheapDave Barach2-1/+14
2018-04-25Fix sample-plugin build with newer clang versionsDamjan Marion1-0/+20
2018-03-14Clean up vpp build bootstrap stepDave Barach1-3/+4
2018-01-23VPPAPIGEN: vppapigen replacement in Python PLY.Ole Troan2-5/+3
2017-12-06Remove unused, uninteresting codeDave Barach2-527/+122
2017-10-24Add extern to *_main global variable declarations in header files.Dave Wallace2-2/+2
2017-10-09vppapigen: support per-file (major,minor,patch) version stampsDave Barach1-0/+2
2017-10-03Repair vlib API socket serverDave Barach3-3/+0
2017-09-07vlib physmem reworkDamjan Marion1-2/+1
2017-08-23NAT: Rename snat plugin to nat (VPP-955)Matus Fabian1-1/+1
2017-06-09Sample plugin: Add sample plugin documentationRay Kinsella2-7/+89
2017-06-07VPP-872 and End.T function for SRv6Pablo Camarillo1-21/+82
2017-05-05First commit SR MPLSPablo Camarillo2-3/+3
2017-04-25"autoreply" flag: autogenerate standard xxx_reply_t messagesDave Barach1-9/+1
2017-04-20Extend ebuild to specify "configure" subdir, enable verify for sample-pluginDamjan Marion1-2/+0
2017-04-06Use thread local storage for thread indexDamjan Marion1-2/+2
2017-03-29Bugfixing and documentation for SRv6Pablo Camarillo4-0/+470
2017-03-22vlib: add description field in plugin registrationDamjan Marion1-0/+1
2017-03-16API:replaced all REPLY_MACRO's with api_helper_macros.hEyal Bari1-23/+2
2017-03-04Fix duplicate binary API registration messages / bugsDave Barach1-2/+2
2017-02-22Support multiple plugin build in the sample-pluginAnlu Yan3-18/+52
2017-02-16Fix sample plugin breakage.Anlu Yan2-22/+9
2017-02-02Refactor fragile msg macro W and W2 to not burry return control flow.Jon Loeliger1-1/+3
2017-02-02Convert message macro S to accept a message pointer parameter;Jon Loeliger1-1/+1
2017-02-02Ensure all M() and M2() second parameters are the message pointer.Jon Loeliger1-1/+1
2017-01-28Add files to CLEANFILES for robust make clean.Burt Silverman1-0/+2
2017-01-25Repair plugin binary API message numberingDave Barach1-0/+2
2017-01-23binary-api debug CLI works with pluginsDave Barach1-36/+1
2017-01-17sample-plugin: fix buildDamjan Marion2-2/+2
2017-01-01Move java,lua api and remaining plugins to src/Damjan Marion9-0/+951
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion4-0/+1351
">(&tm->time); clib_warning ("iter %d, seed %u, keys %d, max vector %d, ", tm->n_iter, tm->seed, tm->n_keys, tm->max_vector); vec_resize (tm->keys, tm->n_keys); vec_resize (tm->get_multiple_results, tm->n_keys); for (i = 0; i < vec_len (tm->keys); i++) tm->keys[i] = random_uword (&tm->seed); if (!tm->n_hash_keys) tm->n_hash_keys = 2 * max_pow2 (tm->n_keys); tm->n_hash_keys = clib_max (tm->n_keys, tm->n_hash_keys); qhash_resize (tm->qhash, tm->n_hash_keys); { qhash_t *h = qhash_header (tm->qhash); int i; for (i = 0; i < ARRAY_LEN (h->hash_seeds); i++) h->hash_seeds[i] = random_uword (&tm->seed); } vec_resize (tm->lookup_keys, tm->max_vector); vec_resize (tm->lookup_key_indices, tm->max_vector); vec_resize (tm->lookup_results, tm->max_vector); for (iter = 0; iter < tm->n_iter; iter++) { uword *p, j, n, is_set; n = tm->max_vector; is_set = random_u32 (&tm->seed) & 1; is_set |= hash_elts (tm->hash) < (tm->n_keys / 4); if (hash_elts (tm->hash) > (3 * tm->n_keys) / 4) is_set = 0; _vec_len (tm->lookup_keys) = n; _vec_len (tm->lookup_key_indices) = n; j = 0; while (j < n) { i = random_u32 (&tm->seed) % vec_len (tm->keys); if (clib_bitmap_get (tm->keys_in_hash_bitmap, i) != is_set) { f64 t[2]; tm->lookup_key_indices[j] = i; tm->lookup_keys[j] = tm->keys[i]; t[0] = clib_time_now (&tm->time); if (is_set) hash_set (tm->hash, tm->keys[i], i); else hash_unset (tm->hash, tm->keys[i]); t[1] = clib_time_now (&tm->time); if (is_set) tm->hash_set_time += t[1] - t[0]; else tm->hash_unset_time += t[1] - t[0]; tm->keys_in_hash_bitmap = clib_bitmap_set (tm->keys_in_hash_bitmap, i, is_set); j++; } } { f64 t[2]; if (is_set) { t[0] = clib_time_now (&tm->time); qhash_set_multiple (tm->qhash, tm->lookup_keys, vec_len (tm->lookup_keys), tm->lookup_results); t[1] = clib_time_now (&tm->time); tm->set_time += t[1] - t[0]; tm->set_count += vec_len (tm->lookup_keys); for (i = 0; i < vec_len (tm->lookup_keys); i++) { uword r = tm->lookup_results[i]; *vec_elt_at_index (tm->qhash, r) = tm->lookup_key_indices[i]; } } else { t[0] = clib_time_now (&tm->time); qhash_unset_multiple (tm->qhash, tm->lookup_keys, vec_len (tm->lookup_keys), tm->lookup_results); t[1] = clib_time_now (&tm->time); tm->unset_time += t[1] - t[0]; tm->unset_count += vec_len (tm->lookup_keys); for (i = 0; i < vec_len (tm->lookup_keys); i++) { uword r = tm->lookup_results[i]; *vec_elt_at_index (tm->qhash, r) = ~0; } } } if (qhash_elts (tm->qhash) != hash_elts (tm->hash)) os_panic (); { qhash_t *h; uword i, k, l, count; h = qhash_header (tm->qhash); for (i = k = 0; k < vec_len (h->hash_key_valid_bitmap); k++) i += count_set_bits (h->hash_key_valid_bitmap[k]); k = hash_elts (h->overflow_hash); l = qhash_elts (tm->qhash); if (i + k != l) os_panic (); count = hash_elts (h->overflow_hash); for (i = 0; i < (1 << h->log2_hash_size); i++) count += tm->qhash[i] != ~0; if (count != qhash_elts (tm->qhash)) os_panic (); { u32 *tmp = 0; /* *INDENT-OFF* */ hash_foreach (k, l, h->overflow_hash, ({ j = qhash_hash_mix (h, k) / QHASH_KEYS_PER_BUCKET; vec_validate (tmp, j); tmp[j] += 1; })); /* *INDENT-ON* */ for (k = 0; k < vec_len (tmp); k++) { if (k >= vec_len (h->overflow_counts)) os_panic (); if (h->overflow_counts[k] != tmp[k]) os_panic (); } for (; k < vec_len (h->overflow_counts); k++) if (h->overflow_counts[k] != 0) os_panic (); vec_free (tmp); } } { f64 t[2]; t[0] = clib_time_now (&tm->time); qhash_get_multiple (tm->qhash, tm->keys, vec_len (tm->keys), tm->get_multiple_results); t[1] = clib_time_now (&tm->time); tm->get_time += t[1] - t[0]; for (i = 0; i < vec_len (tm->keys); i++) { u32 r; t[0] = clib_time_now (&tm->time); p = hash_get (tm->hash, tm->keys[i]); t[1] = clib_time_now (&tm->time); tm->hash_get_time += t[1] - t[0]; r = qhash_get (tm->qhash, tm->keys[i]); if (p) { if (p[0] != i) os_panic (); if (*vec_elt_at_index (tm->qhash, r) != i) os_panic (); } else { if (r != ~0) os_panic (); } if (r != tm->get_multiple_results[i]) os_panic (); } } tm->overflow_fraction += ((f64) qhash_n_overflow (tm->qhash) / qhash_elts (tm->qhash)); tm->ave_elts += qhash_elts (tm->qhash); } fformat (stderr, "%d iter %.6e overflow, %.4f ave. elts\n", tm->n_iter, tm->overflow_fraction / tm->n_iter, tm->ave_elts / tm->n_iter); tm->get_time /= tm->n_iter * vec_len (tm->keys); tm->hash_get_time /= tm->n_iter * vec_len (tm->keys); tm->set_time /= tm->set_count; tm->unset_time /= tm->unset_count; tm->hash_set_time /= tm->set_count; tm->hash_unset_time /= tm->unset_count; fformat (stderr, "get/set/unset clocks %.2e %.2e %.2e clib %.2e %.2e %.2e ratio %.2f %.2f %.2f\n", tm->get_time * tm->time.clocks_per_second, tm->set_time * tm->time.clocks_per_second, tm->unset_time * tm->time.clocks_per_second, tm->hash_get_time * tm->time.clocks_per_second, tm->hash_set_time * tm->time.clocks_per_second, tm->hash_unset_time * tm->time.clocks_per_second, tm->hash_get_time / tm->get_time, tm->hash_set_time / tm->set_time, tm->hash_unset_time / tm->unset_time); done: return error; } #ifdef CLIB_UNIX int main (int argc, char *argv[]) { unformat_input_t i; clib_error_t *error; unformat_init_command_line (&i, argv); error = test_qhash_main (&i); unformat_free (&i); if (error) { clib_error_report (error); return 1; } else return 0; } #endif /* CLIB_UNIX */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */