get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 74014,
    "url": "http://patches.dpdk.org/api/patches/74014/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200714160200.1727417-1-rory.sexton@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": "<20200714160200.1727417-1-rory.sexton@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200714160200.1727417-1-rory.sexton@intel.com",
    "date": "2020-07-14T16:01:58",
    "name": "[v4,1/3] examples/vm_power_manager: Make branch ratio threshold per core",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "92ed58a620857450fe3a2cba07a670274b06e273",
    "submitter": {
        "id": 619,
        "url": "http://patches.dpdk.org/api/people/619/?format=api",
        "name": "Sexton, Rory",
        "email": "rory.sexton@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/20200714160200.1727417-1-rory.sexton@intel.com/mbox/",
    "series": [
        {
            "id": 11021,
            "url": "http://patches.dpdk.org/api/series/11021/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=11021",
            "date": "2020-07-14T16:01:59",
            "name": "[v4,1/3] examples/vm_power_manager: Make branch ratio threshold per core",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/11021/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/74014/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/74014/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 88381A0540;\n\tTue, 14 Jul 2020 18:02:26 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1ABA81D182;\n\tTue, 14 Jul 2020 18:02:20 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by dpdk.org (Postfix) with ESMTP id D36A91D165\n for <dev@dpdk.org>; Tue, 14 Jul 2020 18:02:16 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 14 Jul 2020 09:02:02 -0700",
            "from silpixa00399913.ir.intel.com ([10.237.213.189])\n by orsmga006.jf.intel.com with ESMTP; 14 Jul 2020 09:02:01 -0700"
        ],
        "IronPort-SDR": [
            "\n yOpQmFU1PHTbJ/6TVwq+CQnbqg4Cpgv2vW0tL1Go8bGKTMK8lf2n6pNi1DlDwS0PEsY8t0fHgc\n M4SMfoG4524A==",
            "\n kqciJCiIpUqUEqtz9gb/Es4vnPmFy9n88JTj0zgF+7/B515jXqQDznVx5/TCtE/nie5Gdph9Z5\n ah+TPO6R9xPQ=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9681\"; a=\"146446380\"",
            "E=Sophos;i=\"5.75,350,1589266800\"; d=\"scan'208\";a=\"146446380\"",
            "E=Sophos;i=\"5.75,350,1589266800\"; d=\"scan'208\";a=\"285799812\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Rory Sexton <rory.sexton@intel.com>",
        "To": "dev@dpdk.org,\n\tdavid.hunt@intel.com",
        "Date": "Tue, 14 Jul 2020 17:01:58 +0100",
        "Message-Id": "<20200714160200.1727417-1-rory.sexton@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [v4 1/3] examples/vm_power_manager: Make branch ratio\n\tthreshold 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\nSigned-off-by: Rory Sexton <rory.sexton@intel.com>\nReviewed-by: David Hunt <david.hunt@intel.com>\n\n---\nv4: adding upper limit of 100.0 to branch ratio\n---\n examples/vm_power_manager/main.c            | 41 +++++++++++---------\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, 69 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c\nindex 273bfec29..77797b1e1 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,37 @@ 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 || branch_ratio > 100.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 =\n+\t\t\t\t\t\t\t\tbranch_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..8a8dcf05f 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 ':' separator 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 ':' separator 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..892dee449 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 *input, float *branch_ratio);\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 cd51d4741..c5cf6bffa 100644\n--- a/examples/vm_power_manager/power_manager.c\n+++ b/examples/vm_power_manager/power_manager.c\n@@ -59,7 +59,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@@ -68,6 +67,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": [
        "v4",
        "1/3"
    ]
}