get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 65437,
    "url": "http://patches.dpdk.org/api/patches/65437/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200131170201.3236153-5-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": "<20200131170201.3236153-5-jerinj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200131170201.3236153-5-jerinj@marvell.com",
    "date": "2020-01-31T17:02:00",
    "name": "[RFC,4/5] test: add graph performance test cases.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "df40421790ed308ff2423e2788f1311f5b7b2a49",
    "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/20200131170201.3236153-5-jerinj@marvell.com/mbox/",
    "series": [
        {
            "id": 8382,
            "url": "http://patches.dpdk.org/api/series/8382/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8382",
            "date": "2020-01-31T17:01:56",
            "name": "graph: introduce graph subsystem",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/8382/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/65437/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/65437/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 BBB63A0524;\n\tFri, 31 Jan 2020 18:04:49 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 96E9D1C122;\n\tFri, 31 Jan 2020 18:04:49 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 98D541C117;\n Fri, 31 Jan 2020 18:04:47 +0100 (CET)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n 00VGuEWb032452; Fri, 31 Jan 2020 09:04:42 -0800",
            "from sc-exch02.marvell.com ([199.233.58.182])\n by mx0b-0016f401.pphosted.com with ESMTP id 2xrp2tmggq-6\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Fri, 31 Jan 2020 09:04:42 -0800",
            "from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com\n (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 31 Jan\n 2020 09:03:11 -0800",
            "from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com\n (10.93.176.83) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Fri, 31 Jan 2020 09:03:10 -0800",
            "from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14])\n by maili.marvell.com (Postfix) with ESMTP id 02FA93F7040;\n Fri, 31 Jan 2020 09:03:00 -0800 (PST)"
        ],
        "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=57o9hPx3mKltrNGOeu3k+pbJ1RInMQFMQZWLwdlJsNc=;\n b=tc6ZgPHErSMakdr3g6mshnHPiNnln/8oiql4+m9ndG3BNugFH7tSYefsNDLgypr1mlqG\n dX59WmeZvipUwJP0jTY2r3oNiOqfLVgcXMeAAGMfN/bH4ZZpdcu+xhDRPpjerQViSi4+\n +d60V/liY/kpmd7hj8EVTFwQhjwrKD8H7/pu4WyDgqKc0vErUYS9/Nq79J8YZSmMULss\n MQJL/IZ9gw09C1YCDfN6GkUGUd+30l545pSmCEDL7Fnkf9uYKaxVivVssrwDm6aYRtGI\n tASJQvgUzSTjuYXN4e1COkHD5Ki5TlWtBG3jFQl0RE7cOlT8ubDsFqYUE/2rbYQiimm4 aw==",
        "From": "<jerinj@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<pkapoor@marvell.com>, <ndabilpuram@marvell.com>,\n <kirankumark@marvell.com>, <pbhagavatula@marvell.com>,\n <pathreya@marvell.com>, <nsaxena@marvell.com>,\n <sshankarnara@marvell.com>, <honnappa.nagarahalli@arm.com>,\n <thomas@monjalon.net>, <david.marchand@redhat.com>,\n <ferruh.yigit@intel.com>, <arybchenko@solarflare.com>,\n <ajit.khaparde@broadcom.com>, <xiaolong.ye@intel.com>,\n <rasland@mellanox.com>, <maxime.coquelin@redhat.com>,\n <akhil.goyal@nxp.com>, <cristian.dumitrescu@intel.com>,\n <john.mcnamara@intel.com>, <bruce.richardson@intel.com>,\n <anatoly.burakov@intel.com>, <gavin.hu@arm.com>,\n <drc@linux.vnet.ibm.com>, <konstantin.ananyev@intel.com>,\n <pallavi.kadam@intel.com>, <olivier.matz@6wind.com>,\n <gage.eads@intel.com>, <nikhil.rao@intel.com>,\n <erik.g.carrillo@intel.com>, <hemant.agrawal@nxp.com>,\n <artem.andreev@oktetlabs.ru>, <sthemmin@microsoft.com>,\n <shahafs@mellanox.com>, <keith.wiles@intel.com>,\n <mattias.ronnblom@ericsson.com>, <jasvinder.singh@intel.com>,\n <vladimir.medvedkin@intel.com>, <mdr@ashroe.eu>, <techboard@dpdk.org>",
        "Date": "Fri, 31 Jan 2020 22:32:00 +0530",
        "Message-ID": "<20200131170201.3236153-5-jerinj@marvell.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200131170201.3236153-1-jerinj@marvell.com>",
        "References": "<20200131170201.3236153-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.572\n definitions=2020-01-31_04:2020-01-31,\n 2020-01-31 signatures=0",
        "Subject": "[dpdk-dev] [RFC PATCH 4/5] test: add graph performance test cases.",
        "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\nExample command to execute the test:\n\necho \"graph_perf_autotest\" | sudo ./build/app/test/dpdk-test -c 0x30\n\nSigned-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>\n---\n app/test/Makefile          |   1 +\n app/test/meson.build       |   1 +\n app/test/test_graph_perf.c | 888 +++++++++++++++++++++++++++++++++++++\n 3 files changed, 890 insertions(+)\n create mode 100644 app/test/test_graph_perf.c",
    "diff": "diff --git a/app/test/Makefile b/app/test/Makefile\nindex e1dbe297e..429c32209 100644\n--- a/app/test/Makefile\n+++ b/app/test/Makefile\n@@ -222,6 +222,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 d5d0c2173..a0f3d3389 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -55,6 +55,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..364cfd15a\n--- /dev/null\n+++ b/app/test/test_graph_perf.c\n@@ -0,0 +1,888 @@\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\t\"graph_perf_data\"\n+#define TEST_GRAPH_SRC_NAME\t\t\"test_graph_perf_source\"\n+#define TEST_GRAPH_SRC_BRST_ONE_NAME\t\"test_graph_perf_source_one\"\n+#define TEST_GRAPH_WRK_NAME\t\t\"test_graph_perf_worker\"\n+#define TEST_GRAPH_SNK_NAME\t\t\"test_graph_perf_sink\"\n+\n+#define SOURCES(map)\t\tsizeof(map)/sizeof(map[0])\n+#define STAGES(map)\t\tsizeof(map)/sizeof(map[0])\n+#define NODES_PER_STAGE(map)\tsizeof(map[0])/sizeof(map[0][0])\n+#define SINKS(map)\t\tsizeof(map[0])/sizeof(map[0][0])\n+\n+#define MAX_EDGES_PER_NODE\t7\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+\n+\treturn 0;\n+}\n+\n+static uint16_t\n+test_perf_node_worker_source(struct rte_graph *graph,\n+\t\t\t     struct rte_node *node, void **objs,\n+\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+\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\t = 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     struct rte_node *node, void **objs,\n+\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+\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\t = 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+static uint16_t\n+test_perf_node_worker(struct rte_graph *graph,\n+\t\t      struct rte_node *node, 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+\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+\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+\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\t = 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+static uint16_t\n+test_perf_node_sink(struct rte_graph *graph,\n+\t\t\t     struct rte_node *node, void **objs,\n+\t\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\t = 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 graph_perf_setup(void)\n+{\n+\tif (rte_lcore_count() < 2) {\n+\t\tprintf(\"Test requires atleast 2 lcores\\n\");\n+\t\treturn TEST_SKIPPED;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void 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\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 graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks,\n+\t\t      uint32_t stages, uint16_t nodes_per_stage,\n+\t\t      uint8_t src_map[][nodes_per_stage],\n+\t\t      uint8_t snk_map[][nb_sinks],\n+\t\t      uint8_t edge_map[][nodes_per_stage][nodes_per_stage],\n+\t\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 = malloc(sizeof(struct test_node_data) *\n+\t\t\t\t       (nb_srcs + nb_sinks + stages *\n+\t\t\t\t\tnodes_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 *) * (nb_srcs + nb_sinks + stages *\n+\t\t\t       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 + sizeof(rte_node_t) *\n+\t\t\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] = (rte_node_t *) (node_map + stages) +\n+\t\t\t\tnodes_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+\t\t\tsnprintf(nname, sizeof(nname), \"%d-%d\", i, j);\n+\t\t\tnode_map[i][j] = graph_node_get(TEST_GRAPH_WRK_NAME,\n+\t\t\t\t\t\t\tnname);\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 = &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+\n+\t}\n+\n+\tfor (i = 0; i < stages - 1; i++) {\n+\t\tfor (j = 0; j < nodes_per_stage; j++ ) {\n+\t\t\tnode_data = graph_get_node_data(graph_data,\n+\t\t\t\t\t\t\tnode_map[i][j]);\n+\t\t\tedges = graph_node_count_edges(i, j, nodes_per_stage,\n+\t\t\t\t\tedge_map, ename, 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+\t\t\tcount = rte_node_edge_update(node_map[i][j], 0,\n+\t\t\t\t\t\t     (const char **)(uintptr_t)\n+\t\t\t\t\t\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(\"Couldnt add edges %d %d\\n\", edges,\n+\t\t\t\t\t\tcount);\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\tsnprintf(nname, sizeof(nname), \"%d\", i);\n+\t\tsrc_nodes[i] = graph_node_get(burst_one ?\n+\t\t\t\t\t      TEST_GRAPH_SRC_BRST_ONE_NAME :\n+\t\t\t\t\t      TEST_GRAPH_SRC_NAME, 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+\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+\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(\"Couldnt 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+\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],\n+\t\t\t RTE_NODE_NAMESIZE, \"%s\",\n+\t\t\t 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+\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\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+\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(\"Couldnt add edges %d %d\\n\", edges, count);\n+\t\t\tgoto pattern_name_free;\n+\t\t}\n+\t}\n+\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+static int\n+_graph_perf_wrapper(void *args)\n+{\n+\tstruct graph_lcore_data *data = args;\n+\tstruct rte_graph *graph;\n+\n+\tgraph = rte_graph_lookup(rte_graph_id_to_name(data->graph_id));\n+\twhile (!data->done)\n+\t\trte_graph_walk(graph);\n+\n+\treturn 0;\n+}\n+\n+static int 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+\trte_eal_remote_launch(_graph_perf_wrapper, data, lcore_id);\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(rte_graph_id_to_name(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+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_hr_4s_1n_1src_1snk_brst_one(void) {\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_hr_4s_1n_2src_1snk(void) {\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_hr_4s_1n_1src_2snk(void) {\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_tree_4s_4n_1src_4snk(void) {\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_reverse_tree_3s_4n_1src_1snk(void) {\n+\treturn measure_perf();\n+}\n+\n+static inline int\n+graph_parallel_tree_5s_4n_4src_4snk(void) {\n+\treturn measure_perf();\n+}\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+\treturn graph_init(\"graph_hr\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\tSTAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\tsnk_map, edge_map, 0);\n+}\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+\treturn graph_init(\"graph_hr\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\tSTAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\tsnk_map, edge_map, 1);\n+}\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] = {{100},{100}};\n+\tuint8_t snk_map[][1] = {{100}};\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+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+\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+static inline int\n+graph_init_tree(void)\n+{\n+\tuint8_t edge_map[][4][4] = {\n+\t\t{{100, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}},\n+\t\t{{50, 0, 0, 0}, {50, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}},\n+\t\t{{33, 33, 0, 0}, {34, 34, 0, 0}, {33, 33, 0, 0}, {0,0,0,0}},\n+\t\t{{25, 25, 25, 0}, {25, 25, 25, 0}, {25, 25, 25, 0},\n+\t\t\t\t\t\t{25, 25, 25, 0}}\n+\t};\n+\tuint8_t src_map[][4] = {{100, 0, 0, 0}};\n+\tuint8_t snk_map[][4] = {{100,0,0,0}, {0,100,0,0}, {0,0,100,0}, {0,0,0,100}};\n+\n+\treturn graph_init(\"graph_full_split\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\tSTAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\tsnk_map, edge_map, 0);\n+}\n+\n+static inline int\n+graph_init_reverse_tree(void)\n+{\n+\tuint8_t edge_map[][4][4] = {\n+\t\t{{25,25,25,25}, {25,25,25,25}, {25,25,25,25}, {25,25,25,25}},\n+\t\t{{33,33,33,33}, {33,33,33,33}, {34,34,34,34}, {0,0,0,0}},\n+\t\t{{50,50,50,0}, {50,50,50,0}, {0,0,0,0}, {0,0,0,0}},\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\tSTAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\tsnk_map, edge_map, 0);\n+}\n+\n+static inline int\n+graph_init_parallel_tree(void)\n+{\n+\tuint8_t edge_map[][4][4] = {\n+\t\t{{100,0,0,0}, {0,100,0,0}, {0,0,100,0}, {0,0,0,100}},\n+\t\t{{100,0,0,0}, {0,100,0,0}, {0,0,100,0}, {0,0,0,100}},\n+\t\t{{100,0,0,0}, {0,100,0,0}, {0,0,100,0}, {0,0,0,100}},\n+\t\t{{100,0,0,0}, {0,100,0,0}, {0,0,100,0}, {0,0,0,100}},\n+\t\t{{100,0,0,0}, {0,100,0,0}, {0,0,100,0}, {0,0,0,100}},\n+\t};\n+\tuint8_t src_map[][4] = {{100,0,0,0}, {0,100,0,0}, {0,0,100,0}, {0,0,0,100}};\n+\tuint8_t snk_map[][4] = {{100,0,0,0}, {0,100,0,0}, {0,0,100,0}, {0,0,0,100}};\n+\n+\treturn graph_init(\"graph_parallel\", SOURCES(src_map), SINKS(snk_map),\n+\t\t\tSTAGES(edge_map), NODES_PER_STAGE(edge_map), src_map,\n+\t\t\tsnk_map, edge_map, 0);\n+}\n+\n+/** Graph Creation cheatsheet\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 cant 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},{25,25,25,25},{25,25,25,25},{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}, {33,33,33,33}, {34,34,34,34}, {0,0,0,0}\n+ *\t\t},\n+ *\t\t{\n+ *\t\t    {50,50,50,0}, {50,50,50,0}, {0,0,0,0}, {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 declae 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+ *\tTODO: add validation logic for above declaration style.\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": [
        "RFC",
        "4/5"
    ]
}