get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 11245,
    "url": "http://patches.dpdk.org/api/patches/11245/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/17AD763A69C1A24CA48C89AF567166204BAA5959@SHSMSX101.ccr.corp.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": "<17AD763A69C1A24CA48C89AF567166204BAA5959@SHSMSX101.ccr.corp.intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/17AD763A69C1A24CA48C89AF567166204BAA5959@SHSMSX101.ccr.corp.intel.com",
    "date": "2016-03-09T06:50:05",
    "name": "[dpdk-dev,v2] examples/ip_pipeline: CPU utilization measurement and display",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "85b77c94b7b7619d7e7623cb785e65b36a3f3fa4",
    "submitter": {
        "id": 148,
        "url": "http://patches.dpdk.org/api/people/148/?format=api",
        "name": "qun wan",
        "email": "qun.wan@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/17AD763A69C1A24CA48C89AF567166204BAA5959@SHSMSX101.ccr.corp.intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/11245/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/11245/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 17B2A2BC2;\n\tWed,  9 Mar 2016 07:50:11 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id EFF4A2BB4\n\tfor <dev@dpdk.org>; Wed,  9 Mar 2016 07:50:09 +0100 (CET)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga103.jf.intel.com with ESMTP; 08 Mar 2016 22:50:08 -0800",
            "from fmsmsx104.amr.corp.intel.com ([10.18.124.202])\n\tby FMSMGA003.fm.intel.com with ESMTP; 08 Mar 2016 22:50:08 -0800",
            "from fmsmsx153.amr.corp.intel.com (10.18.125.6) by\n\tfmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP\n\tServer (TLS) id 14.3.248.2; Tue, 8 Mar 2016 22:50:08 -0800",
            "from shsmsx152.ccr.corp.intel.com (10.239.6.52) by\n\tFMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server\n\t(TLS) id 14.3.248.2; Tue, 8 Mar 2016 22:50:07 -0800",
            "from shsmsx101.ccr.corp.intel.com ([169.254.1.136]) by\n\tSHSMSX152.ccr.corp.intel.com ([169.254.6.42]) with mapi id\n\t14.03.0248.002; Wed, 9 Mar 2016 14:50:06 +0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.24,310,1455004800\"; d=\"scan'208\";a=\"666283695\"",
        "From": "\"Wan, Qun\" <qun.wan@intel.com>",
        "To": "\"Zhang, Roy Fan\" <roy.fan.zhang@intel.com>, \"dev@dpdk.org\" <dev@dpdk.org>",
        "Thread-Topic": "[dpdk-dev] [PATCH v2] examples/ip_pipeline: CPU utilization\n\tmeasurement and display",
        "Thread-Index": "AQHRbXp8q5CItPQzg0KG5YhwSI95OJ9Qxpyw",
        "Date": "Wed, 9 Mar 2016 06:50:05 +0000",
        "Message-ID": "<17AD763A69C1A24CA48C89AF567166204BAA5959@SHSMSX101.ccr.corp.intel.com>",
        "References": "<1456150024-31304-1-git-send-email-roy.fan.zhang@intel.com>",
        "In-Reply-To": "<1456150024-31304-1-git-send-email-roy.fan.zhang@intel.com>",
        "Accept-Language": "en-IE, en-US",
        "Content-Language": "en-US",
        "X-MS-Has-Attach": "",
        "X-MS-TNEF-Correlator": "",
        "x-originating-ip": "[10.239.127.40]",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "quoted-printable",
        "MIME-Version": "1.0",
        "Subject": "Re: [dpdk-dev] [PATCH v2] examples/ip_pipeline: CPU\n\tutilization\tmeasurement and display",
        "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": "Tested-ny: Qun Wan <qun.wan@intel.com>\npipeline> t s1c1 headroom\n57.085%\n\n-----Original Message-----\nFrom: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang\nSent: Monday, February 22, 2016 10:07 PM\nTo: dev@dpdk.org\nSubject: [dpdk-dev] [PATCH v2] examples/ip_pipeline: CPU utilization measurement and display\n\nThis patch adds CPU utilization measurement and idle cycle rate computation to packet framework. The measurement is done by measuring the cycles spent while a thread pulls zero packet from RX queue. These cycles are treated as idle cycles (or headroom). A CLI command is added to display idle cycle rate of specific thread. The CLI command format is shown as following:\n\nt <thread_id> headroom\n\nSigned-off-by: Fan Zhang <roy.fan.zhang@intel.com>\nAcked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\n examples/ip_pipeline/app.h       |   8 +++\n examples/ip_pipeline/init.c      |   8 ++-\n examples/ip_pipeline/thread.c    |  66 ++++++++++++++++++++++-\n examples/ip_pipeline/thread.h    |  14 +++++\n examples/ip_pipeline/thread_fe.c | 113 +++++++++++++++++++++++++++++++++++++++\n examples/ip_pipeline/thread_fe.h |   6 +++\n 6 files changed, 211 insertions(+), 4 deletions(-)\n\n--\n2.5.0",
    "diff": "diff --git a/examples/ip_pipeline/app.h b/examples/ip_pipeline/app.h index 6510d6d..2c91256 100644\n--- a/examples/ip_pipeline/app.h\n+++ b/examples/ip_pipeline/app.h\n@@ -263,6 +263,10 @@ struct app_thread_data {\n \n \tstruct rte_ring *msgq_in;\n \tstruct rte_ring *msgq_out;\n+\n+\tuint64_t headroom_time;\n+\tuint64_t headroom_cycles;\n+\tdouble headroom_ratio;\n };\n \n struct app_eal_params {\n@@ -421,6 +425,10 @@ struct app_eal_params {\n #define APP_MAX_CMDS                             64\n #endif\n \n+#ifndef APP_THREAD_HEADROOM_STATS_COLLECT\n+#define APP_THREAD_HEADROOM_STATS_COLLECT        1\n+#endif\n+\n struct app_params {\n \t/* Config */\n \tchar app_name[APP_APPNAME_SIZE];\ndiff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 186ca03..af33e8f 100644\n--- a/examples/ip_pipeline/init.c\n+++ b/examples/ip_pipeline/init.c\n@@ -1343,8 +1343,8 @@ app_init_pipelines(struct app_params *app)\n \n \t\tdata->ptype = ptype;\n \n-\t\tdata->timer_period = (rte_get_tsc_hz() * params->timer_period)\n-\t\t\t/ 1000;\n+\t\tdata->timer_period = (rte_get_tsc_hz() *\n+\t\t\tparams->timer_period) / 100;\n \t}\n }\n \n@@ -1379,6 +1379,10 @@ app_init_threads(struct app_params *app)\n \t\tt->timer_period = (rte_get_tsc_hz() * APP_THREAD_TIMER_PERIOD) / 1000;\n \t\tt->thread_req_deadline = time + t->timer_period;\n \n+\t\tt->headroom_cycles = 0;\n+\t\tt->headroom_time = rte_get_tsc_cycles();\n+\t\tt->headroom_ratio = 0.0;\n+\n \t\tt->msgq_in = app_thread_msgq_in_get(app,\n \t\t\t\tparams->socket_id,\n \t\t\t\tparams->core_id,\ndiff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c index 78f1bd8..a0f1f12 100644\n--- a/examples/ip_pipeline/thread.c\n+++ b/examples/ip_pipeline/thread.c\n@@ -39,6 +39,43 @@\n #include \"app.h\"\n #include \"thread.h\"\n \n+#if APP_THREAD_HEADROOM_STATS_COLLECT\n+\n+#define PIPELINE_RUN_REGULAR(thread, pipeline)\t\t\\\n+do {\t\t\t\t\t\t\t\\\n+\tuint64_t t0 = rte_rdtsc_precise();\t\t\\\n+\tint n_pkts = rte_pipeline_run(pipeline->p);\t\\\n+\t\t\t\t\t\t\t\\\n+\tif (n_pkts == 0) {\t\t\t\t\\\n+\t\tuint64_t t1 = rte_rdtsc_precise();\t\\\n+\t\t\t\t\t\t\t\\\n+\t\tthread->headroom_cycles += t1 - t0;\t\\\n+\t}\t\t\t\t\t\t\\\n+} while (0)\n+\n+\n+#define PIPELINE_RUN_CUSTOM(thread, data)\t\t\\\n+do {\t\t\t\t\t\t\t\\\n+\tuint64_t t0 = rte_rdtsc_precise();\t\t\\\n+\tint n_pkts = data->f_run(data->be);\t\t\\\n+\t\t\t\t\t\t\t\\\n+\tif (n_pkts == 0) {\t\t\t\t\\\n+\t\tuint64_t t1 = rte_rdtsc_precise();\t\\\n+\t\t\t\t\t\t\t\\\n+\t\tthread->headroom_cycles += t1 - t0;\t\\\n+\t}\t\t\t\t\t\t\\\n+} while (0)\n+\n+#else\n+\n+#define PIPELINE_RUN_REGULAR(thread, pipeline)\t\t\\\n+\trte_pipeline_run(pipeline->p)\n+\n+#define PIPELINE_RUN_CUSTOM(thread, data)\t\t\\\n+\tdata->f_run(data->be)\n+\n+#endif\n+\n static inline void *\n thread_msg_recv(struct rte_ring *r)\n {\n@@ -165,6 +202,17 @@ thread_msg_req_handle(struct app_thread_data *t)\n \t\t\tthread_msg_send(t->msgq_out, rsp);\n \t\t\tbreak;\n \t\t}\n+\n+\t\tcase THREAD_MSG_REQ_HEADROOM_READ: {\n+\t\t\tstruct thread_headroom_read_msg_rsp *rsp =\n+\t\t\t\t(struct thread_headroom_read_msg_rsp *)\n+\t\t\t\treq;\n+\n+\t\t\trsp->headroom_ratio = t->headroom_ratio;\n+\t\t\trsp->status = 0;\n+\t\t\tthread_msg_send(t->msgq_out, rsp);\n+\t\t\tbreak;\n+\t\t}\n \t\tdefault:\n \t\t\tbreak;\n \t\t}\n@@ -172,6 +220,18 @@ thread_msg_req_handle(struct app_thread_data *t)\n \treturn 0;\n }\n \n+static void\n+thread_headroom_update(struct app_thread_data *t, uint64_t time) {\n+\tuint64_t time_diff = time - t->headroom_time;\n+\n+\tt->headroom_ratio =\n+\t\t((double) t->headroom_cycles) / ((double) time_diff);\n+\n+\tt->headroom_cycles = 0;\n+\tt->headroom_time = rte_rdtsc_precise(); }\n+\n int\n app_thread(void *arg)\n {\n@@ -188,14 +248,14 @@ app_thread(void *arg)\n \t\t\tstruct app_thread_pipeline_data *data = &t->regular[j];\n \t\t\tstruct pipeline *p = data->be;\n \n-\t\t\trte_pipeline_run(p->p);\n+\t\t\tPIPELINE_RUN_REGULAR(t, p);\n \t\t}\n \n \t\t/* Run custom pipelines */\n \t\tfor (j = 0; j < n_custom; j++) {\n \t\t\tstruct app_thread_pipeline_data *data = &t->custom[j];\n \n-\t\t\tdata->f_run(data->be);\n+\t\t\tPIPELINE_RUN_CUSTOM(t, data);\n \t\t}\n \n \t\t/* Timer */\n@@ -244,6 +304,7 @@ app_thread(void *arg)\n \n \t\t\t\tif (deadline <= time) {\n \t\t\t\t\tthread_msg_req_handle(t);\n+\t\t\t\t\tthread_headroom_update(t, time);\n \t\t\t\t\tdeadline = time + t->timer_period;\n \t\t\t\t\tt->thread_req_deadline = deadline;\n \t\t\t\t}\n@@ -252,6 +313,7 @@ app_thread(void *arg)\n \t\t\t\t\tt_deadline = deadline;\n \t\t\t}\n \n+\n \t\t\tt->deadline = t_deadline;\n \t\t}\n \t}\ndiff --git a/examples/ip_pipeline/thread.h b/examples/ip_pipeline/thread.h index dc877c0..e52b22e 100644\n--- a/examples/ip_pipeline/thread.h\n+++ b/examples/ip_pipeline/thread.h\n@@ -40,6 +40,7 @@\n enum thread_msg_req_type {\n \tTHREAD_MSG_REQ_PIPELINE_ENABLE = 0,\n \tTHREAD_MSG_REQ_PIPELINE_DISABLE,\n+\tTHREAD_MSG_REQ_HEADROOM_READ,\n \tTHREAD_MSG_REQS\n };\n \n@@ -81,4 +82,17 @@ struct thread_pipeline_disable_msg_rsp {\n \tint status;\n };\n \n+/*\n+ * THREAD HEADROOM\n+ */\n+struct thread_headroom_read_msg_req {\n+\tenum thread_msg_req_type type;\n+};\n+\n+struct thread_headroom_read_msg_rsp {\n+\tint status;\n+\n+\tdouble headroom_ratio;\n+};\n+\n #endif /* THREAD_H_ */\ndiff --git a/examples/ip_pipeline/thread_fe.c b/examples/ip_pipeline/thread_fe.c\nindex 95f0107..4a435f7 100644\n--- a/examples/ip_pipeline/thread_fe.c\n+++ b/examples/ip_pipeline/thread_fe.c\n@@ -170,6 +170,54 @@ app_pipeline_disable(struct app_params *app,\n \treturn 0;\n }\n \n+int\n+app_thread_headroom(struct app_params *app,\n+\t\tuint32_t socket_id,\n+\t\tuint32_t core_id,\n+\t\tuint32_t hyper_th_id)\n+{\n+\tstruct thread_headroom_read_msg_req *req;\n+\tstruct thread_headroom_read_msg_rsp *rsp;\n+\tint thread_id;\n+\tint status;\n+\n+\tif (app == NULL)\n+\t\treturn -1;\n+\n+\tthread_id = cpu_core_map_get_lcore_id(app->core_map,\n+\t\t\tsocket_id,\n+\t\t\tcore_id,\n+\t\t\thyper_th_id);\n+\n+\tif ((thread_id < 0) ||\n+\t\t((app->core_mask & (1LLU << thread_id)) == 0))\n+\t\treturn -1;\n+\n+\treq = app_msg_alloc(app);\n+\tif (req == NULL)\n+\t\treturn -1;\n+\n+\treq->type = THREAD_MSG_REQ_HEADROOM_READ;\n+\n+\trsp = thread_msg_send_recv(app,\n+\t\tsocket_id, core_id, hyper_th_id, req, MSG_TIMEOUT_DEFAULT);\n+\n+\tif (rsp == NULL)\n+\t\treturn -1;\n+\n+\tstatus = rsp->status;\n+\n+\tif (status != 0)\n+\t\treturn -1;\n+\n+\tprintf(\"%.3f%%\\n\", rsp->headroom_ratio * 100);\n+\n+\n+\tapp_msg_free(app, rsp);\n+\n+\treturn 0;\n+}\n+\n /*\n  * pipeline enable\n  */\n@@ -318,9 +366,74 @@ cmdline_parse_inst_t cmd_pipeline_disable = {\n \t},\n };\n \n+\n+/*\n+ * thread headroom\n+ */\n+\n+struct cmd_thread_headroom_result {\n+\tcmdline_fixed_string_t t_string;\n+\tcmdline_fixed_string_t t_id_string;\n+\tcmdline_fixed_string_t headroom_string; };\n+\n+static void\n+cmd_thread_headroom_parsed(\n+\tvoid *parsed_result,\n+\t__rte_unused struct cmdline *cl,\n+\t void *data)\n+{\n+\tstruct cmd_thread_headroom_result *params = parsed_result;\n+\tstruct app_params *app = data;\n+\tint status;\n+\tuint32_t core_id, socket_id, hyper_th_id;\n+\n+\tif (parse_pipeline_core(&socket_id,\n+\t\t\t&core_id,\n+\t\t\t&hyper_th_id,\n+\t\t\tparams->t_id_string) != 0) {\n+\t\tprintf(\"Command failed\\n\");\n+\t\treturn;\n+\t}\n+\n+\tstatus = app_thread_headroom(app,\n+\t\t\tsocket_id,\n+\t\t\tcore_id,\n+\t\t\thyper_th_id);\n+\n+\tif (status != 0)\n+\t\tprintf(\"Command failed\\n\");\n+}\n+\n+cmdline_parse_token_string_t cmd_thread_headroom_t_string =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_thread_headroom_result,\n+\tt_string, \"t\");\n+\n+cmdline_parse_token_string_t cmd_thread_headroom_t_id_string =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_thread_headroom_result,\n+\tt_id_string, NULL);\n+\n+cmdline_parse_token_string_t cmd_thread_headroom_headroom_string =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_thread_headroom_result,\n+\t\theadroom_string, \"headroom\");\n+\n+cmdline_parse_inst_t cmd_thread_headroom = {\n+\t.f = cmd_thread_headroom_parsed,\n+\t.data = NULL,\n+\t.help_str = \"Display thread headroom\",\n+\t.tokens = {\n+\t\t(void *)&cmd_thread_headroom_t_string,\n+\t\t(void *)&cmd_thread_headroom_t_id_string,\n+\t\t(void *)&cmd_thread_headroom_headroom_string,\n+\t\tNULL,\n+\t},\n+};\n+\n+\n static cmdline_parse_ctx_t thread_cmds[] = {\n \t(cmdline_parse_inst_t *) &cmd_pipeline_enable,\n \t(cmdline_parse_inst_t *) &cmd_pipeline_disable,\n+\t(cmdline_parse_inst_t *) &cmd_thread_headroom,\n \tNULL,\n };\n \ndiff --git a/examples/ip_pipeline/thread_fe.h b/examples/ip_pipeline/thread_fe.h\nindex 52352c1..2fd4ee8 100644\n--- a/examples/ip_pipeline/thread_fe.h\n+++ b/examples/ip_pipeline/thread_fe.h\n@@ -92,4 +92,10 @@ app_pipeline_disable(struct app_params *app,\n \t\tuint32_t hyper_th_id,\n \t\tuint32_t pipeline_id);\n \n+int\n+app_thread_headroom(struct app_params *app,\n+\t\tuint32_t core_id,\n+\t\tuint32_t socket_id,\n+\t\tuint32_t hyper_th_id);\n+\n #endif /* THREAD_FE_H_ */\n",
    "prefixes": [
        "dpdk-dev",
        "v2"
    ]
}