get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/53887/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 53887,
    "url": "http://patches.dpdk.org/api/patches/53887/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1559203588-24046-5-git-send-email-tomaszx.jozwiak@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1559203588-24046-5-git-send-email-tomaszx.jozwiak@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1559203588-24046-5-git-send-email-tomaszx.jozwiak@intel.com",
    "date": "2019-05-30T08:06:25",
    "name": "[v1,4/7] app/test-compress-perf: add benchmark test case",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "18c3050e742493be6cdef6134369a2e730c03592",
    "submitter": {
        "id": 949,
        "url": "http://patches.dpdk.org/api/people/949/?format=api",
        "name": "Tomasz Jozwiak",
        "email": "tomaszx.jozwiak@intel.com"
    },
    "delegate": {
        "id": 6690,
        "url": "http://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1559203588-24046-5-git-send-email-tomaszx.jozwiak@intel.com/mbox/",
    "series": [
        {
            "id": 4821,
            "url": "http://patches.dpdk.org/api/series/4821/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4821",
            "date": "2019-05-30T08:06:21",
            "name": "add multiple cores feature to test-compress-perf",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4821/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/53887/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/53887/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 12F1F1B995;\n\tThu, 30 May 2019 10:06:48 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 9C51B1B958\n\tfor <dev@dpdk.org>; Thu, 30 May 2019 10:06:43 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 May 2019 01:06:43 -0700",
            "from tjozwiax-mobl1.ger.corp.intel.com (HELO localhost.localdomain)\n\t([10.103.104.46])\n\tby fmsmga001.fm.intel.com with ESMTP; 30 May 2019 01:06:41 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Tomasz Jozwiak <tomaszx.jozwiak@intel.com>",
        "To": "dev@dpdk.org, fiona.trahe@intel.com,\n\ttjozwiakgm.gmail.com@dpdk.org, shallyv@marvell.com",
        "Date": "Thu, 30 May 2019 10:06:25 +0200",
        "Message-Id": "<1559203588-24046-5-git-send-email-tomaszx.jozwiak@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1559203588-24046-1-git-send-email-tomaszx.jozwiak@intel.com>",
        "References": "<1559203588-24046-1-git-send-email-tomaszx.jozwiak@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v1 4/7] app/test-compress-perf: add benchmark\n\ttest case",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch adds a benchmark part to\ncompression-perf-tool as a separate test case, which can be\nexecuted multi-threaded.\n\nSigned-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>\n---\n app/test-compress-perf/Makefile                   |   1 +\n app/test-compress-perf/comp_perf_test_benchmark.c | 139 ++++++++++++++++------\n app/test-compress-perf/comp_perf_test_benchmark.h |  25 +++-\n app/test-compress-perf/main.c                     |   1 +\n app/test-compress-perf/meson.build                |   1 +\n 5 files changed, 129 insertions(+), 38 deletions(-)",
    "diff": "diff --git a/app/test-compress-perf/Makefile b/app/test-compress-perf/Makefile\nindex f54d9a4..d1a6820 100644\n--- a/app/test-compress-perf/Makefile\n+++ b/app/test-compress-perf/Makefile\n@@ -13,6 +13,7 @@ CFLAGS += -O3\n SRCS-y := main.c\n SRCS-y += comp_perf_options_parse.c\n SRCS-y += comp_perf_test_verify.c\n+SRCS-y += comp_perf_test_benchmark.c\n SRCS-y += comp_perf_test_common.c\n \n include $(RTE_SDK)/mk/rte.app.mk\ndiff --git a/app/test-compress-perf/comp_perf_test_benchmark.c b/app/test-compress-perf/comp_perf_test_benchmark.c\nindex 5752906..9b0b146 100644\n--- a/app/test-compress-perf/comp_perf_test_benchmark.c\n+++ b/app/test-compress-perf/comp_perf_test_benchmark.c\n@@ -10,11 +10,45 @@\n \n #include \"comp_perf_test_benchmark.h\"\n \n+void\n+cperf_benchmark_test_destructor(void *arg)\n+{\n+\tif (arg) {\n+\t\tcomp_perf_free_memory(\n+\t\t\t\t&((struct cperf_benchmark_ctx *)arg)->ver.mem);\n+\t\trte_free(arg);\n+\t}\n+}\n+\n+void *\n+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,\n+\t\tstruct comp_test_data *options)\n+{\n+\tstruct cperf_benchmark_ctx *ctx = NULL;\n+\n+\tctx = rte_malloc(NULL, sizeof(struct cperf_benchmark_ctx), 0);\n+\n+\tif (ctx != NULL) {\n+\t\tctx->ver.mem.dev_id = dev_id;\n+\t\tctx->ver.mem.qp_id = qp_id;\n+\t\tctx->ver.options = options;\n+\t\tctx->ver.silent = 1; /* ver. part will be silent */\n+\n+\t\tif (!comp_perf_allocate_memory(ctx->ver.options, &ctx->ver.mem)\n+\t\t\t      && !prepare_bufs(ctx->ver.options, &ctx->ver.mem))\n+\t\t\treturn ctx;\n+\t}\n+\n+\tcperf_benchmark_test_destructor(ctx);\n+\treturn NULL;\n+}\n+\n static int\n-main_loop(struct comp_test_data *test_data, uint8_t level,\n-\t\t\tenum rte_comp_xform_type type)\n+main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type)\n {\n-\tuint8_t dev_id = test_data->cdev_id;\n+\tstruct comp_test_data *test_data = ctx->ver.options;\n+\tstruct cperf_mem_resources *mem = &ctx->ver.mem;\n+\tuint8_t dev_id = mem->dev_id;\n \tuint32_t i, iter, num_iter;\n \tstruct rte_comp_op **ops, **deq_ops;\n \tvoid *priv_xform = NULL;\n@@ -31,7 +65,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t}\n \n \tops = rte_zmalloc_socket(NULL,\n-\t\t2 * test_data->total_bufs * sizeof(struct rte_comp_op *),\n+\t\t2 * mem->total_bufs * sizeof(struct rte_comp_op *),\n \t\t0, rte_socket_id());\n \n \tif (ops == NULL) {\n@@ -40,7 +74,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t\treturn -1;\n \t}\n \n-\tdeq_ops = &ops[test_data->total_bufs];\n+\tdeq_ops = &ops[mem->total_bufs];\n \n \tif (type == RTE_COMP_COMPRESS) {\n \t\txform = (struct rte_comp_xform) {\n@@ -48,14 +82,14 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t\t\t.compress = {\n \t\t\t\t.algo = RTE_COMP_ALGO_DEFLATE,\n \t\t\t\t.deflate.huffman = test_data->huffman_enc,\n-\t\t\t\t.level = level,\n+\t\t\t\t.level = test_data->level,\n \t\t\t\t.window_size = test_data->window_sz,\n \t\t\t\t.chksum = RTE_COMP_CHECKSUM_NONE,\n \t\t\t\t.hash_algo = RTE_COMP_HASH_ALGO_NONE\n \t\t\t}\n \t\t};\n-\t\tinput_bufs = test_data->decomp_bufs;\n-\t\toutput_bufs = test_data->comp_bufs;\n+\t\tinput_bufs = mem->decomp_bufs;\n+\t\toutput_bufs = mem->comp_bufs;\n \t\tout_seg_sz = test_data->out_seg_sz;\n \t} else {\n \t\txform = (struct rte_comp_xform) {\n@@ -67,8 +101,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t\t\t\t.hash_algo = RTE_COMP_HASH_ALGO_NONE\n \t\t\t}\n \t\t};\n-\t\tinput_bufs = test_data->comp_bufs;\n-\t\toutput_bufs = test_data->decomp_bufs;\n+\t\tinput_bufs = mem->comp_bufs;\n+\t\toutput_bufs = mem->decomp_bufs;\n \t\tout_seg_sz = test_data->seg_sz;\n \t}\n \n@@ -82,13 +116,13 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \n \tuint64_t tsc_start, tsc_end, tsc_duration;\n \n-\ttsc_start = tsc_end = tsc_duration = 0;\n-\ttsc_start = rte_rdtsc();\n \tnum_iter = test_data->num_iter;\n+\ttsc_start = tsc_end = tsc_duration = 0;\n+\ttsc_start = rte_rdtsc_precise();\n \n \tfor (iter = 0; iter < num_iter; iter++) {\n-\t\tuint32_t total_ops = test_data->total_bufs;\n-\t\tuint32_t remaining_ops = test_data->total_bufs;\n+\t\tuint32_t total_ops = mem->total_bufs;\n+\t\tuint32_t remaining_ops = mem->total_bufs;\n \t\tuint32_t total_deq_ops = 0;\n \t\tuint32_t total_enq_ops = 0;\n \t\tuint16_t ops_unused = 0;\n@@ -113,7 +147,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \n \t\t\t/* Allocate compression operations */\n \t\t\tif (ops_needed && !rte_comp_op_bulk_alloc(\n-\t\t\t\t\t\ttest_data->op_pool,\n+\t\t\t\t\t\tmem->op_pool,\n \t\t\t\t\t\t&ops[ops_unused],\n \t\t\t\t\t\tops_needed)) {\n \t\t\t\tRTE_LOG(ERR, USER1,\n@@ -149,7 +183,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t\t\t\tops[op_id]->private_xform = priv_xform;\n \t\t\t}\n \n-\t\t\tnum_enq = rte_compressdev_enqueue_burst(dev_id, 0, ops,\n+\t\t\tnum_enq = rte_compressdev_enqueue_burst(dev_id,\n+\t\t\t\t\t\t\t\tmem->qp_id, ops,\n \t\t\t\t\t\t\t\tnum_ops);\n \t\t\tif (num_enq == 0) {\n \t\t\t\tstruct rte_compressdev_stats stats;\n@@ -165,7 +200,8 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t\t\tremaining_ops -= num_enq;\n \t\t\ttotal_enq_ops += num_enq;\n \n-\t\t\tnum_deq = rte_compressdev_dequeue_burst(dev_id, 0,\n+\t\t\tnum_deq = rte_compressdev_dequeue_burst(dev_id,\n+\t\t\t\t\t\t\t   mem->qp_id,\n \t\t\t\t\t\t\t   deq_ops,\n \t\t\t\t\t\t\t   test_data->burst_sz);\n \t\t\ttotal_deq_ops += num_deq;\n@@ -177,7 +213,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t\t\t\t\tif (op->status !=\n \t\t\t\t\t\tRTE_COMP_OP_STATUS_SUCCESS) {\n \t\t\t\t\t\tRTE_LOG(ERR, USER1,\n-\t\t\t\t\t\t\t\"Some operations were not successful\\n\");\n+\t\t\t\t       \"Some operations were not successful\\n\");\n \t\t\t\t\t\tgoto end;\n \t\t\t\t\t}\n \n@@ -198,15 +234,17 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n-\t\t\trte_mempool_put_bulk(test_data->op_pool,\n+\t\t\trte_mempool_put_bulk(mem->op_pool,\n \t\t\t\t\t     (void **)deq_ops, num_deq);\n \t\t\tallocated -= num_deq;\n \t\t}\n \n \t\t/* Dequeue the last operations */\n \t\twhile (total_deq_ops < total_ops) {\n-\t\t\tnum_deq = rte_compressdev_dequeue_burst(dev_id, 0,\n-\t\t\t\t\t\tdeq_ops, test_data->burst_sz);\n+\t\t\tnum_deq = rte_compressdev_dequeue_burst(dev_id,\n+\t\t\t\t\t\t\t   mem->qp_id,\n+\t\t\t\t\t\t\t   deq_ops,\n+\t\t\t\t\t\t\t   test_data->burst_sz);\n \t\t\tif (num_deq == 0) {\n \t\t\t\tstruct rte_compressdev_stats stats;\n \n@@ -226,7 +264,7 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t\t\t\t\tif (op->status !=\n \t\t\t\t\t\tRTE_COMP_OP_STATUS_SUCCESS) {\n \t\t\t\t\t\tRTE_LOG(ERR, USER1,\n-\t\t\t\t\t\t\t\"Some operations were not successful\\n\");\n+\t\t\t\t       \"Some operations were not successful\\n\");\n \t\t\t\t\t\tgoto end;\n \t\t\t\t\t}\n \n@@ -247,65 +285,92 @@ main_loop(struct comp_test_data *test_data, uint8_t level,\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n-\t\t\trte_mempool_put_bulk(test_data->op_pool,\n+\t\t\trte_mempool_put_bulk(mem->op_pool,\n \t\t\t\t\t     (void **)deq_ops, num_deq);\n \t\t\tallocated -= num_deq;\n \t\t}\n \t}\n \n-\ttsc_end = rte_rdtsc();\n+\ttsc_end = rte_rdtsc_precise();\n \ttsc_duration = tsc_end - tsc_start;\n \n \tif (type == RTE_COMP_COMPRESS)\n-\t\ttest_data->comp_tsc_duration[level] =\n+\t\tctx->comp_tsc_duration[test_data->level] =\n \t\t\t\ttsc_duration / num_iter;\n \telse\n-\t\ttest_data->decomp_tsc_duration[level] =\n+\t\tctx->decomp_tsc_duration[test_data->level] =\n \t\t\t\ttsc_duration / num_iter;\n \n end:\n-\trte_mempool_put_bulk(test_data->op_pool, (void **)ops, allocated);\n+\trte_mempool_put_bulk(mem->op_pool, (void **)ops, allocated);\n \trte_compressdev_private_xform_free(dev_id, priv_xform);\n \trte_free(ops);\n \treturn res;\n }\n \n int\n-cperf_benchmark(struct comp_test_data *test_data, uint8_t level)\n+cperf_benchmark_test_runner(void *test_ctx)\n {\n+\tstruct cperf_benchmark_ctx *ctx = test_ctx;\n+\tstruct comp_test_data *test_data = ctx->ver.options;\n+\tuint32_t lcore = rte_lcore_id();\n+\tstatic rte_atomic16_t display_once = RTE_ATOMIC16_INIT(0);\n+\n+\tctx->ver.mem.lcore_id = lcore;\n \tint i, ret = EXIT_SUCCESS;\n \n \t/*\n+\t * First the verification part is needed\n+\t */\n+\tif (cperf_verify_test_runner(&ctx->ver)) {\n+\t\tret =  EXIT_FAILURE;\n+\t\tgoto end;\n+\t}\n+\n+\t/*\n \t * Run the tests twice, discarding the first performance\n \t * results, before the cache is warmed up\n \t */\n \tfor (i = 0; i < 2; i++) {\n-\t\tif (main_loop(test_data, level, RTE_COMP_COMPRESS) < 0) {\n+\t\tif (main_loop(ctx, RTE_COMP_COMPRESS) < 0) {\n \t\t\tret = EXIT_FAILURE;\n \t\t\tgoto end;\n \t\t}\n \t}\n \n \tfor (i = 0; i < 2; i++) {\n-\t\tif (main_loop(test_data, level, RTE_COMP_DECOMPRESS) < 0) {\n+\t\tif (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) {\n \t\t\tret = EXIT_FAILURE;\n \t\t\tgoto end;\n \t\t}\n \t}\n \n-\ttest_data->comp_tsc_byte =\n-\t\t\t(double)(test_data->comp_tsc_duration[level]) /\n+\tctx->comp_tsc_byte =\n+\t\t\t(double)(ctx->comp_tsc_duration[test_data->level]) /\n \t\t\t\t\ttest_data->input_data_sz;\n \n-\ttest_data->decomp_tsc_byte =\n-\t\t\t(double)(test_data->decomp_tsc_duration[level]) /\n+\tctx->decomp_tsc_byte =\n+\t\t\t(double)(ctx->decomp_tsc_duration[test_data->level]) /\n \t\t\t\t\ttest_data->input_data_sz;\n \n-\ttest_data->comp_gbps = rte_get_tsc_hz() / test_data->comp_tsc_byte * 8 /\n+\tctx->comp_gbps = rte_get_tsc_hz() / (ctx->comp_tsc_byte * 8) /\n+\t\t\t1000000000;\n+\n+\tctx->decomp_gbps = rte_get_tsc_hz() / (ctx->decomp_tsc_byte * 8) /\n \t\t\t1000000000;\n \n-\ttest_data->decomp_gbps = rte_get_tsc_hz() / test_data->decomp_tsc_byte\n-\t\t\t* 8 / 1000000000;\n+\tif (rte_atomic16_test_and_set(&display_once)) {\n+\t\tprintf(\"%12s%6s%12s%17s%15s%16s\\n\",\n+\t\t\t\"lcore id\", \"Level\", \"Comp size\", \"Comp ratio [%]\",\n+\t\t\t\"Comp [Gbps]\", \"Decomp [Gbps]\");\n+\t}\n+\n+\tprintf(\"%12u%6u%12zu%17.2f%15.2f%16.2f\\n\",\n+\t\tctx->ver.mem.lcore_id,\n+\t\ttest_data->level, ctx->ver.comp_data_sz, ctx->ver.ratio,\n+\t\tctx->comp_gbps,\n+\t\tctx->decomp_gbps);\n+\n end:\n \treturn ret;\n }\ndiff --git a/app/test-compress-perf/comp_perf_test_benchmark.h b/app/test-compress-perf/comp_perf_test_benchmark.h\nindex b193445..d9b2694 100644\n--- a/app/test-compress-perf/comp_perf_test_benchmark.h\n+++ b/app/test-compress-perf/comp_perf_test_benchmark.h\n@@ -5,9 +5,32 @@\n #ifndef _COMP_PERF_TEST_BENCHMARK_\n #define _COMP_PERF_TEST_BENCHMARK_\n \n+#include <stdint.h>\n+\n #include \"comp_perf_options.h\"\n+#include \"comp_perf_test_common.h\"\n+#include \"comp_perf_test_verify.h\"\n+\n+struct cperf_benchmark_ctx {\n+\tstruct cperf_verify_ctx ver;\n+\n+\t/* Store TSC duration for all levels (including level 0) */\n+\tuint64_t comp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];\n+\tuint64_t decomp_tsc_duration[RTE_COMP_LEVEL_MAX + 1];\n+\tdouble comp_gbps;\n+\tdouble decomp_gbps;\n+\tdouble comp_tsc_byte;\n+\tdouble decomp_tsc_byte;\n+};\n+\n+void\n+cperf_benchmark_test_destructor(void *arg);\n \n int\n-cperf_benchmark(struct comp_test_data *test_data, uint8_t level);\n+cperf_benchmark_test_runner(void *test_ctx);\n+\n+void *\n+cperf_benchmark_test_constructor(uint8_t dev_id, uint16_t qp_id,\n+\t\tstruct comp_test_data *options);\n \n #endif\ndiff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c\nindex 813b205..c8be84e 100644\n--- a/app/test-compress-perf/main.c\n+++ b/app/test-compress-perf/main.c\n@@ -9,6 +9,7 @@\n \n #include \"comp_perf_options.h\"\n #include \"comp_perf_test_verify.h\"\n+#include \"comp_perf_test_benchmark.h\"\n #include \"comp_perf.h\"\n #include \"comp_perf_test_common.h\"\n \ndiff --git a/app/test-compress-perf/meson.build b/app/test-compress-perf/meson.build\nindex c6246e5..1136f04 100644\n--- a/app/test-compress-perf/meson.build\n+++ b/app/test-compress-perf/meson.build\n@@ -5,5 +5,6 @@ allow_experimental_apis = true\n sources = files('comp_perf_options_parse.c',\n \t\t'main.c',\n \t\t'comp_perf_test_verify.c',\n+\t\t'comp_perf_test_benchmark.c',\n \t\t'comp_perf_test_common.c')\n deps = ['compressdev']\n",
    "prefixes": [
        "v1",
        "4/7"
    ]
}