Show a patch.

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

{
    "id": 43063,
    "url": "http://patches.dpdk.org/api/patches/43063/",
    "web_url": "http://patches.dpdk.org/patch/43063/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20180713142302.34576-10-david.hunt@intel.com>",
    "date": "2018-07-13T14:23:02",
    "name": "[v4,9/9] examples/vm_power: make branch ratio configurable",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "a7e1f078aecc68edad5dad6b5d2881514ec34f87",
    "submitter": {
        "id": 342,
        "url": "http://patches.dpdk.org/api/people/342/",
        "name": "David Hunt",
        "email": "david.hunt@intel.com"
    },
    "delegate": {
        "id": 22,
        "url": "http://patches.dpdk.org/api/users/22/",
        "username": "pdelarag",
        "first_name": "Pablo",
        "last_name": "de Lara Guarch",
        "email": "pablo.de.lara.guarch@intel.com"
    },
    "mbox": "http://patches.dpdk.org/patch/43063/mbox/",
    "series": [
        {
            "id": 568,
            "url": "http://patches.dpdk.org/api/series/568/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=568",
            "date": "2018-07-13T14:22:53",
            "name": "examples/vm_power: 100% Busy Polling",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/568/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43063/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/43063/checks/",
    "tags": {},
    "headers": {
        "X-Mailman-Version": "2.1.15",
        "X-ExtLoop1": "1",
        "Errors-To": "dev-bounces@dpdk.org",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Mailer": "git-send-email 2.17.1",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DF1564C8B;\n\tFri, 13 Jul 2018 16:23:38 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 7444C2BFA\n\tfor <dev@dpdk.org>; Fri, 13 Jul 2018 16:23:29 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Jul 2018 07:23:29 -0700",
            "from silpixa00399952.ir.intel.com (HELO\n\tsilpixa00399952.ger.corp.intel.com) ([10.237.223.64])\n\tby orsmga007.jf.intel.com with ESMTP; 13 Jul 2018 07:23:28 -0700"
        ],
        "References": "<20180626092317.11031-2-david.hunt@intel.com>\n\t<20180713142302.34576-1-david.hunt@intel.com>",
        "X-Amp-File-Uploaded": "False",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<20180713142302.34576-10-david.hunt@intel.com>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,347,1526367600\"; d=\"scan'208\";a=\"56278233\"",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Precedence": "list",
        "From": "David Hunt <david.hunt@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "In-Reply-To": "<20180713142302.34576-1-david.hunt@intel.com>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "To": "dev@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Fri, 13 Jul 2018 15:23:02 +0100",
        "Cc": "david.hunt@intel.com,\n\tthomas@monjalon.net",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Subject": "[dpdk-dev] [PATCH v4 9/9] examples/vm_power: make branch ratio\n\tconfigurable"
    },
    "content": "For different workloads and poll loops, the theshold\nmay be different for when you want to scale up and down.\n\nThis patch allows changing of the default branch ratio\nby using the -b command line argument (or --branch-ratio=)\n\nSigned-off-by: David Hunt <david.hunt@intel.com>\nAcked-by: Radu Nicolau <radu.nicolau@intel.com>\n---\n examples/vm_power_manager/main.c            | 16 +++++++++++++++-\n examples/vm_power_manager/oob_monitor_x86.c |  3 +--\n examples/vm_power_manager/power_manager.c   |  1 +\n examples/vm_power_manager/power_manager.h   |  3 +++\n 4 files changed, 20 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c\nindex f9990f153..58c5fa45c 100644\n--- a/examples/vm_power_manager/main.c\n+++ b/examples/vm_power_manager/main.c\n@@ -141,17 +141,19 @@ parse_args(int argc, char **argv)\n \tint option_index;\n \tchar *prgname = argv[0];\n \tstruct core_info *ci;\n+\tfloat branch_ratio;\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{ \"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:\",\n+\twhile ((opt = getopt_long(argc, argvopt, \"l:p:q:T:b:\",\n \t\t\t\t  lgopts, &option_index)) != EOF) {\n \n \t\tswitch (opt) {\n@@ -184,6 +186,18 @@ parse_args(int argc, char **argv)\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 62d503ca5..589c604e5 100644\n--- a/examples/vm_power_manager/oob_monitor_x86.c\n+++ b/examples/vm_power_manager/oob_monitor_x86.c\n@@ -22,7 +22,6 @@ void branch_monitor_exit(void)\n /* Number of microseconds between each poll */\n #define INTERVAL 100\n #define PRINT_LOOP_COUNT (1000000/INTERVAL)\n-#define RATIO_THRESHOLD 0.03\n #define IA32_PERFEVTSEL0 0x186\n #define IA32_PERFEVTSEL1 0x187\n #define IA32_PERFCTR0 0xc1\n@@ -89,7 +88,7 @@ apply_policy(int core)\n \n \tratio = (float)miss_diff * (float)100 / (float)hits_diff;\n \n-\tif (ratio < RATIO_THRESHOLD)\n+\tif (ratio < ci->branch_ratio_threshold)\n \t\tpower_manager_scale_core_min(core);\n \telse\n \t\tpower_manager_scale_core_max(core);\ndiff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c\nindex 4bdde23da..b7769c3c3 100644\n--- a/examples/vm_power_manager/power_manager.c\n+++ b/examples/vm_power_manager/power_manager.c\n@@ -74,6 +74,7 @@ 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 \tif (!ci->cd) {\n \t\tRTE_LOG(ERR, POWER_MANAGER, \"Failed to allocate memory for core info.\");\ndiff --git a/examples/vm_power_manager/power_manager.h b/examples/vm_power_manager/power_manager.h\nindex 45385de37..605b3c8f6 100644\n--- a/examples/vm_power_manager/power_manager.h\n+++ b/examples/vm_power_manager/power_manager.h\n@@ -19,8 +19,11 @@ struct core_details {\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+\n struct core_info *\n get_core_info(void);\n \n",
    "prefixes": [
        "v4",
        "9/9"
    ]
}