Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/7309/?format=api
https://patches.dpdk.org/api/patches/7309/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1443615142-24381-5-git-send-email-bruce.richardson@intel.com/", "project": { "id": 1, "url": "https://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": "<1443615142-24381-5-git-send-email-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1443615142-24381-5-git-send-email-bruce.richardson@intel.com", "date": "2015-09-30T12:12:22", "name": "[dpdk-dev,4/4] test: Add perf test for ring pmd", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "cd38863ead0de22638f9496d5274b9c4b9cf2b43", "submitter": { "id": 20, "url": "https://patches.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1443615142-24381-5-git-send-email-bruce.richardson@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/7309/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/7309/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 7E9F28E61;\n\tWed, 30 Sep 2015 14:12:29 +0200 (CEST)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 735C58DAA\n\tfor <dev@dpdk.org>; Wed, 30 Sep 2015 14:12:25 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga101.fm.intel.com with ESMTP; 30 Sep 2015 05:12:25 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga001.fm.intel.com with ESMTP; 30 Sep 2015 05:12:23 -0700", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tt8UCCMhT015014; Wed, 30 Sep 2015 13:12:22 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id t8UCCMwb024444;\n\tWed, 30 Sep 2015 13:12:22 +0100", "(from bricha3@localhost)\n\tby sivswdev01.ir.intel.com with id t8UCCMDm024440;\n\tWed, 30 Sep 2015 13:12:22 +0100" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.17,612,1437462000\"; d=\"scan'208\";a=\"800473283\"", "From": "Bruce Richardson <bruce.richardson@intel.com>", "To": "dev@dpdk.org", "Date": "Wed, 30 Sep 2015 13:12:22 +0100", "Message-Id": "<1443615142-24381-5-git-send-email-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 1.7.4.1", "In-Reply-To": "<1443615142-24381-1-git-send-email-bruce.richardson@intel.com>", "References": "<1443615142-24381-1-git-send-email-bruce.richardson@intel.com>", "Subject": "[dpdk-dev] [PATCH 4/4] test: Add perf test for ring pmd", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add a performance test for ring pmd, comparing performance of the pmd\ncompared to the basic rte_ring APIs.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n app/test/Makefile | 1 +\n app/test/test_pmd_ring_perf.c | 188 ++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 189 insertions(+)\n create mode 100644 app/test/test_pmd_ring_perf.c", "diff": "diff --git a/app/test/Makefile b/app/test/Makefile\nindex 294618f..14fa502 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -141,6 +141,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += test_link_bonding_mode4.c\n endif\n \n SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c\n+SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c\n SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c\n \n CFLAGS += -O3\ndiff --git a/app/test/test_pmd_ring_perf.c b/app/test/test_pmd_ring_perf.c\nnew file mode 100644\nindex 0000000..3077dba\n--- /dev/null\n+++ b/app/test/test_pmd_ring_perf.c\n@@ -0,0 +1,188 @@\n+/*-\n+ * BSD LICENSE\n+ *\n+ * Copyright(c) 2015 Intel Corporation. All rights reserved.\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions\n+ * are met:\n+ *\n+ * * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ * * Redistributions in binary form must reproduce the above copyright\n+ * notice, this list of conditions and the following disclaimer in\n+ * the documentation and/or other materials provided with the\n+ * distribution.\n+ * * Neither the name of Intel Corporation nor the names of its\n+ * contributors may be used to endorse or promote products derived\n+ * from this software without specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+\n+#include <stdio.h>\n+#include <inttypes.h>\n+#include <rte_ring.h>\n+#include <rte_cycles.h>\n+#include <rte_launch.h>\n+#include <rte_ethdev.h>\n+#include <rte_eth_ring.h>\n+\n+#include \"test.h\"\n+\n+#define RING_NAME \"RING_PERF\"\n+#define RING_SIZE 4096\n+#define MAX_BURST 32\n+\n+/*\n+ * the sizes to enqueue and dequeue in testing\n+ * (marked volatile so they won't be seen as compile-time constants)\n+ */\n+static const volatile unsigned bulk_sizes[] = { 1, 8, 32 };\n+\n+/* The ring structure used for tests */\n+static struct rte_ring *r;\n+static uint8_t ring_ethdev_port;\n+\n+/* Get cycle counts for dequeuing from an empty ring. Should be 2 or 3 cycles */\n+static void\n+test_empty_dequeue(void)\n+{\n+\tconst unsigned iter_shift = 26;\n+\tconst unsigned iterations = 1 << iter_shift;\n+\tunsigned i = 0;\n+\tvoid *burst[MAX_BURST];\n+\n+\tconst uint64_t sc_start = rte_rdtsc();\n+\tfor (i = 0; i < iterations; i++)\n+\t\trte_ring_sc_dequeue_bulk(r, burst, bulk_sizes[0]);\n+\tconst uint64_t sc_end = rte_rdtsc();\n+\n+\tconst uint64_t eth_start = rte_rdtsc();\n+\tfor (i = 0; i < iterations; i++)\n+\t\trte_eth_rx_burst(ring_ethdev_port, 0, (void *)burst,\n+\t\t\t\tbulk_sizes[0]);\n+\tconst uint64_t eth_end = rte_rdtsc();\n+\n+\tprintf(\"Ring empty dequeue : %.1F\\n\",\n+\t\t\t(double)(sc_end - sc_start) / iterations);\n+\tprintf(\"Ethdev empty dequeue: %.1F\\n\",\n+\t\t\t(double)(eth_end - eth_start) / iterations);\n+}\n+\n+/*\n+ * Test function that determines how long an enqueue + dequeue of a single item\n+ * takes on a single lcore. Result is for comparison with the bulk enq+deq.\n+ */\n+static void\n+test_single_enqueue_dequeue(void)\n+{\n+\tconst unsigned iter_shift = 24;\n+\tconst unsigned iterations = 1 << iter_shift;\n+\tunsigned i = 0;\n+\tvoid *burst = NULL;\n+\tstruct rte_mbuf *mburst[1] = { NULL };\n+\n+\tconst uint64_t sc_start = rte_rdtsc_precise();\n+\trte_compiler_barrier();\n+\tfor (i = 0; i < iterations; i++) {\n+\t\trte_ring_enqueue_bulk(r, &burst, 1);\n+\t\trte_ring_dequeue_bulk(r, &burst, 1);\n+\t}\n+\tconst uint64_t sc_end = rte_rdtsc_precise();\n+\trte_compiler_barrier();\n+\n+\tconst uint64_t eth_start = rte_rdtsc_precise();\n+\trte_compiler_barrier();\n+\tfor (i = 0; i < iterations; i++) {\n+\t\trte_eth_tx_burst(ring_ethdev_port, 0, mburst, 1);\n+\t\trte_eth_rx_burst(ring_ethdev_port, 0, mburst, 1);\n+\t}\n+\tconst uint64_t eth_end = rte_rdtsc_precise();\n+\trte_compiler_barrier();\n+\n+\tprintf(\"Ring single enq/dequeue : %\"PRIu64\"\\n\",\n+\t\t\t(sc_end-sc_start) >> iter_shift);\n+\tprintf(\"Ethdev single enq/dequeue: %\"PRIu64\"\\n\",\n+\t\t\t(eth_end-eth_start) >> iter_shift);\n+}\n+\n+/* Times enqueue and dequeue on a single lcore */\n+static void\n+test_bulk_enqueue_dequeue(void)\n+{\n+\tconst unsigned iter_shift = 23;\n+\tconst unsigned iterations = 1 << iter_shift;\n+\tunsigned sz, i = 0;\n+\tstruct rte_mbuf *burst[MAX_BURST] = {0};\n+\n+\tfor (sz = 0; sz < sizeof(bulk_sizes)/sizeof(bulk_sizes[0]); sz++) {\n+\t\tconst uint64_t sc_start = rte_rdtsc();\n+\t\tfor (i = 0; i < iterations; i++) {\n+\t\t\trte_ring_sp_enqueue_bulk(r, (void *)burst, bulk_sizes[sz]);\n+\t\t\trte_ring_sc_dequeue_bulk(r, (void *)burst, bulk_sizes[sz]);\n+\t\t}\n+\t\tconst uint64_t sc_end = rte_rdtsc();\n+\n+\t\tconst uint64_t eth_start = rte_rdtsc_precise();\n+\t\trte_compiler_barrier();\n+\t\tfor (i = 0; i < iterations; i++) {\n+\t\t\trte_eth_tx_burst(ring_ethdev_port, 0, burst, bulk_sizes[sz]);\n+\t\t\trte_eth_rx_burst(ring_ethdev_port, 0, burst, bulk_sizes[sz]);\n+\t\t}\n+\t\tconst uint64_t eth_end = rte_rdtsc_precise();\n+\t\trte_compiler_barrier();\n+\n+\t\tdouble sc_avg = ((double)(sc_end-sc_start) /\n+\t\t\t\t(iterations * bulk_sizes[sz]));\n+\t\tdouble eth_avg = ((double)(eth_end-eth_start) /\n+\t\t\t\t(iterations * bulk_sizes[sz]));\n+\n+\t\tprintf(\"ring bulk enq/deq (size: %u) : %.1F\\n\", bulk_sizes[sz],\n+\t\t\t\tsc_avg);\n+\t\tprintf(\"ethdev bulk enq/deq (size:%u): %.1F\\n\", bulk_sizes[sz],\n+\t\t\t\teth_avg);\n+\n+\t\tprintf(\"\\n\");\n+\t}\n+}\n+\n+static int\n+test_ring_pmd_perf(void)\n+{\n+\tr = rte_ring_create(RING_NAME, RING_SIZE, rte_socket_id(),\n+\t\t\tRING_F_SP_ENQ|RING_F_SC_DEQ);\n+\tif (r == NULL && (r = rte_ring_lookup(RING_NAME)) == NULL)\n+\t\treturn -1;\n+\n+\tring_ethdev_port = rte_eth_from_ring(r);\n+\n+\tprintf(\"\\n### Testing const single element enq/deq ###\\n\");\n+\ttest_single_enqueue_dequeue();\n+\n+\tprintf(\"\\n### Testing empty dequeue ###\\n\");\n+\ttest_empty_dequeue();\n+\n+\tprintf(\"\\n### Testing using a single lcore ###\\n\");\n+\ttest_bulk_enqueue_dequeue();\n+\n+\treturn 0;\n+}\n+\n+static struct test_command ring_pmd_perf_cmd = {\n+\t.command = \"ring_pmd_perf_autotest\",\n+\t.callback = test_ring_pmd_perf,\n+};\n+REGISTER_TEST_COMMAND(ring_pmd_perf_cmd);\n", "prefixes": [ "dpdk-dev", "4/4" ] }{ "id": 7309, "url": "