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

Function test_mempool_perf

dpdk/app/test/test_mempool_perf.c:325–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325static int
326test_mempool_perf(void)
327{
328 struct rte_mempool *mp_cache = NULL;
329 struct rte_mempool *mp_nocache = NULL;
330 struct rte_mempool *default_pool = NULL;
331 const char *default_pool_ops;
332 int ret = -1;
333
334 /* create a mempool (without cache) */
335 mp_nocache = rte_mempool_create("perf_test_nocache", MEMPOOL_SIZE,
336 MEMPOOL_ELT_SIZE, 0, 0,
337 NULL, NULL,
338 my_obj_init, NULL,
339 SOCKET_ID_ANY, 0);
340 if (mp_nocache == NULL)
341 goto err;
342
343 /* create a mempool (with cache) */
344 mp_cache = rte_mempool_create("perf_test_cache", MEMPOOL_SIZE,
345 MEMPOOL_ELT_SIZE,
346 RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
347 NULL, NULL,
348 my_obj_init, NULL,
349 SOCKET_ID_ANY, 0);
350 if (mp_cache == NULL)
351 goto err;
352
353 default_pool_ops = rte_mbuf_best_mempool_ops();
354 /* Create a mempool based on Default handler */
355 default_pool = rte_mempool_create_empty("default_pool",
356 MEMPOOL_SIZE,
357 MEMPOOL_ELT_SIZE,
358 0, 0,
359 SOCKET_ID_ANY, 0);
360
361 if (default_pool == NULL) {
362 printf("cannot allocate %s mempool\n", default_pool_ops);
363 goto err;
364 }
365
366 if (rte_mempool_set_ops_byname(default_pool, default_pool_ops, NULL)
367 < 0) {
368 printf("cannot set %s handler\n", default_pool_ops);
369 goto err;
370 }
371
372 if (rte_mempool_populate_default(default_pool) < 0) {
373 printf("cannot populate %s mempool\n", default_pool_ops);
374 goto err;
375 }
376
377 rte_mempool_obj_iter(default_pool, my_obj_init, NULL);
378
379 /* performance test with 1, 2 and max cores */
380 printf("start performance test (without cache)\n");
381
382 if (do_one_mempool_test(mp_nocache, 1) < 0)

Callers

nothing calls this directly

Calls 11

rte_mempool_createFunction · 0.85
rte_mempool_create_emptyFunction · 0.85
rte_mempool_obj_iterFunction · 0.85
do_one_mempool_testFunction · 0.85
rte_lcore_countFunction · 0.85
rte_mempool_list_dumpFunction · 0.85
rte_mempool_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected