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

Function mem_copy_benchmark

dpdk/app/test-dma-perf/benchmark.c:367–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367void
368mem_copy_benchmark(struct test_configure *cfg, bool is_dma)
369{
370 uint16_t i;
371 uint32_t offset;
372 unsigned int lcore_id = 0;
373 struct rte_mbuf **srcs = NULL, **dsts = NULL;
374 struct lcore_dma_map_t *ldm = &cfg->lcore_dma_map;
375 unsigned int buf_size = cfg->buf_size.cur;
376 uint16_t kick_batch = cfg->kick_batch.cur;
377 uint32_t nr_buf = cfg->nr_buf = (cfg->mem_size.cur * 1024 * 1024) / (cfg->buf_size.cur * 2);
378 uint16_t nb_workers = ldm->cnt;
379 uint16_t test_secs = cfg->test_secs;
380 float memory = 0;
381 uint32_t avg_cycles = 0;
382 uint32_t avg_cycles_total;
383 float mops, mops_total;
384 float bandwidth, bandwidth_total;
385
386 if (setup_memory_env(cfg, &srcs, &dsts) < 0)
387 goto out;
388
389 if (is_dma)
390 if (config_dmadevs(cfg) < 0)
391 goto out;
392
393 if (cfg->cache_flush == 1) {
394 cache_flush_buf(srcs, buf_size, nr_buf);
395 cache_flush_buf(dsts, buf_size, nr_buf);
396 rte_mb();
397 }
398
399 printf("Start testing....\n");
400
401 for (i = 0; i < nb_workers; i++) {
402 lcore_id = ldm->lcores[i];
403 offset = nr_buf / nb_workers * i;
404 lcores[i] = rte_malloc(NULL, sizeof(struct lcore_params), 0);
405 if (lcores[i] == NULL) {
406 printf("lcore parameters malloc failure for lcore %d\n", lcore_id);
407 break;
408 }
409 if (is_dma) {
410 lcores[i]->dma_name = ldm->dma_names[i];
411 lcores[i]->dev_id = ldm->dma_ids[i];
412 lcores[i]->kick_batch = kick_batch;
413 }
414 lcores[i]->worker_id = i;
415 lcores[i]->nr_buf = (uint32_t)(nr_buf / nb_workers);
416 lcores[i]->buf_size = buf_size;
417 lcores[i]->test_secs = test_secs;
418 lcores[i]->srcs = srcs + offset;
419 lcores[i]->dsts = dsts + offset;
420 lcores[i]->scenario_id = cfg->scenario_id;
421 lcores[i]->lcore_id = lcore_id;
422
423 if (is_dma)
424 rte_eal_remote_launch(do_dma_mem_copy, (void *)(lcores[i]), lcore_id);

Callers 1

run_test_caseFunction · 0.85

Calls 13

setup_memory_envFunction · 0.85
config_dmadevsFunction · 0.85
cache_flush_bufFunction · 0.85
rte_mallocFunction · 0.85
rte_eal_remote_launchFunction · 0.85
rte_eal_mp_wait_lcoreFunction · 0.85
output_resultFunction · 0.85
snprintfFunction · 0.85
rte_pktmbuf_free_bulkFunction · 0.85
rte_freeFunction · 0.85
rte_mempool_freeFunction · 0.85
rte_dma_stopFunction · 0.85

Tested by

no test coverage detected