get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 87890,
    "url": "http://patches.dpdk.org/api/patches/87890/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210212165814.2189305-1-harry.van.haaren@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": "<20210212165814.2189305-1-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210212165814.2189305-1-harry.van.haaren@intel.com",
    "date": "2021-02-12T16:58:12",
    "name": "[v3,1/3] service: add component useful work attribute",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5c0cf5271da7d2d43c8daaf4c96e8f7c0f733bf6",
    "submitter": {
        "id": 317,
        "url": "http://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": {
        "id": 310,
        "url": "http://patches.dpdk.org/api/users/310/?format=api",
        "username": "jerin",
        "first_name": "Jerin",
        "last_name": "Jacob",
        "email": "jerinj@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210212165814.2189305-1-harry.van.haaren@intel.com/mbox/",
    "series": [
        {
            "id": 15254,
            "url": "http://patches.dpdk.org/api/series/15254/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15254",
            "date": "2021-02-12T16:58:12",
            "name": "[v3,1/3] service: add component useful work attribute",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/15254/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/87890/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/87890/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D632CA0547;\n\tFri, 12 Feb 2021 17:58:26 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 548F322A2AC;\n\tFri, 12 Feb 2021 17:58:26 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by mails.dpdk.org (Postfix) with ESMTP id 46B0822A2AB\n for <dev@dpdk.org>; Fri, 12 Feb 2021 17:58:24 +0100 (CET)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 12 Feb 2021 08:58:22 -0800",
            "from silpixa00400633.ir.intel.com ([10.237.213.44])\n by orsmga003.jf.intel.com with ESMTP; 12 Feb 2021 08:58:21 -0800"
        ],
        "IronPort-SDR": [
            "\n uVse3fUR3u9DQL5eBhCCJ+C5kggn5KuBaAiZpaO0DXfNj/R7h0xfD5CBy/ao8XoaSD2ibaOv8L\n gDVGO9KQR6Aw==",
            "\n rJ4b3Y3+He3/NSx9sB1fymXcGS+j9lktFwrPYr/OfKaWb8ldlni2dTfTLGi5o7h3IMN8ovkET8\n 1iXyjojIlTSg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9893\"; a=\"182511455\"",
            "E=Sophos;i=\"5.81,174,1610438400\"; d=\"scan'208\";a=\"182511455\"",
            "E=Sophos;i=\"5.81,174,1610438400\"; d=\"scan'208\";a=\"360466416\""
        ],
        "X-ExtLoop1": "1",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, mattias.ronnblom@ericsson.com,\n honnappa.nagarahalli@arm.com, Harry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Fri, 12 Feb 2021 16:58:12 +0000",
        "Message-Id": "<20210212165814.2189305-1-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 1/3] service: add component useful work\n attribute",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "This commit adds a new attribute which allows the service to indicate\nif the previous iteration of work was \"useful\". Useful work here implies\nforward progress was made.\n\nExposing this information via an attribute to the application allows\ntracking of CPU cycles as being useful or not-useful, and a CPU load\nestimate can be deduced from that information.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n lib/librte_eal/common/rte_service.c           | 19 +++++++++++++++++++\n lib/librte_eal/include/rte_service.h          |  5 +++++\n .../include/rte_service_component.h           | 13 +++++++++++++\n lib/librte_eal/version.map                    |  3 +++\n 4 files changed, 40 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex bd8fb72e78..8595555fc3 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -58,6 +58,7 @@ struct rte_service_spec_impl {\n \tuint32_t num_mapped_cores;\n \tuint64_t calls;\n \tuint64_t cycles_spent;\n+\tuint8_t useful_work_last_iter;\n } __rte_cache_aligned;\n \n /* the internal values of a service core */\n@@ -294,6 +295,21 @@ rte_service_component_unregister(uint32_t id)\n \treturn 0;\n }\n \n+int32_t\n+rte_service_component_attr_set(uint32_t id, uint32_t attr, uint64_t value)\n+{\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n+\n+\tswitch (attr) {\n+\tcase RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:\n+\t\ts->useful_work_last_iter = value;\n+\t\treturn 0;\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t};\n+}\n+\n int32_t\n rte_service_component_runstate_set(uint32_t id, uint32_t runstate)\n {\n@@ -799,6 +815,9 @@ rte_service_attr_get(uint32_t id, uint32_t attr_id, uint64_t *attr_value)\n \t\treturn -EINVAL;\n \n \tswitch (attr_id) {\n+\tcase RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER:\n+\t\t*attr_value = s->useful_work_last_iter;\n+\t\treturn 0;\n \tcase RTE_SERVICE_ATTR_CYCLES:\n \t\t*attr_value = s->cycles_spent;\n \t\treturn 0;\ndiff --git a/lib/librte_eal/include/rte_service.h b/lib/librte_eal/include/rte_service.h\nindex ca9950d091..d50b5c8d7a 100644\n--- a/lib/librte_eal/include/rte_service.h\n+++ b/lib/librte_eal/include/rte_service.h\n@@ -390,6 +390,11 @@ int32_t rte_service_dump(FILE *f, uint32_t id);\n  */\n #define RTE_SERVICE_ATTR_CALL_COUNT 1\n \n+/**\n+ * Returns if the last iteration of the service resulted in useful work done.\n+ */\n+#define RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER 2\n+\n /**\n  * Get an attribute from a service.\n  *\ndiff --git a/lib/librte_eal/include/rte_service_component.h b/lib/librte_eal/include/rte_service_component.h\nindex 9e66ee7e29..534f41f531 100644\n--- a/lib/librte_eal/include/rte_service_component.h\n+++ b/lib/librte_eal/include/rte_service_component.h\n@@ -87,6 +87,19 @@ int32_t rte_service_component_register(const struct rte_service_spec *spec,\n  */\n int32_t rte_service_component_unregister(uint32_t id);\n \n+/**\n+ * Set an attribute for this service.\n+ *\n+ * Note this API is to be called by the service implementation, to make the\n+ * statistic available via the usual attr_get() service APIs.\n+ *\n+ * @retval 0 Success\n+ * @retval -EINVAL Invalid service id or attribute provided\n+ */\n+__rte_experimental\n+int32_t rte_service_component_attr_set(uint32_t id, uint32_t attr,\n+\t\tuint64_t value);\n+\n /**\n  * Private function to allow EAL to initialized default mappings.\n  *\ndiff --git a/lib/librte_eal/version.map b/lib/librte_eal/version.map\nindex fce90a112f..e60eaa3dd9 100644\n--- a/lib/librte_eal/version.map\n+++ b/lib/librte_eal/version.map\n@@ -412,6 +412,9 @@ EXPERIMENTAL {\n \trte_thread_tls_key_delete;\n \trte_thread_tls_value_get;\n \trte_thread_tls_value_set;\n+\n+\t# added in 21.05\n+\trte_service_component_attr_set;\n };\n \n INTERNAL {\n",
    "prefixes": [
        "v3",
        "1/3"
    ]
}