X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvm_power_manager%2Fpower_manager.c;h=739372d9b7ea0b636c270c5be3877533e42676c6;hb=243e23bccc2ce02a6aaac77870d5db4ed0e3ec81;hp=cd51d4741f6cc07a968935d4dcaf237a2f37ee70;hpb=666272d20da3deb1fb41051b9f91a46a8363f2b0;p=dpdk.git diff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c index cd51d4741f..739372d9b7 100644 --- a/examples/vm_power_manager/power_manager.c +++ b/examples/vm_power_manager/power_manager.c @@ -59,7 +59,6 @@ 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) { @@ -68,6 +67,7 @@ core_info_init(void) } for (i = 0; i < ci->core_count; i++) { ci->cd[i].global_enabled_cpus = 1; + ci->cd[i].branch_ratio_threshold = BRANCH_RATIO_THRESHOLD; } printf("%d cores in system\n", ci->core_count); return 0; @@ -96,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, @@ -170,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 "