MCPcopy Create free account
hub / github.com/F-Stack/f-stack / generate_keys

Function generate_keys

dpdk/app/test/test_hash_readwrite_lf_perf.c:252–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252static int
253generate_keys(void)
254{
255 uint32_t *keys = NULL;
256 uint32_t *keys_no_ks = NULL;
257 uint32_t *keys_ks = NULL;
258 uint32_t *keys_absent = NULL;
259 uint32_t *keys_non_shift_path = NULL;
260 uint32_t *keys_ext_bkt = NULL;
261 uint32_t *keys_ks_extbkt = NULL;
262 uint32_t *found = NULL;
263 uint32_t count_keys_no_ks = 0;
264 uint32_t count_keys_ks = 0;
265 uint32_t count_keys_extbkt = 0;
266 uint32_t i;
267
268 if (init_params(0, 0, 0, 0) != 0)
269 return -1;
270
271 /*
272 * keys will consist of a) keys whose addition to the hash table
273 * will result in shifting of the existing keys to their alternate
274 * locations b) keys whose addition to the hash table will not result
275 * in shifting of the existing keys.
276 */
277 keys = rte_malloc(NULL, sizeof(uint32_t) * TOTAL_INSERT, 0);
278 if (keys == NULL) {
279 printf("RTE_MALLOC failed\n");
280 goto err;
281 }
282
283 /*
284 * keys_no_ks (no key-shifts): Subset of 'keys' - consists of keys that
285 * will NOT result in shifting of the existing keys to their alternate
286 * locations. Roughly around 900K keys.
287 */
288 keys_no_ks = rte_malloc(NULL, sizeof(uint32_t) * TOTAL_INSERT, 0);
289 if (keys_no_ks == NULL) {
290 printf("RTE_MALLOC failed\n");
291 goto err;
292 }
293
294 /*
295 * keys_ks (key-shifts): Subset of 'keys' - consists of keys that will
296 * result in shifting of the existing keys to their alternate locations.
297 * Roughly around 146K keys. There might be repeating keys. More code is
298 * required to filter out these keys which will complicate the test case
299 */
300 keys_ks = rte_malloc(NULL, sizeof(uint32_t) * TOTAL_INSERT, 0);
301 if (keys_ks == NULL) {
302 printf("RTE_MALLOC failed\n");
303 goto err;
304 }
305
306 /* Used to identify keys not inserted in the hash table */
307 found = rte_zmalloc(NULL, sizeof(uint32_t) * TOTAL_INSERT, 0);
308 if (found == NULL) {
309 printf("RTE_MALLOC failed\n");

Callers 1

Calls 15

rte_mallocFunction · 0.85
rte_zmallocFunction · 0.85
rte_hash_hashFunction · 0.85
check_bucketFunction · 0.85
rte_hash_add_key_dataFunction · 0.85
rte_hash_iterateFunction · 0.85
memsetFunction · 0.85
rte_hash_add_keyFunction · 0.85
rte_freeFunction · 0.85
rte_hash_freeFunction · 0.85
init_paramsFunction · 0.70
get_prim_bucket_indexFunction · 0.70

Tested by

no test coverage detected