X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=inline;f=examples%2Fvm_power_manager%2Fpower_manager.c;h=739372d9b7ea0b636c270c5be3877533e42676c6;hb=a1978aa23bf4a8dd34087173f7769250d050315e;hp=9d4e587b0f99369fe5710ded2135753f607e93fa;hpb=3f1fc5f2cbc57ed719f9a1b24c8e450c5a95e8db;p=dpdk.git diff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c index 9d4e587b0f..739372d9b7 100644 --- a/examples/vm_power_manager/power_manager.c +++ b/examples/vm_power_manager/power_manager.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -60,16 +59,15 @@ core_info_init(void) ci = get_core_info(); ci->core_count = get_nprocs_conf(); - ci->branch_ratio_threshold = BRANCH_RATIO_THRESHOLD; ci->cd = malloc(ci->core_count * sizeof(struct core_details)); + memset(ci->cd, 0, ci->core_count * sizeof(struct core_details)); if (!ci->cd) { RTE_LOG(ERR, POWER_MANAGER, "Failed to allocate memory for core info."); return -1; } for (i = 0; i < ci->core_count; i++) { ci->cd[i].global_enabled_cpus = 1; - ci->cd[i].oob_enabled = 0; - ci->cd[i].msr_fd = 0; + ci->cd[i].branch_ratio_threshold = BRANCH_RATIO_THRESHOLD; } printf("%d cores in system\n", ci->core_count); return 0; @@ -98,6 +96,9 @@ power_manager_init(void) max_core_num = ci->core_count; for (i = 0; i < max_core_num; i++) { + if (rte_lcore_index(i) == -1) + continue; + if (ci->cd[i].global_enabled_cpus) { if (rte_power_init(i) < 0) RTE_LOG(ERR, POWER_MANAGER, @@ -172,6 +173,9 @@ power_manager_exit(void) max_core_num = ci->core_count; for (i = 0; i < max_core_num; i++) { + if (rte_lcore_index(i) == -1) + continue; + if (ci->cd[i].global_enabled_cpus) { if (rte_power_exit(i) < 0) { RTE_LOG(ERR, POWER_MANAGER, "Unable to shutdown power manager "