get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 70373,
    "url": "https://patches.dpdk.org/api/patches/70373/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200518101211.26025-1-rory.sexton@intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20200518101211.26025-1-rory.sexton@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200518101211.26025-1-rory.sexton@intel.com",
    "date": "2020-05-18T10:12:09",
    "name": "[v1,1/3] examples/vm_power_manager: Make branch ratio threshold per core",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "560a8187f476f1b9deb298d0b40f6262bb1bfab5",
    "submitter": {
        "id": 619,
        "url": "https://patches.dpdk.org/api/people/619/?format=api",
        "name": "Sexton, Rory",
        "email": "rory.sexton@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200518101211.26025-1-rory.sexton@intel.com/mbox/",
    "series": [
        {
            "id": 10125,
            "url": "https://patches.dpdk.org/api/series/10125/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10125",
            "date": "2020-05-18T10:12:09",
            "name": "[v1,1/3] examples/vm_power_manager: Make branch ratio threshold per core",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/10125/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/70373/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/70373/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 570FDA0093;\n\tMon, 18 May 2020 12:33:51 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D3EEB1D40D;\n\tMon, 18 May 2020 12:33:50 +0200 (CEST)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n by dpdk.org (Postfix) with ESMTP id 76DEC1D40B\n for <dev@dpdk.org>; Mon, 18 May 2020 12:33:48 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 18 May 2020 03:33:45 -0700",
            "from silpixa00399913.ir.intel.com (HELO\n silpixa00399913.ger.corp.intel.com) ([10.237.222.230])\n by orsmga006.jf.intel.com with ESMTP; 18 May 2020 03:33:45 -0700"
        ],
        "IronPort-SDR": [
            "\n qcVqXCOcESR1HgOMvSyaDPXKQ4Uo++zkBcObgQEd9wUDiWfT9jucaagya7FznyDezmmfUmtQk4\n h/fbN8MCyrRQ==",
            "\n kT2T6IExmQjwwwwHBf3oFNPpXT/saN8Ayy5dkfSLe6PKZLNoAme+XcsM3Dp00PjyBGkoOYgwlK\n +lXJ3qhZvQJw=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.73,406,1583222400\"; d=\"scan'208\";a=\"267473877\"",
        "From": "\"Sexton, Rory\" <rory.sexton@intel.com>",
        "To": "dev@dpdk.org,\n\tdavid.hunt@intel.com",
        "Cc": "\"Sexton, Rory\" <rory.sexton@intel.com>",
        "Date": "Mon, 18 May 2020 11:12:09 +0100",
        "Message-Id": "<20200518101211.26025-1-rory.sexton@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "Subject": "[dpdk-dev] [PATCH v1 1/3] examples/vm_power_manager: Make branch\n\tratio threshold per core",
        "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": "This modification allows for the branch ratio threshold to be set\nper core rather than system wide. This gives greater flexibility to\nthe branch ration monitoring allowing it to manage different\nworkloads with different characteristics on the same system.\n---\n examples/vm_power_manager/main.c            | 40 +++++++++++---------\n examples/vm_power_manager/oob_monitor_x86.c |  2 +-\n examples/vm_power_manager/parse.c           | 42 ++++++++++++++++++++-\n examples/vm_power_manager/parse.h           |  3 ++\n examples/vm_power_manager/power_manager.c   |  2 +-\n examples/vm_power_manager/power_manager.h   |  2 +-\n 6 files changed, 68 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c\nindex 273bfec29..f077e3fe4 100644\n--- a/examples/vm_power_manager/main.c\n+++ b/examples/vm_power_manager/main.c\n@@ -165,15 +165,14 @@ parse_args(int argc, char **argv)\n \tstatic struct option lgopts[] = {\n \t\t{ \"mac-updating\", no_argument, 0, 1},\n \t\t{ \"no-mac-updating\", no_argument, 0, 0},\n-\t\t{ \"core-list\", optional_argument, 0, 'l'},\n+\t\t{ \"core-branch-ratio\", optional_argument, 0, 'b'},\n \t\t{ \"port-list\", optional_argument, 0, 'p'},\n-\t\t{ \"branch-ratio\", optional_argument, 0, 'b'},\n \t\t{NULL, 0, 0, 0}\n \t};\n \targvopt = argv;\n \tci = get_core_info();\n \n-\twhile ((opt = getopt_long(argc, argvopt, \"l:p:q:T:b:\",\n+\twhile ((opt = getopt_long(argc, argvopt, \"p:q:T:b:\",\n \t\t\t\t  lgopts, &option_index)) != EOF) {\n \n \t\tswitch (opt) {\n@@ -185,7 +184,8 @@ parse_args(int argc, char **argv)\n \t\t\t\treturn -1;\n \t\t\t}\n \t\t\tbreak;\n-\t\tcase 'l':\n+\t\tcase 'b':\n+\t\t\tbranch_ratio = BRANCH_RATIO_THRESHOLD;\n \t\t\toob_enable = malloc(ci->core_count * sizeof(uint16_t));\n \t\t\tif (oob_enable == NULL) {\n \t\t\t\tprintf(\"Error - Unable to allocate memory\\n\");\n@@ -193,32 +193,36 @@ parse_args(int argc, char **argv)\n \t\t\t}\n \t\t\tcnt = parse_set(optarg, oob_enable, ci->core_count);\n \t\t\tif (cnt < 0) {\n-\t\t\t\tprintf(\"Invalid core-list - [%s]\\n\",\n+\t\t\t\tprintf(\"Invalid core-list section in \"\n+\t\t\t\t       \"core-branch-ratio matrix - [%s]\\n\",\n+\t\t\t\t\t\toptarg);\n+\t\t\t\tfree(oob_enable);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tcnt = parse_branch_ratio(optarg, &branch_ratio);\n+\t\t\tif (cnt < 0) {\n+\t\t\t\tprintf(\"Invalid branch-ratio section in \"\n+\t\t\t\t       \"core-branch-ratio matrix - [%s]\\n\",\n \t\t\t\t\t\toptarg);\n \t\t\t\tfree(oob_enable);\n \t\t\t\tbreak;\n \t\t\t}\n+\t\t\tif (branch_ratio <= 0.0) {\n+\t\t\t\tprintf(\"invalid branch ratio specified\\n\");\n+\t\t\t\treturn -1;\n+\t\t\t}\n \t\t\tfor (i = 0; i < ci->core_count; i++) {\n \t\t\t\tif (oob_enable[i]) {\n-\t\t\t\t\tprintf(\"***Using core %d\\n\", i);\n+\t\t\t\t\tprintf(\"***Using core %d \"\n+\t\t\t\t\t       \"with branch ratio %f\\n\",\n+\t\t\t\t\t       i, branch_ratio);\n \t\t\t\t\tci->cd[i].oob_enabled = 1;\n \t\t\t\t\tci->cd[i].global_enabled_cpus = 1;\n+\t\t\t\t\tci->cd[i].branch_ratio_threshold = branch_ratio;\n \t\t\t\t}\n \t\t\t}\n \t\t\tfree(oob_enable);\n \t\t\tbreak;\n-\t\tcase 'b':\n-\t\t\tbranch_ratio = 0.0;\n-\t\t\tif (strlen(optarg))\n-\t\t\t\tbranch_ratio = atof(optarg);\n-\t\t\tif (branch_ratio <= 0.0) {\n-\t\t\t\tprintf(\"invalid branch ratio specified\\n\");\n-\t\t\t\treturn -1;\n-\t\t\t}\n-\t\t\tci->branch_ratio_threshold = branch_ratio;\n-\t\t\tprintf(\"***Setting branch ratio to %f\\n\",\n-\t\t\t\t\tbranch_ratio);\n-\t\t\tbreak;\n \t\t/* long options */\n \t\tcase 0:\n \t\t\tbreak;\ndiff --git a/examples/vm_power_manager/oob_monitor_x86.c b/examples/vm_power_manager/oob_monitor_x86.c\nindex aecfcb2eb..3c514475f 100644\n--- a/examples/vm_power_manager/oob_monitor_x86.c\n+++ b/examples/vm_power_manager/oob_monitor_x86.c\n@@ -109,7 +109,7 @@ apply_policy(int core)\n \t * down. Each core_details struct has it's own array.\n \t */\n \tfreq_window_idx = ci->cd[core].freq_window_idx;\n-\tif (ratio > ci->branch_ratio_threshold)\n+\tif (ratio > ci->cd[core].branch_ratio_threshold)\n \t\tci->cd[core].freq_directions[freq_window_idx] = 1;\n \telse\n \t\tci->cd[core].freq_directions[freq_window_idx] = 0;\ndiff --git a/examples/vm_power_manager/parse.c b/examples/vm_power_manager/parse.c\nindex 8231533b6..91d26ea43 100644\n--- a/examples/vm_power_manager/parse.c\n+++ b/examples/vm_power_manager/parse.c\n@@ -60,7 +60,7 @@ parse_set(const char *input, uint16_t set[], unsigned int num)\n \t\t\t\tmin = idx;\n \t\t\telse /* avoid continuous '-' */\n \t\t\t\treturn -1;\n-\t\t} else if ((*end == ',') || (*end == '\\0')) {\n+\t\t} else if ((*end == ',') || (*end == ':') || (*end == '\\0')) {\n \t\t\tmax = idx;\n \n \t\t\tif (min == num)\n@@ -75,7 +75,45 @@ parse_set(const char *input, uint16_t set[], unsigned int num)\n \t\t\treturn -1;\n \n \t\tstr = end + 1;\n-\t} while (*end != '\\0');\n+\t} while ((*end != '\\0') && (*end != ':'));\n+\n+\treturn str - input;\n+}\n+\n+int\n+parse_branch_ratio(const char *input, float *branch_ratio)\n+{\n+\tconst char *str = input;\n+\tchar *end = NULL;\n+\n+\twhile (isblank(*str))\n+\t\tstr++;\n+\n+\tif (*str == '\\0')\n+\t\treturn -1;\n+\n+\t/* Go straight to the ':' seperator if present */\n+\twhile ((*str != '\\0') && (*str != ':'))\n+\t\tstr++;\n+\n+\t/* Branch ratio not specified in args so leave it at default setting */\n+\tif (*str == '\\0')\n+\t\treturn 0;\n+\n+\t/* Confirm ':' seperator present */\n+\tif (*str != ':')\n+\t\treturn -1;\n+\n+\tstr++;\n+\terrno = 0;\n+\t*branch_ratio = strtof(str, &end);\n+\tif (errno || end == NULL)\n+\t\treturn -1;\n+\n+\tif (*end != '\\0')\n+\t\treturn -1;\n+\n+\tstr = end + 1;\n \n \treturn str - input;\n }\ndiff --git a/examples/vm_power_manager/parse.h b/examples/vm_power_manager/parse.h\nindex a5971e9a2..1f0120a81 100644\n--- a/examples/vm_power_manager/parse.h\n+++ b/examples/vm_power_manager/parse.h\n@@ -12,6 +12,9 @@ extern \"C\" {\n int\n parse_set(const char *, uint16_t [], unsigned int);\n \n+int\n+parse_branch_ratio(const char *, float *);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c\nindex 7b4f4b3c4..b52128db1 100644\n--- a/examples/vm_power_manager/power_manager.c\n+++ b/examples/vm_power_manager/power_manager.c\n@@ -60,7 +60,6 @@ core_info_init(void)\n \tci = get_core_info();\n \n \tci->core_count = get_nprocs_conf();\n-\tci->branch_ratio_threshold = BRANCH_RATIO_THRESHOLD;\n \tci->cd = malloc(ci->core_count * sizeof(struct core_details));\n \tmemset(ci->cd, 0, ci->core_count * sizeof(struct core_details));\n \tif (!ci->cd) {\n@@ -69,6 +68,7 @@ core_info_init(void)\n \t}\n \tfor (i = 0; i < ci->core_count; i++) {\n \t\tci->cd[i].global_enabled_cpus = 1;\n+\t\tci->cd[i].branch_ratio_threshold = BRANCH_RATIO_THRESHOLD;\n \t}\n \tprintf(\"%d cores in system\\n\", ci->core_count);\n \treturn 0;\ndiff --git a/examples/vm_power_manager/power_manager.h b/examples/vm_power_manager/power_manager.h\nindex e324766b6..d35f8cbe0 100644\n--- a/examples/vm_power_manager/power_manager.h\n+++ b/examples/vm_power_manager/power_manager.h\n@@ -26,12 +26,12 @@ struct core_details {\n \tuint16_t freq_directions[FREQ_WINDOW_SIZE];\n \tuint16_t freq_window_idx;\n \tuint16_t freq_state;\n+\tfloat branch_ratio_threshold;\n };\n \n struct core_info {\n \tuint16_t core_count;\n \tstruct core_details *cd;\n-\tfloat branch_ratio_threshold;\n };\n \n #define BRANCH_RATIO_THRESHOLD 0.1\n",
    "prefixes": [
        "v1",
        "1/3"
    ]
}