get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 63608,
    "url": "http://patches.dpdk.org/api/patches/63608/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191205173128.64543-7-ciara.power@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": "<20191205173128.64543-7-ciara.power@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191205173128.64543-7-ciara.power@intel.com",
    "date": "2019-12-05T17:31:28",
    "name": "[RFC,6/6] examples/l3fwd-power: enable use of process-info",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "91c1bfdd64c7e71ee84de49da33aad3923ce541a",
    "submitter": {
        "id": 978,
        "url": "http://patches.dpdk.org/api/people/978/?format=api",
        "name": "Power, Ciara",
        "email": "ciara.power@intel.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/20191205173128.64543-7-ciara.power@intel.com/mbox/",
    "series": [
        {
            "id": 7741,
            "url": "http://patches.dpdk.org/api/series/7741/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7741",
            "date": "2019-12-05T17:31:22",
            "name": "replace telemetry with process_info",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/7741/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/63608/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/63608/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 30DBCA04F2;\n\tThu,  5 Dec 2019 18:35:10 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 490F51BFB0;\n\tThu,  5 Dec 2019 18:34:22 +0100 (CET)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by dpdk.org (Postfix) with ESMTP id 632001BF97\n for <dev@dpdk.org>; Thu,  5 Dec 2019 18:34:16 +0100 (CET)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 05 Dec 2019 09:34:15 -0800",
            "from silpixa00399953.ir.intel.com (HELO\n silpixa00399953.ger.corp.intel.com) ([10.237.222.53])\n by orsmga002.jf.intel.com with ESMTP; 05 Dec 2019 09:34:14 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.69,282,1571727600\"; d=\"scan'208\";a=\"223711870\"",
        "From": "Ciara Power <ciara.power@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Ciara Power <ciara.power@intel.com>,\n Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Thu,  5 Dec 2019 17:31:28 +0000",
        "Message-Id": "<20191205173128.64543-7-ciara.power@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191205173128.64543-1-ciara.power@intel.com>",
        "References": "<20191205173128.64543-1-ciara.power@intel.com>",
        "Subject": "[dpdk-dev] [RFC 6/6] examples/l3fwd-power: enable use of\n\tprocess-info",
        "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": "The l3fwd-power example app now registers a stats command with\nprocess_info, and provides a callback function to handle formatting the\npower stats.\n\nUsing the process-info library in this app replaces the previous method\nof making l3fwd-power stats available in the metrics library, for use\nwith telemetry.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\nSigned-off-by: Ciara Power <ciara.power@intel.com>\n---\n examples/l3fwd-power/main.c | 83 +++++++++++--------------------------\n 1 file changed, 25 insertions(+), 58 deletions(-)",
    "diff": "diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c\nindex d049d8a5d..939b3dd88 100644\n--- a/examples/l3fwd-power/main.c\n+++ b/examples/l3fwd-power/main.c\n@@ -45,7 +45,7 @@\n #include <rte_power.h>\n #include <rte_spinlock.h>\n #include <rte_power_empty_poll.h>\n-#include <rte_metrics.h>\n+#include <rte_process_info.h>\n \n #include \"perf_core.h\"\n #include \"main.h\"\n@@ -131,7 +131,7 @@\n #define EMPTY_POLL_MED_THRESHOLD 350000UL\n #define EMPTY_POLL_HGH_THRESHOLD 580000UL\n \n-\n+#define NUM_TELSTATS RTE_DIM(telstats_strings)\n \n static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;\n static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;\n@@ -154,11 +154,6 @@ volatile bool quit_signal;\n static struct  ep_params *ep_params;\n static struct  ep_policy policy;\n static long  ep_med_edpi, ep_hgh_edpi;\n-/* timer to update telemetry every 500ms */\n-static struct rte_timer telemetry_timer;\n-\n-/* stats index returned by metrics lib */\n-int telstats_index;\n \n struct telstats_name {\n \tchar name[RTE_ETH_XSTATS_NAME_SIZE];\n@@ -187,9 +182,6 @@ enum busy_rate {\n #define MIN_CYCLES  1500000ULL\n #define MAX_CYCLES 22000000ULL\n \n-/* (500ms) */\n-#define TELEMETRY_INTERVALS_PER_SEC 2\n-\n static int parse_ptype; /**< Parse packet type using rx callback, and */\n \t\t\t/**< disabled by default */\n \n@@ -2087,17 +2079,21 @@ init_power_library(void)\n \t}\n \treturn ret;\n }\n-static void\n-update_telemetry(__attribute__((unused)) struct rte_timer *tim,\n-\t\t__attribute__((unused)) void *arg)\n+\n+static int\n+handle_app_stats(const char *cmd __rte_unused,\n+\t\tconst char *params __rte_unused,\n+\t\tchar *buffer, int buf_len)\n {\n \tunsigned int lcore_id = rte_lcore_id();\n \tstruct lcore_conf *qconf;\n \tuint64_t app_eps = 0, app_fps = 0, app_br = 0;\n-\tuint64_t values[3] = {0};\n-\tint ret;\n+\tuint64_t values[NUM_TELSTATS];\n+\tint ret, used = 0;\n+\tuint32_t i;\n \tuint64_t count = 0;\n \n+\tused = strlcpy(buffer, \"{\", buf_len);\n \tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n \t\tqconf = &lcore_conf[lcore_id];\n \t\tif (qconf->n_rx_queue == 0)\n@@ -2114,32 +2110,21 @@ update_telemetry(__attribute__((unused)) struct rte_timer *tim,\n \t\tvalues[0] = app_eps/count;\n \t\tvalues[1] = app_fps/count;\n \t\tvalues[2] = app_br/count;\n-\t} else {\n-\t\tvalues[0] = 0;\n-\t\tvalues[1] = 0;\n-\t\tvalues[2] = 0;\n+\t} else\n+\t\tmemset(values, 0, sizeof(uint64_t) * NUM_TELSTATS);\n+\n+\tfor (i = 0; i < NUM_TELSTATS; i++) {\n+\t\tret = snprintf(buffer + used, buf_len - used, \"\\\"%s\\\":%\"PRIu64\",\",\n+\t\t\t\ttelstats_strings[i].name, values[i]);\n+\t\tif (ret + used >= buf_len)\n+\t\t\tbreak;\n+\t\tused += ret;\n \t}\n \n-\tret = rte_metrics_update_values(RTE_METRICS_GLOBAL, telstats_index,\n-\t\t\t\t\tvalues, RTE_DIM(values));\n-\tif (ret < 0)\n-\t\tRTE_LOG(WARNING, POWER, \"failed to update metrcis\\n\");\n+\tbuffer[used - 1] = '}';\n+\treturn used;\n }\n-static void\n-telemetry_setup_timer(void)\n-{\n-\tint lcore_id = rte_lcore_id();\n-\tuint64_t hz = rte_get_timer_hz();\n-\tuint64_t ticks;\n \n-\tticks = hz / TELEMETRY_INTERVALS_PER_SEC;\n-\trte_timer_reset_sync(&telemetry_timer,\n-\t\t\tticks,\n-\t\t\tPERIODICAL,\n-\t\t\tlcore_id,\n-\t\t\tupdate_telemetry,\n-\t\t\tNULL);\n-}\n static void\n empty_poll_setup_timer(void)\n {\n@@ -2176,8 +2161,6 @@ launch_timer(unsigned int lcore_id)\n \n \tif (app_mode == APP_MODE_EMPTY_POLL)\n \t\tempty_poll_setup_timer();\n-\telse\n-\t\ttelemetry_setup_timer();\n \n \tcycles_10ms = rte_get_timer_hz() / 100;\n \n@@ -2196,7 +2179,6 @@ launch_timer(unsigned int lcore_id)\n \treturn 0;\n }\n \n-\n int\n main(int argc, char **argv)\n {\n@@ -2212,8 +2194,6 @@ main(int argc, char **argv)\n \tuint32_t dev_rxq_num, dev_txq_num;\n \tuint8_t nb_rx_queue, queue, socketid;\n \tuint16_t portid;\n-\tuint8_t num_telstats = RTE_DIM(telstats_strings);\n-\tconst char *ptr_strings[num_telstats];\n \n \t/* catch SIGINT and restore cpufreq governor to ondemand */\n \tsignal(SIGINT, signal_exit_now);\n@@ -2507,29 +2487,16 @@ main(int argc, char **argv)\n \t\trte_eal_mp_remote_launch(main_empty_poll_loop, NULL,\n \t\t\t\tSKIP_MASTER);\n \t} else {\n-\t\tunsigned int i;\n-\n-\t\t/* Init metrics library */\n-\t\trte_metrics_init(rte_socket_id());\n-\t\t/** Register stats with metrics library */\n-\t\tfor (i = 0; i < num_telstats; i++)\n-\t\t\tptr_strings[i] = telstats_strings[i].name;\n-\n-\t\tret = rte_metrics_reg_names(ptr_strings, num_telstats);\n-\t\tif (ret >= 0)\n-\t\t\ttelstats_index = ret;\n-\t\telse\n-\t\t\trte_exit(EXIT_FAILURE, \"failed to register metrics names\");\n-\n \t\tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n \t\t\trte_spinlock_init(&stats[lcore_id].telemetry_lock);\n \t\t}\n-\t\trte_timer_init(&telemetry_timer);\n+\t\trte_process_info_register(\"/l3fwd-power:stats\",\n+\t\t\t\thandle_app_stats);\n \t\trte_eal_mp_remote_launch(main_telemetry_loop, NULL,\n \t\t\t\t\t\tSKIP_MASTER);\n \t}\n \n-\tif (app_mode == APP_MODE_EMPTY_POLL || app_mode == APP_MODE_TELEMETRY)\n+\tif (app_mode == APP_MODE_EMPTY_POLL)\n \t\tlaunch_timer(rte_lcore_id());\n \n \tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n",
    "prefixes": [
        "RFC",
        "6/6"
    ]
}