get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 68204,
    "url": "http://patches.dpdk.org/api/patches/68204/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200411141428.1987768-15-jerinj@marvell.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": "<20200411141428.1987768-15-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200411141428.1987768-15-jerinj@marvell.com",
    "date": "2020-04-11T14:14:13",
    "name": "[v5,14/29] graph: add performance testcase",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7630bcf3c580e0bfc6dfd1a25b7a857ab8420aae",
    "submitter": {
        "id": 1188,
        "url": "http://patches.dpdk.org/api/people/1188/?format=api",
        "name": "Jerin Jacob Kollanukkaran",
        "email": "jerinj@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200411141428.1987768-15-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 9314,
            "url": "http://patches.dpdk.org/api/series/9314/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9314",
            "date": "2020-04-11T14:13:59",
            "name": "graph: introduce graph subsystem",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/9314/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/68204/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/68204/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8D872A059F;\n\tSat, 11 Apr 2020 16:17:19 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2A6A41C1C3;\n\tSat, 11 Apr 2020 16:15:29 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 9548E1C2A2\n for <dev@dpdk.org>; Sat, 11 Apr 2020 16:15:27 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n 03BEADca016859; Sat, 11 Apr 2020 07:15:25 -0700",
            "from sc-exch02.marvell.com ([199.233.58.182])\n by mx0a-0016f401.pphosted.com with ESMTP id 30bb8q8n5t-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Sat, 11 Apr 2020 07:15:24 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH02.marvell.com\n (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Sat, 11 Apr 2020 07:15:23 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;\n Sat, 11 Apr 2020 07:15:22 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Sat, 11 Apr 2020 07:15:22 -0700",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id 0902F3F7043;\n Sat, 11 Apr 2020 07:15:18 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0818;\n bh=1CO12LDc7TMrY+ohCxPIsmXQUhMCHX4xljsrUHg/lxo=;\n b=R5nfLhY38uoqwPhDwkGthD+zNUhRnH7PaXxysJms62DwWG9BxmhhJgczi1/cBYalkK5h\n wjcVUs7cLtrZWx/2IccLYDM6JlFUEjdOvQyKvB/c3Xh57oHuaMlWqDGNuMyxOTNvP7PB\n d89kiGW2XhTmRp5uPEz9MKOtyKi2yw8NK15F5KyEPKHwZ0NHyS0/01I+O9jN6qxc7YcR\n UgG6ITlxl4UJsYjzmyJI0gjSwBBA8SKkpX5qmt1YsA0ZmyANGfEZl7xCyX+ARK6LoNdA\n j348DWEKLzrXJ/DI8mTC2MJvT+wcE5Xk+/3hWvPbayooucC7/tQNvJnTU1t8nXlJjkN6 GQ==",
        "From": "<jerinj@marvell.com>",
        "To": "",
        "CC": "<dev@dpdk.org>, <thomas@monjalon.net>, <david.marchand@redhat.com>,\n <mdr@ashroe.eu>, <mattias.ronnblom@ericsson.com>,\n <kirankumark@marvell.com>, <pbhagavatula@marvell.com>,\n <ndabilpuram@marvell.com>, <xiao.w.wang@intel.com>, <amo@semihalf.com>",
        "Date": "Sat, 11 Apr 2020 19:44:13 +0530",
        "Message-ID": "<20200411141428.1987768-15-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20200411141428.1987768-1-jerinj@marvell.com>",
        "References": "<20200405085613.1336841-1-jerinj@marvell.com>\n <20200411141428.1987768-1-jerinj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676\n definitions=2020-04-11_04:2020-04-09,\n 2020-04-11 signatures=0",
        "Subject": "[dpdk-dev]  [PATCH v5 14/29] graph: add performance testcase",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Pavan Nikhilesh <pbhagavatula@marvell.com>\n\nAdd unit test framework to create and test performance of various graph\nmodels.\n\nexample command to test:\n\necho \"graph_perf_autotest\" | sudo ./build/app/test/dpdk-test -c 0x30\n\nSigned-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>\nSigned-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>\n---\n app/test/Makefile          |    1 +\n app/test/meson.build       |    1 +\n app/test/test_graph_perf.c | 1057 ++++++++++++++++++++++++++++++++++++\n 3 files changed, 1059 insertions(+)\n create mode 100644 app/test/test_graph_perf.c",
    "diff": "diff --git a/app/test/Makefile b/app/test/Makefile\nindex ce2e08e12..77276f300 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -223,6 +223,7 @@ endif\n \n ifeq ($(CONFIG_RTE_LIBRTE_GRAPH), y)\n SRCS-y += test_graph.c\n+SRCS-y += test_graph_perf.c\n endif\n \n ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y)\ndiff --git a/app/test/meson.build b/app/test/meson.build\nindex 3cf850584..9006cc074 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -52,6 +52,7 @@ test_sources = files('commands.c',\n \t'test_func_reentrancy.c',\n \t'test_flow_classify.c',\n \t'test_graph.c',\n+\t'test_graph_perf.c',\n \t'test_hash.c',\n \t'test_hash_functions.c',\n \t'test_hash_multiwriter.c',\ndiff --git a/app/test/test_graph_perf.c b/app/test/test_graph_perf.c\nnew file mode 100644\nindex 000000000..3089fb24c\n--- /dev/null\n+++ b/app/test/test_graph_perf.c\n@@ -0,0 +1,1057 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2020 Marvell International Ltd.\n+ */\n+#include <inttypes.h>\n+#include <signal.h>\n+#include <stdio.h>\n+#include <unistd.h>\n+\n+#include <rte_common.h>\n+#include <rte_cycles.h>\n+#include <rte_errno.h>\n+#include <rte_graph.h>\n+#include <rte_graph_worker.h>\n+#include <rte_lcore.h>\n+#include <rte_malloc.h>\n+#include <rte_mbuf.h>\n+\n+#include \"test.h\"\n+\n+#define TEST_GRAPH_PERF_MZ\t     \"graph_perf_data\"\n+#define TEST_GRAPH_SRC_NAME\t     \"test_graph_perf_source\"\n+#define TEST_GRAPH_SRC_BRST_ONE_NAME \"test_graph_perf_source_one\"\n+#define TEST_GRAPH_WRK_NAME\t     \"test_graph_perf_worker\"\n+#define TEST_GRAPH_SNK_NAME\t     \"test_graph_perf_sink\"\n+\n+#define SOURCES(map)\t     RTE_DIM(map)\n+#define STAGES(map)\t     RTE_DIM(map)\n+#define NODES_PER_STAGE(map) RTE_DIM(map[0])\n+#define SINKS(map)\t     RTE_DIM(map[0])\n+\n+#define MAX_EDGES_PER_NODE 7\n+\n+struct test_node_data {\n+\tuint8_t node_id;\n+\tuint8_t is_sink;\n+\tuint8_t next_nodes[MAX_EDGES_PER_NODE];\n+\tuint8_t next_percentage[MAX_EDGES_PER_NODE];\n+};\n+\n+struct test_graph_perf {\n+\tuint16_t nb_nodes;\n+\trte_graph_t graph_id;\n+\tstruct test_node_data *node_data;\n+};\n+\n+struct graph_lcore_data {\n+\tuint8_t done;\n+\trte_graph_t graph_id;\n+};\n+\n+static struct test_node_data *\n+graph_get_node_data(struct test_graph_perf *graph_data, rte_node_t id)\n+{\n+\tstruct test_node_data *node_data = NULL;\n+\tint i;\n+\n+\tfor (i = 0; i < graph_data->nb_nodes; i++)\n+\t\tif (graph_data->node_data[i].node_id == id) {\n+\t\t\tnode_data = &graph_data->node_data[i];\n+\t\t\tbreak;\n+\t\t}\n+\n+\treturn node_data;\n+}\n+\n+static int\n+test_node_ctx_init(const struct rte_graph *graph, struct rte_node *node)\n+{\n+\tstruct test_graph_perf *graph_data;\n+\tstruct test_node_data *node_data;\n+\tconst struct rte_memzone *mz;\n+\trte_node_t nid = node->id;\n+\trte_edge_t edge = 0;\n+\tint i;\n+\n+\tRTE_SET_USED(graph);\n+\n+\tmz = rte_memzone_lookup(TEST_GRAPH_PERF_MZ);\n+\tgraph_data = mz->addr;\n+\tnode_data = graph_get_node_data(graph_data, nid);\n+\tnode->ctx[0] = node->nb_edges;\n+\tfor (i = 0; i < node->nb_edges && !node_data->is_sink; i++, edge++) {\n+\t\tnode->ctx[i + 1] = edge;\n+\t\tnode->ctx[i + 9] = node_data->next_percentage[i];\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/* Source node function */\n+static uint16_t\n+test_perf_node_worker_source(struct rte_graph *graph, struct rte_node *node,\n+\t\t\t     void **objs, uint16_t nb_objs)\n+{\n+\tuint16_t count;\n+\tint i;\n+\n+\tRTE_SET_USED(objs);\n+\tRTE_SET_USED(nb_objs);\n+\n+\t/* Create a proportional stream for every next */\n+\tfor (i = 0; i < node->ctx[0]; i++) {\n+\t\tcount = (node->ctx[i + 9] * RTE_GRAPH_BURST_SIZE) / 100;\n+\t\trte_node_next_stream_get(graph, node, node->ctx[i + 1], count);\n+\t\trte_node_next_stream_put(graph, node, node->ctx[i + 1], count);\n+\t}\n+\n+\treturn RTE_GRAPH_BURST_SIZE;\n+}\n+\n+static struct rte_node_register test_graph_perf_source = {\n+\t.name = TEST_GRAPH_SRC_NAME,\n+\t.process = test_perf_node_worker_source,\n+\t.flags = RTE_NODE_SOURCE_F,\n+\t.init = test_node_ctx_init,\n+};\n+\n+RTE_NODE_REGISTER(test_graph_perf_source);\n+\n+static uint16_t\n+test_perf_node_worker_source_burst_one(struct rte_graph *graph,\n+\t\t\t\t       struct rte_node *node, void **objs,\n+\t\t\t\t       uint16_t nb_objs)\n+{\n+\tuint16_t count;\n+\tint i;\n+\n+\tRTE_SET_USED(objs);\n+\tRTE_SET_USED(nb_objs);\n+\n+\t/* Create a proportional stream for every next */\n+\tfor (i = 0; i < node->ctx[0]; i++) {\n+\t\tcount = (node->ctx[i + 9]) / 100;\n+\t\trte_node_next_stream_get(graph, node, node->ctx[i + 1], count);\n+\t\trte_node_next_stream_put(graph, node, node->ctx[i + 1], count);\n+\t}\n+\n+\treturn 1;\n+}\n+\n+static struct rte_node_register test_graph_perf_source_burst_one = {\n+\t.name = TEST_GRAPH_SRC_BRST_ONE_NAME,\n+\t.process = test_perf_node_worker_source_burst_one,\n+\t.flags = RTE_NODE_SOURCE_F,\n+\t.init = test_node_ctx_init,\n+};\n+\n+RTE_NODE_REGISTER(test_graph_perf_source_burst_one);\n+\n+/* Worker node function */\n+static uint16_t\n+test_perf_node_worker(struct rte_graph *graph, struct rte_node *node,\n+\t\t      void **objs, uint16_t nb_objs)\n+{\n+\tuint16_t next = 0;\n+\tuint16_t enq = 0;\n+\tuint16_t count;\n+\tint i;\n+\n+\t/* Move stream for single next node */\n+\tif (node->ctx[0] == 1) {\n+\t\trte_node_next_stream_move(graph, node, node->ctx[1]);\n+\t\treturn nb_objs;\n+\t}\n+\n+\t/* Enqueue objects to next nodes proportionally */\n+\tfor (i = 0; i < node->ctx[0]; i++) {\n+\t\tnext = node->ctx[i + 1];\n+\t\tcount = (node->ctx[i + 9] * nb_objs) / 100;\n+\t\tenq += count;\n+\t\twhile (count) {\n+\t\t\tswitch (count & (4 - 1)) {\n+\t\t\tcase 0:\n+\t\t\t\trte_node_enqueue_x4(graph, node, next, objs[0],\n+\t\t\t\t\t\t    objs[1], objs[2], objs[3]);\n+\t\t\t\tobjs += 4;\n+\t\t\t\tcount -= 4;\n+\t\t\t\tbreak;\n+\t\t\tcase 1:\n+\t\t\t\trte_node_enqueue_x1(graph, node, next, objs[0]);\n+\t\t\t\tobjs += 1;\n+\t\t\t\tcount -= 1;\n+\t\t\t\tbreak;\n+\t\t\tcase 2:\n+\t\t\t\trte_node_enqueue_x2(graph, node, next, objs[0],\n+\t\t\t\t\t\t    objs[1]);\n+\t\t\t\tobjs += 2;\n+\t\t\t\tcount -= 2;\n+\t\t\t\tbreak;\n+\t\t\tcase 3:\n+\t\t\t\trte_node_enqueue_x2(graph, node, next, objs[0],\n+\t\t\t\t\t\t    objs[1]);\n+\t\t\t\trte_node_enqueue_x1(graph, node, next, objs[0]);\n+\t\t\t\tobjs += 3;\n+\t\t\t\tcount -= 3;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\tif (enq != nb_objs)\n+\t\trte_node_enqueue(graph, node, next, objs, nb_objs - enq);\n+\n+\treturn nb_objs;\n+}\n+\n+static struct rte_node_register test_graph_perf_worker = {\n+\t.name = TEST_GRAPH_WRK_NAME,\n+\t.process = test_perf_node_worker,\n+\t.init = test_node_ctx_init,\n+};\n+\n+RTE_NODE_REGISTER(test_graph_perf_worker);\n+\n+/* Last node in graph a.k.a sink node */\n+static uint16_t\n+test_perf_node_sink(struct rte_graph *graph, struct rte_node *node, void **objs,\n+\t\t    uint16_t nb_objs)\n+{\n+\tRTE_SET_USED(graph);\n+\tRTE_SET_USED(node);\n+\tRTE_SET_USED(objs);\n+\tRTE_SET_USED(nb_objs);\n+\n+\treturn nb_objs;\n+}\n+\n+static struct rte_node_register test_graph_perf_sink = {\n+\t.name = TEST_GRAPH_SNK_NAME,\n+\t.process = test_perf_node_sink,\n+\t.init = test_node_ctx_init,\n+};\n+\n+RTE_NODE_REGISTER(test_graph_perf_sink);\n+\n+static int\n+graph_perf_setup(void)\n+{\n+\tif (rte_lcore_count() < 2) {\n+\t\tprintf(\"Test requires at least 2 lcores\\n\");\n+\t\treturn TEST_SKIPPED;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void\n+graph_perf_teardown(void)\n+{\n+}\n+\n+static inline rte_node_t\n+graph_node_get(const char *pname, char *nname)\n+{\n+\trte_node_t pnode_id = rte_node_from_name(pname);\n+\tchar lookup_name[RTE_NODE_NAMESIZE];\n+\trte_node_t node_id;\n+\n+\tsnprintf(lookup_name, RTE_NODE_NAMESIZE, \"%s-%s\", pname, nname);\n+\tnode_id = rte_node_from_name(lookup_name);\n+\n+\tif (node_id != RTE_NODE_ID_INVALID) {\n+\t\tif (rte_node_edge_count(node_id))\n+\t\t\trte_node_edge_shrink(node_id, 0);\n+\t\treturn node_id;\n+\t}\n+\n+\treturn rte_node_clone(pnode_id, nname);\n+}\n+\n+static uint16_t\n+graph_node_count_edges(uint32_t stage, uint16_t node, uint16_t nodes_per_stage,\n+\t\t       uint8_t edge_map[][nodes_per_stage][nodes_per_stage],\n+\t\t       char *ename[], struct test_node_data *node_data,\n+\t\t       rte_node_t **node_map)\n+{\n+\tuint8_t total_percent = 0;\n+\tuint16_t edges = 0;\n+\tint i;\n+\n+\tfor (i = 0; i < nodes_per_stage && edges < MAX_EDGES_PER_NODE; i++) {\n+\t\tif (edge_map[stage + 1][i][node]) {\n+\t\t\tename[edges] = malloc(sizeof(char) * RTE_NODE_NAMESIZE);\n+\t\t\tsnprintf(ename[edges], RTE_NODE_NAMESIZE, \"%s\",\n+\t\t\t\t rte_node_id_to_name(node_map[stage + 1][i]));\n+\t\t\tnode_data->next_nodes[edges] = node_map[stage + 1][i];\n+\t\t\tnode_data->next_percentage[edges] =\n+\t\t\t\tedge_map[stage + 1][i][node];\n+\t\t\tedges++;\n+\t\t\ttotal_percent += edge_map[stage + 1][i][node];\n+\t\t}\n+\t}\n+\n+\tif (edges >= MAX_EDGES_PER_NODE || (edges && total_percent != 100)) {\n+\t\tfor (i = 0; i < edges; i++)\n+\t\t\tfree(ename[i]);\n+\t\treturn RTE_EDGE_ID_INVALID;\n+\t}\n+\n+\treturn edges;\n+}\n+\n+static int\n+graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks,\n+\t   uint32_t stages, uint16_t nodes_per_stage,\n+\t   uint8_t src_map[][nodes_per_stage], uint8_t snk_map[][nb_sinks],\n+\t   uint8_t edge_map[][nodes_per_stage][nodes_per_stage],\n+\t   uint8_t burst_one)\n+{\n+\tstruct test_graph_perf *graph_data;\n+\tchar nname[RTE_NODE_NAMESIZE / 2];\n+\tstruct test_node_data *node_data;\n+\tchar *ename[nodes_per_stage];\n+\tstruct rte_graph_param gconf;\n+\tconst struct rte_memzone *mz;\n+\tuint8_t total_percent = 0;\n+\trte_node_t *src_nodes;\n+\trte_node_t *snk_nodes;\n+\trte_node_t **node_map;\n+\tchar **node_patterns;\n+\trte_graph_t graph_id;\n+\trte_edge_t edges;\n+\trte_edge_t count;\n+\tuint32_t i, j, k;\n+\n+\tmz = rte_memzone_reserve(TEST_GRAPH_PERF_MZ,\n+\t\t\t\t sizeof(struct test_graph_perf), 0, 0);\n+\tif (mz == NULL) {\n+\t\tprintf(\"Failed to allocate graph common memory\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tgraph_data = mz->addr;\n+\tgraph_data->nb_nodes = 0;\n+\tgraph_data->node_data =\n+\t\tmalloc(sizeof(struct test_node_data) *\n+\t\t       (nb_srcs + nb_sinks + stages * nodes_per_stage));\n+\tif (graph_data->node_data == NULL) {\n+\t\tprintf(\"Failed to reserve memzone for graph data\\n\");\n+\t\tgoto memzone_free;\n+\t}\n+\n+\tnode_patterns = malloc(sizeof(char *) *\n+\t\t\t       (nb_srcs + nb_sinks + stages * nodes_per_stage));\n+\tif (node_patterns == NULL) {\n+\t\tprintf(\"Failed to reserve memory for node patterns\\n\");\n+\t\tgoto data_free;\n+\t}\n+\n+\tsrc_nodes = malloc(sizeof(rte_node_t) * nb_srcs);\n+\tif (src_nodes == NULL) {\n+\t\tprintf(\"Failed to reserve memory for src nodes\\n\");\n+\t\tgoto pattern_free;\n+\t}\n+\n+\tsnk_nodes = malloc(sizeof(rte_node_t) * nb_sinks);\n+\tif (snk_nodes == NULL) {\n+\t\tprintf(\"Failed to reserve memory for snk nodes\\n\");\n+\t\tgoto src_free;\n+\t}\n+\n+\tnode_map = malloc(sizeof(rte_node_t *) * stages +\n+\t\t\t  sizeof(rte_node_t) * nodes_per_stage * stages);\n+\tif (node_map == NULL) {\n+\t\tprintf(\"Failed to reserve memory for node map\\n\");\n+\t\tgoto snk_free;\n+\t}\n+\n+\t/* Setup the Graph */\n+\tfor (i = 0; i < stages; i++) {\n+\t\tnode_map[i] =\n+\t\t\t(rte_node_t *)(node_map + stages) + nodes_per_stage * i;\n+\t\tfor (j = 0; j < nodes_per_stage; j++) {\n+\t\t\ttotal_percent = 0;\n+\t\t\tfor (k = 0; k < nodes_per_stage; k++)\n+\t\t\t\ttotal_percent += edge_map[i][j][k];\n+\t\t\tif (!total_percent)\n+\t\t\t\tcontinue;\n+\t\t\tnode_patterns[graph_data->nb_nodes] =\n+\t\t\t\tmalloc(RTE_NODE_NAMESIZE);\n+\t\t\tif (node_patterns[graph_data->nb_nodes] == NULL) {\n+\t\t\t\tprintf(\"Failed to create memory for pattern\\n\");\n+\t\t\t\tgoto pattern_name_free;\n+\t\t\t}\n+\n+\t\t\t/* Clone a worker node */\n+\t\t\tsnprintf(nname, sizeof(nname), \"%d-%d\", i, j);\n+\t\t\tnode_map[i][j] =\n+\t\t\t\tgraph_node_get(TEST_GRAPH_WRK_NAME, nname);\n+\t\t\tif (node_map[i][j] == RTE_NODE_ID_INVALID) {\n+\t\t\t\tprintf(\"Failed to create node[%s]\\n\", nname);\n+\t\t\t\tgraph_data->nb_nodes++;\n+\t\t\t\tgoto pattern_name_free;\n+\t\t\t}\n+\t\t\tsnprintf(node_patterns[graph_data->nb_nodes],\n+\t\t\t\t RTE_NODE_NAMESIZE, \"%s\",\n+\t\t\t\t rte_node_id_to_name(node_map[i][j]));\n+\t\t\tnode_data =\n+\t\t\t\t&graph_data->node_data[graph_data->nb_nodes];\n+\t\t\tnode_data->node_id = node_map[i][j];\n+\t\t\tnode_data->is_sink = false;\n+\t\t\tgraph_data->nb_nodes++;\n+\t\t}\n+\t}\n+\n+\tfor (i = 0; i < stages - 1; i++) {\n+\t\tfor (j = 0; j < nodes_per_stage; j++) {\n+\t\t\t/* Count edges i.e connections of worker node to next */\n+\t\t\tnode_data =\n+\t\t\t\tgraph_get_node_data(graph_data, node_map[i][j]);\n+\t\t\tedges = graph_node_count_edges(i, j, nodes_per_stage,\n+\t\t\t\t\t\t       edge_map, ename,\n+\t\t\t\t\t\t       node_data, node_map);\n+\t\t\tif (edges == RTE_EDGE_ID_INVALID) {\n+\t\t\t\tprintf(\"Invalid edge configuration\\n\");\n+\t\t\t\tgoto pattern_name_free;\n+\t\t\t}\n+\t\t\tif (!edges)\n+\t\t\t\tcontinue;\n+\n+\t\t\t/* Connect a node in stage 'i' to nodes\n+\t\t\t * in stage 'i + 1' with edges.\n+\t\t\t */\n+\t\t\tcount = rte_node_edge_update(\n+\t\t\t\tnode_map[i][j], 0,\n+\t\t\t\t(const char **)(uintptr_t)ename, edges);\n+\t\t\tfor (k = 0; k < edges; k++)\n+\t\t\t\tfree(ename[k]);\n+\t\t\tif (count != edges) {\n+\t\t\t\tprintf(\"Couldn't add edges %d %d\\n\", edges,\n+\t\t\t\t       count);\n+\t\t\t\tgoto pattern_name_free;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t/* Setup Source nodes */\n+\tfor (i = 0; i < nb_srcs; i++) {\n+\t\tedges = 0;\n+\t\ttotal_percent = 0;\n+\t\tnode_patterns[graph_data->nb_nodes] = malloc(RTE_NODE_NAMESIZE);\n+\t\tif (node_patterns[graph_data->nb_nodes] == NULL) {\n+\t\t\tprintf(\"Failed to create memory for pattern\\n\");\n+\t\t\tgoto pattern_name_free;\n+\t\t}\n+\t\t/* Clone a source node */\n+\t\tsnprintf(nname, sizeof(nname), \"%d\", i);\n+\t\tsrc_nodes[i] =\n+\t\t\tgraph_node_get(burst_one ? TEST_GRAPH_SRC_BRST_ONE_NAME\n+\t\t\t\t\t\t : TEST_GRAPH_SRC_NAME,\n+\t\t\t\t       nname);\n+\t\tif (src_nodes[i] == RTE_NODE_ID_INVALID) {\n+\t\t\tprintf(\"Failed to create node[%s]\\n\", nname);\n+\t\t\tgraph_data->nb_nodes++;\n+\t\t\tgoto pattern_name_free;\n+\t\t}\n+\t\tsnprintf(node_patterns[graph_data->nb_nodes], RTE_NODE_NAMESIZE,\n+\t\t\t \"%s\", rte_node_id_to_name(src_nodes[i]));\n+\t\tnode_data = &graph_data->node_data[graph_data->nb_nodes];\n+\t\tnode_data->node_id = src_nodes[i];\n+\t\tnode_data->is_sink = false;\n+\t\tgraph_data->nb_nodes++;\n+\n+\t\t/* Prepare next node list  to connect to */\n+\t\tfor (j = 0; j < nodes_per_stage; j++) {\n+\t\t\tif (!src_map[i][j])\n+\t\t\t\tcontinue;\n+\t\t\tename[edges] = malloc(sizeof(char) * RTE_NODE_NAMESIZE);\n+\t\t\tsnprintf(ename[edges], RTE_NODE_NAMESIZE, \"%s\",\n+\t\t\t\t rte_node_id_to_name(node_map[0][j]));\n+\t\t\tnode_data->next_nodes[edges] = node_map[0][j];\n+\t\t\tnode_data->next_percentage[edges] = src_map[i][j];\n+\t\t\tedges++;\n+\t\t\ttotal_percent += src_map[i][j];\n+\t\t}\n+\n+\t\tif (!edges)\n+\t\t\tcontinue;\n+\t\tif (edges >= MAX_EDGES_PER_NODE || total_percent != 100) {\n+\t\t\tprintf(\"Invalid edge configuration\\n\");\n+\t\t\tfor (j = 0; j < edges; j++)\n+\t\t\t\tfree(ename[j]);\n+\t\t\tgoto pattern_name_free;\n+\t\t}\n+\n+\t\t/* Connect to list of next nodes using edges */\n+\t\tcount = rte_node_edge_update(src_nodes[i], 0,\n+\t\t\t\t\t     (const char **)(uintptr_t)ename,\n+\t\t\t\t\t     edges);\n+\t\tfor (k = 0; k < edges; k++)\n+\t\t\tfree(ename[k]);\n+\t\tif (count != edges) {\n+\t\t\tprintf(\"Couldn't add edges %d %d\\n\", edges, count);\n+\t\t\tgoto pattern_name_free;\n+\t\t}\n+\t}\n+\n+\t/* Setup Sink nodes */\n+\tfor (i = 0; i < nb_sinks; i++) {\n+\t\tnode_patterns[graph_data->nb_nodes] = malloc(RTE_NODE_NAMESIZE);\n+\t\tif (node_patterns[graph_data->nb_nodes] == NULL) {\n+\t\t\tprintf(\"Failed to create memory for pattern\\n\");\n+\t\t\tgoto pattern_name_free;\n+\t\t}\n+\n+\t\t/* Clone a sink node */\n+\t\tsnprintf(nname, sizeof(nname), \"%d\", i);\n+\t\tsnk_nodes[i] = graph_node_get(TEST_GRAPH_SNK_NAME, nname);\n+\t\tif (snk_nodes[i] == RTE_NODE_ID_INVALID) {\n+\t\t\tprintf(\"Failed to create node[%s]\\n\", nname);\n+\t\t\tgraph_data->nb_nodes++;\n+\t\t\tgoto pattern_name_free;\n+\t\t}\n+\t\tsnprintf(node_patterns[graph_data->nb_nodes], RTE_NODE_NAMESIZE,\n+\t\t\t \"%s\", rte_node_id_to_name(snk_nodes[i]));\n+\t\tnode_data = &graph_data->node_data[graph_data->nb_nodes];\n+\t\tnode_data->node_id = snk_nodes[i];\n+\t\tnode_data->is_sink = true;\n+\t\tgraph_data->nb_nodes++;\n+\t}\n+\n+\t/* Connect last stage worker nodes to sink nodes */\n+\tfor (i = 0; i < nodes_per_stage; i++) {\n+\t\tedges = 0;\n+\t\ttotal_percent = 0;\n+\t\tnode_data = graph_get_node_data(graph_data,\n+\t\t\t\t\t\tnode_map[stages - 1][i]);\n+\t\t/* Prepare list of sink nodes to connect to */\n+\t\tfor (j = 0; j < nb_sinks; j++) {\n+\t\t\tif (!snk_map[i][j])\n+\t\t\t\tcontinue;\n+\t\t\tename[edges] = malloc(sizeof(char) * RTE_NODE_NAMESIZE);\n+\t\t\tsnprintf(ename[edges], RTE_NODE_NAMESIZE, \"%s\",\n+\t\t\t\t rte_node_id_to_name(snk_nodes[j]));\n+\t\t\tnode_data->next_nodes[edges] = snk_nodes[j];\n+\t\t\tnode_data->next_percentage[edges] = snk_map[i][j];\n+\t\t\tedges++;\n+\t\t\ttotal_percent += snk_map[i][j];\n+\t\t}\n+\t\tif (!edges)\n+\t\t\tcontinue;\n+\t\tif (edges >= MAX_EDGES_PER_NODE || total_percent != 100) {\n+\t\t\tprintf(\"Invalid edge configuration\\n\");\n+\t\t\tfor (j = 0; j < edges; j++)\n+\t\t\t\tfree(ename[i]);\n+\t\t\tgoto pattern_name_free;\n+\t\t}\n+\n+\t\t/* Connect a worker node to a list of sink nodes */\n+\t\tcount = rte_node_edge_update(node_map[stages - 1][i], 0,\n+\t\t\t\t\t     (const char **)(uintptr_t)ename,\n+\t\t\t\t\t     edges);\n+\t\tfor (k = 0; k < edges; k++)\n+\t\t\tfree(ename[k]);\n+\t\tif (count != edges) {\n+\t\t\tprintf(\"Couldn't add edges %d %d\\n\", edges, count);\n+\t\t\tgoto pattern_name_free;\n+\t\t}\n+\t}\n+\n+\t/* Create a Graph */\n+\tgconf.socket_id = SOCKET_ID_ANY;\n+\tgconf.nb_node_patterns = graph_data->nb_nodes;\n+\tgconf.node_patterns = (const char **)(uintptr_t)node_patterns;\n+\n+\tgraph_id = rte_graph_create(gname, &gconf);\n+\tif (graph_id == RTE_GRAPH_ID_INVALID) {\n+\t\tprintf(\"Graph creation failed with error = %d\\n\", rte_errno);\n+\t\tgoto pattern_name_free;\n+\t}\n+\tgraph_data->graph_id = graph_id;\n+\n+\tfor (i = 0; i < graph_data->nb_nodes; i++)\n+\t\tfree(node_patterns[i]);\n+\tfree(snk_nodes);\n+\tfree(src_nodes);\n+\tfree(node_patterns);\n+\treturn 0;\n+\n+pattern_name_free:\n+\tfor (i = 0; i < graph_data->nb_nodes; i++)\n+\t\tfree(node_patterns[i]);\n+snk_free:\n+\tfree(snk_nodes);\n+src_free:\n+\tfree(src_nodes);\n+pattern_free:\n+\tfree(node_patterns);\n+data_free:\n+\tfree(graph_data->node_data);\n+memzone_free:\n+\trte_memzone_free(mz);\n+\treturn -ENOMEM;\n+}\n+\n+/* Worker thread function */\n+static int\n+_graph_perf_wrapper(void *args)\n+{\n+\tstruct graph_lcore_data *data = args;\n+\tstruct rte_graph *graph;\n+\n+\t/* Lookup graph */\n+\tgraph = rte_graph_lookup(rte_graph_id_to_name(data->graph_id));\n+\n+\t/* Graph walk until done */\n+\twhile (!data->done)\n+\t\trte_graph_walk(graph);\n+\n+\treturn 0;\n+}\n+\n+static int\n+measure_perf_get(rte_graph_t graph_id)\n+{\n+\tconst char *pattern = rte_graph_id_to_name(graph_id);\n+\tuint32_t lcore_id = rte_get_next_lcore(-1, 1, 0);\n+\tstruct rte_graph_cluster_stats_param param;\n+\tstruct rte_graph_cluster_stats *stats;\n+\tstruct graph_lcore_data *data;\n+\n+\tdata = rte_zmalloc(\"Graph_perf\", sizeof(struct graph_lcore_data),\n+\t\t\t   RTE_CACHE_LINE_SIZE);\n+\tdata->graph_id = graph_id;\n+\tdata->done = 0;\n+\n+\t/* Run graph worker thread function */\n+\trte_eal_remote_launch(_graph_perf_wrapper, data, lcore_id);\n+\n+\t/* Collect stats for few msecs */\n+\tif (rte_graph_has_stats_feature()) {\n+\t\tmemset(&param, 0, sizeof(param));\n+\t\tparam.f = stdout;\n+\t\tparam.socket_id = SOCKET_ID_ANY;\n+\t\tparam.graph_patterns = &pattern;\n+\t\tparam.nb_graph_patterns = 1;\n+\n+\t\tstats = rte_graph_cluster_stats_create(&param);\n+\t\tif (stats == NULL) {\n+\t\t\tprintf(\"Failed to create stats\\n\");\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\n+\t\trte_delay_ms(3E2);\n+\t\trte_graph_cluster_stats_get(stats, true);\n+\t\trte_delay_ms(1E3);\n+\t\trte_graph_cluster_stats_get(stats, false);\n+\t\trte_graph_cluster_stats_destroy(stats);\n+\t} else\n+\t\trte_delay_ms(1E3);\n+\n+\tdata->done = 1;\n+\trte_eal_wait_lcore(lcore_id);\n+\n+\treturn 0;\n+}\n+\n+static inline void\n+graph_fini(void)\n+{\n+\tconst struct rte_memzone *mz = rte_memzone_lookup(TEST_GRAPH_PERF_MZ);\n+\tstruct test_graph_perf *graph_data;\n+\n+\tif (mz == NULL)\n+\t\treturn;\n+\tgraph_data = mz->addr;\n+\n+\trte_graph_destroy(graph_data->graph_id);\n+\tfree(graph_data->node_data);\n+\trte_memzone_free(rte_memzone_lookup(TEST_GRAPH_PERF_MZ));\n+}\n+\n+static int\n+measure_perf(void)\n+{\n+\tconst struct rte_memzone *mz;\n+\tstruct test_graph_perf *graph_data;\n+\n+\tmz = rte_memzone_lookup(TEST_GRAPH_PERF_MZ);\n+\tgraph_data = mz->addr;\n+\n+\treturn measure_perf_get(graph_data->graph_id);\n+}\n+\n+static inline int\n+graph_hr_4s_1n_1src_1snk(void)\n+{\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_hr_4s_1n_1src_1snk_brst_one(void)\n+{\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_hr_4s_1n_2src_1snk(void)\n+{\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_hr_4s_1n_1src_2snk(void)\n+{\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_tree_4s_4n_1src_4snk(void)\n+{\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_reverse_tree_3s_4n_1src_1snk(void)\n+{\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_parallel_tree_5s_4n_4src_4snk(void)\n+{\n+\treturn measure_perf();\n+}\n+\n+/* Graph Topology\n+ * nodes per stage:\t1\n+ * stages:\t\t4\n+ * src:\t\t\t1\n+ * sink:\t\t1\n+ */\n+static inline int\n+graph_init_hr(void)\n+{\n+\tuint8_t edge_map[][1][1] = {\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t};\n+\tuint8_t src_map[][1] = { {100} };\n+\tuint8_t snk_map[][1] = { {100} };\n+\n+\treturn graph_init(\"graph_hr\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\t  STAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\t  snk_map, edge_map, 0);\n+}\n+\n+/* Graph Topology\n+ * nodes per stage:\t1\n+ * stages:\t\t4\n+ * src:\t\t\t1\n+ * sink:\t\t1\n+ */\n+static inline int\n+graph_init_hr_brst_one(void)\n+{\n+\tuint8_t edge_map[][1][1] = {\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t};\n+\tuint8_t src_map[][1] = { {100} };\n+\tuint8_t snk_map[][1] = { {100} };\n+\n+\treturn graph_init(\"graph_hr\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\t  STAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\t  snk_map, edge_map, 1);\n+}\n+\n+/* Graph Topology\n+ * nodes per stage:\t1\n+ * stages:\t\t4\n+ * src:\t\t\t2\n+ * sink:\t\t1\n+ */\n+static inline int\n+graph_init_hr_multi_src(void)\n+{\n+\tuint8_t edge_map[][1][1] = {\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t};\n+\tuint8_t src_map[][1] = {\n+\t\t{100}, {100}\n+\t};\n+\tuint8_t snk_map[][1] = { {100} };\n+\n+\treturn graph_init(\"graph_hr\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\t  STAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\t  snk_map, edge_map, 0);\n+}\n+\n+/* Graph Topology\n+ * nodes per stage:\t1\n+ * stages:\t\t4\n+ * src:\t\t\t1\n+ * sink:\t\t2\n+ */\n+static inline int\n+graph_init_hr_multi_snk(void)\n+{\n+\tuint8_t edge_map[][1][1] = {\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t\t{ {100} },\n+\t};\n+\tuint8_t src_map[][1] = { {100} };\n+\tuint8_t snk_map[][2] = { {50, 50} };\n+\n+\treturn graph_init(\"graph_hr\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\t  STAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\t  snk_map, edge_map, 0);\n+}\n+\n+/* Graph Topology\n+ * nodes per stage:\t4\n+ * stages:\t\t4\n+ * src:\t\t\t1\n+ * sink:\t\t4\n+ */\n+static inline int\n+graph_init_tree(void)\n+{\n+\tuint8_t edge_map[][4][4] = {\n+\t\t{\n+\t\t\t{100, 0, 0, 0},\n+\t\t\t{0, 0, 0, 0},\n+\t\t\t{0, 0, 0, 0},\n+\t\t\t{0, 0, 0, 0}\n+\t\t},\n+\t\t{\n+\t\t\t{50, 0, 0, 0},\n+\t\t\t{50, 0, 0, 0},\n+\t\t\t{0, 0, 0, 0},\n+\t\t\t{0, 0, 0, 0}\n+\t\t},\n+\t\t{\n+\t\t\t{33, 33, 0, 0},\n+\t\t\t{34, 34, 0, 0},\n+\t\t\t{33, 33, 0, 0},\n+\t\t\t{0, 0, 0, 0}\n+\t\t},\n+\t\t{\n+\t\t\t{25, 25, 25, 0},\n+\t\t\t{25, 25, 25, 0},\n+\t\t\t{25, 25, 25, 0},\n+\t\t\t{25, 25, 25, 0}\n+\t\t}\n+\t};\n+\tuint8_t src_map[][4] = { {100, 0, 0, 0} };\n+\tuint8_t snk_map[][4] = {\n+\t\t{100, 0, 0, 0},\n+\t\t{0, 100, 0, 0},\n+\t\t{0, 0, 100, 0},\n+\t\t{0, 0, 0, 100}\n+\t};\n+\n+\treturn graph_init(\"graph_full_split\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\t  STAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\t  snk_map, edge_map, 0);\n+}\n+\n+/* Graph Topology\n+ * nodes per stage:\t4\n+ * stages:\t\t3\n+ * src:\t\t\t1\n+ * sink:\t\t1\n+ */\n+static inline int\n+graph_init_reverse_tree(void)\n+{\n+\tuint8_t edge_map[][4][4] = {\n+\t\t{\n+\t\t\t{25, 25, 25, 25},\n+\t\t\t{25, 25, 25, 25},\n+\t\t\t{25, 25, 25, 25},\n+\t\t\t{25, 25, 25, 25}\n+\t\t},\n+\t\t{\n+\t\t\t{33, 33, 33, 33},\n+\t\t\t{33, 33, 33, 33},\n+\t\t\t{34, 34, 34, 34},\n+\t\t\t{0, 0, 0, 0}\n+\t\t},\n+\t\t{\n+\t\t\t{50, 50, 50, 0},\n+\t\t\t{50, 50, 50, 0},\n+\t\t\t{0, 0, 0, 0},\n+\t\t\t{0, 0, 0, 0}\n+\t\t},\n+\t};\n+\tuint8_t src_map[][4] = { {25, 25, 25, 25} };\n+\tuint8_t snk_map[][1] = { {100}, {100}, {0}, {0} };\n+\n+\treturn graph_init(\"graph_full_split\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\t  STAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\t  snk_map, edge_map, 0);\n+}\n+\n+/* Graph Topology\n+ * nodes per stage:\t4\n+ * stages:\t\t5\n+ * src:\t\t\t4\n+ * sink:\t\t4\n+ */\n+static inline int\n+graph_init_parallel_tree(void)\n+{\n+\tuint8_t edge_map[][4][4] = {\n+\t\t{\n+\t\t\t{100, 0, 0, 0},\n+\t\t\t{0, 100, 0, 0},\n+\t\t\t{0, 0, 100, 0},\n+\t\t\t{0, 0, 0, 100}\n+\t\t},\n+\t\t{\n+\t\t\t{100, 0, 0, 0},\n+\t\t\t{0, 100, 0, 0},\n+\t\t\t{0, 0, 100, 0},\n+\t\t\t{0, 0, 0, 100}\n+\t\t},\n+\t\t{\n+\t\t\t{100, 0, 0, 0},\n+\t\t\t{0, 100, 0, 0},\n+\t\t\t{0, 0, 100, 0},\n+\t\t\t{0, 0, 0, 100}\n+\t\t},\n+\t\t{\n+\t\t\t{100, 0, 0, 0},\n+\t\t\t{0, 100, 0, 0},\n+\t\t\t{0, 0, 100, 0},\n+\t\t\t{0, 0, 0, 100}\n+\t\t},\n+\t\t{\n+\t\t\t{100, 0, 0, 0},\n+\t\t\t{0, 100, 0, 0},\n+\t\t\t{0, 0, 100, 0},\n+\t\t\t{0, 0, 0, 100}\n+\t\t},\n+\t};\n+\tuint8_t src_map[][4] = {\n+\t\t{100, 0, 0, 0},\n+\t\t{0, 100, 0, 0},\n+\t\t{0, 0, 100, 0},\n+\t\t{0, 0, 0, 100}\n+\t};\n+\tuint8_t snk_map[][4] = {\n+\t\t{100, 0, 0, 0},\n+\t\t{0, 100, 0, 0},\n+\t\t{0, 0, 100, 0},\n+\t\t{0, 0, 0, 100}\n+\t};\n+\n+\treturn graph_init(\"graph_parallel\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\t  STAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\t  snk_map, edge_map, 0);\n+}\n+\n+/** Graph Creation cheat sheet\n+ *  edge_map -> dictates graph flow from worker stage 0 to worker stage n-1.\n+ *  src_map  -> dictates source nodes enqueue percentage to worker stage 0.\n+ *  snk_map  -> dictates stage n-1 enqueue percentage to sink.\n+ *\n+ *  Layout:\n+ *  edge_map[<nb_stages>][<nodes_per_stg>][<nodes_in_nxt_stg = nodes_per_stg>]\n+ *  src_map[<nb_sources>][<nodes_in_stage0 = nodes_per_stage>]\n+ *  snk_map[<nodes_in_stage(n-1) = nodes_per_stage>][<nb_sinks>]\n+ *\n+ *  The last array dictates the percentage of received objs to enqueue to next\n+ *  stage.\n+ *\n+ *  Note: edge_map[][0][] will always be unused as it will receive from source\n+ *\n+ *  Example:\n+ *\tGraph:\n+ *\thttp://bit.ly/2PqbqOy\n+ *\tEach stage(n) connects to all nodes in the next stage in decreasing\n+ *\torder.\n+ *\tSince we can't resize the edge_map dynamically we get away by creating\n+ *\tdummy nodes and assigning 0 percentages.\n+ *\tMax nodes across all stages = 4\n+ *\tstages = 3\n+ *\tnb_src = 1\n+ *\tnb_snk = 1\n+ *\t\t\t   // Stages\n+ *\tedge_map[][4][4] = {\n+ *\t\t// Nodes per stage\n+ *\t\t{\n+ *\t\t    {25, 25, 25, 25},\n+ *\t\t    {25, 25, 25, 25},\n+ *\t\t    {25, 25, 25, 25},\n+ *\t\t    {25, 25, 25, 25}\n+ *\t\t},\t// This will be unused.\n+ *\t\t{\n+ *\t\t    // Nodes enabled in current stage + prev stage enq %\n+ *\t\t    {33, 33, 33, 33},\n+ *\t\t    {33, 33, 33, 33},\n+ *\t\t    {34, 34, 34, 34},\n+ *\t\t    {0, 0, 0, 0}\n+ *\t\t},\n+ *\t\t{\n+ *\t\t    {50, 50, 50, 0},\n+ *\t\t    {50, 50, 50, 0},\n+ *\t\t    {0, 0, 0, 0},\n+ *\t\t    {0, 0, 0, 0}\n+ *\t\t},\n+ *\t};\n+ *\tAbove, each stage tells how much it should receive from previous except\n+ *\tfrom stage_0.\n+ *\n+ *\tsrc_map[][4] = { {25, 25, 25, 25} };\n+ *\tHere, we tell each source the % it has to send to stage_0 nodes. In\n+ *\tcase we want 2 source node we can declare as\n+ *\tsrc_map[][4] = { {25, 25, 25, 25}, {25, 25, 25, 25} };\n+ *\n+ *\tsnk_map[][1] = { {100}, {100}, {0}, {0} }\n+ *\tHere, we tell stage - 1 nodes how much to enqueue to sink_0.\n+ *\tIf we have 2 sinks we can do as follows\n+ *\tsnk_map[][2] = { {50, 50}, {50, 50}, {0, 0}, {0, 0} }\n+ */\n+\n+static struct unit_test_suite graph_perf_testsuite = {\n+\t.suite_name = \"Graph library performance test suite\",\n+\t.setup = graph_perf_setup,\n+\t.teardown = graph_perf_teardown,\n+\t.unit_test_cases = {\n+\t\tTEST_CASE_ST(graph_init_hr, graph_fini,\n+\t\t\t     graph_hr_4s_1n_1src_1snk),\n+\t\tTEST_CASE_ST(graph_init_hr_brst_one, graph_fini,\n+\t\t\t     graph_hr_4s_1n_1src_1snk_brst_one),\n+\t\tTEST_CASE_ST(graph_init_hr_multi_src, graph_fini,\n+\t\t\t     graph_hr_4s_1n_2src_1snk),\n+\t\tTEST_CASE_ST(graph_init_hr_multi_snk, graph_fini,\n+\t\t\t     graph_hr_4s_1n_1src_2snk),\n+\t\tTEST_CASE_ST(graph_init_tree, graph_fini,\n+\t\t\t     graph_tree_4s_4n_1src_4snk),\n+\t\tTEST_CASE_ST(graph_init_reverse_tree, graph_fini,\n+\t\t\t     graph_reverse_tree_3s_4n_1src_1snk),\n+\t\tTEST_CASE_ST(graph_init_parallel_tree, graph_fini,\n+\t\t\t     graph_parallel_tree_5s_4n_4src_4snk),\n+\t\tTEST_CASES_END(), /**< NULL terminate unit test array */\n+\t},\n+};\n+\n+static int\n+test_graph_perf_func(void)\n+{\n+\treturn unit_test_suite_runner(&graph_perf_testsuite);\n+}\n+\n+REGISTER_TEST_COMMAND(graph_perf_autotest, test_graph_perf_func);\n",
    "prefixes": [
        "v5",
        "14/29"
    ]
}