From 60b1ac0e15366bee22987d25df95e8b3c3429fd1 Mon Sep 17 00:00:00 2001 From: Julien Gossa Date: Fri, 4 Mar 2016 19:31:24 +0100 Subject: [PATCH] [MSG] Renaming MSG_get_host_speed in MSG_host_get_speed. No function should be ostracized because of its name. Never. Old one is deprecated with a warning. --- examples/msg/cloud/bound.c | 12 ++++++------ examples/msg/cloud/multicore.c | 6 +++--- examples/msg/properties/msg_prop.c | 2 +- include/simgrid/msg.h | 6 +++++- src/bindings/java/jmsg_host.cpp | 2 +- src/msg/msg_host.cpp | 12 +++++++++++- src/msg/msg_vm.cpp | 2 +- 7 files changed, 28 insertions(+), 14 deletions(-) diff --git a/examples/msg/cloud/bound.c b/examples/msg/cloud/bound.c index 06a059b63c..ffb7387505 100644 --- a/examples/msg/cloud/bound.c +++ b/examples/msg/cloud/bound.c @@ -96,7 +96,7 @@ static void test_dynamic_change(void) double task1_remain_prev = MSG_task_get_flops_amount(task1); { - const double cpu_speed = MSG_get_host_speed(pm0); + const double cpu_speed = MSG_host_get_speed(pm0); int i = 0; for (i = 0; i < 10; i++) { double new_bound = (cpu_speed / 10) * i; @@ -129,7 +129,7 @@ static void test_dynamic_change(void) static void test_one_task(msg_host_t hostA) { - const double cpu_speed = MSG_get_host_speed(hostA); + const double cpu_speed = MSG_host_get_speed(hostA); const double computation_amount = cpu_speed * 10; const char *hostA_name = MSG_host_get_name(hostA); @@ -174,8 +174,8 @@ static void test_one_task(msg_host_t hostA) static void test_two_tasks(msg_host_t hostA, msg_host_t hostB) { - const double cpu_speed = MSG_get_host_speed(hostA); - xbt_assert(cpu_speed == MSG_get_host_speed(hostB)); + const double cpu_speed = MSG_host_get_speed(hostA); + xbt_assert(cpu_speed == MSG_host_get_speed(hostB)); const double computation_amount = cpu_speed * 10; const char *hostA_name = MSG_host_get_name(hostA); const char *hostB_name = MSG_host_get_name(hostB); @@ -288,7 +288,7 @@ static int master_main(int argc, char *argv[]) { msg_host_t vm0 = MSG_vm_create_core(pm0, "VM0"); - const double cpu_speed = MSG_get_host_speed(pm0); + const double cpu_speed = MSG_host_get_speed(pm0); MSG_vm_set_bound(vm0, cpu_speed / 10); MSG_vm_start(vm0); @@ -317,7 +317,7 @@ static int master_main(int argc, char *argv[]) MSG_host_set_params(vm0, ¶ms); MSG_vm_start(vm0); - const double cpu_speed = MSG_get_host_speed(pm0); + const double cpu_speed = MSG_host_get_speed(pm0); MSG_vm_start(vm0); XBT_INFO("# 10. Test migration"); diff --git a/examples/msg/cloud/multicore.c b/examples/msg/cloud/multicore.c index 32229cf1f5..c8ad9f60fc 100644 --- a/examples/msg/cloud/multicore.c +++ b/examples/msg/cloud/multicore.c @@ -335,11 +335,11 @@ int main(int argc, char *argv[]) msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t); XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm0), MSG_host_get_core_number(pm0), - MSG_get_host_speed(pm0)); + MSG_host_get_speed(pm0)); XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm1), MSG_host_get_core_number(pm1), - MSG_get_host_speed(pm1)); + MSG_host_get_speed(pm1)); XBT_INFO("%s: %d core(s), %f flops/s per each", MSG_host_get_name(pm2), MSG_host_get_core_number(pm2), - MSG_get_host_speed(pm2)); + MSG_host_get_speed(pm2)); MSG_process_create("master", master_main, NULL, pm0); diff --git a/examples/msg/properties/msg_prop.c b/examples/msg/properties/msg_prop.c index 8e057056a3..caae47f822 100644 --- a/examples/msg/properties/msg_prop.c +++ b/examples/msg/properties/msg_prop.c @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) hosts = MSG_hosts_as_dynar(); xbt_dynar_foreach(hosts, i, host){ - XBT_INFO("Host '%s' runs at %.0f flops/s",MSG_host_get_name(host), MSG_get_host_speed(host)); + XBT_INFO("Host '%s' runs at %.0f flops/s",MSG_host_get_name(host), MSG_host_get_speed(host)); } MSG_launch_application(argv[2]); diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index c1a2cf3bf9..562f659456 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -284,12 +284,16 @@ XBT_PUBLIC(void *) MSG_host_get_data(msg_host_t host); XBT_PUBLIC(void) MSG_host_on(msg_host_t host); XBT_PUBLIC(void) MSG_host_off(msg_host_t host); XBT_PUBLIC(msg_host_t) MSG_host_self(void); -XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h); +XBT_PUBLIC(double) MSG_host_get_speed(msg_host_t h); XBT_PUBLIC(int) MSG_host_get_core_number(msg_host_t h); XBT_PUBLIC(xbt_swag_t) MSG_host_get_process_list(msg_host_t h); XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h); XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h); +// deprecated +XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h); + + XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate); XBT_PUBLIC(double) MSG_host_get_current_power_peak(msg_host_t h); XBT_PUBLIC(int) MSG_host_get_nb_pstates(msg_host_t h); diff --git a/src/bindings/java/jmsg_host.cpp b/src/bindings/java/jmsg_host.cpp index dba26b2996..98e5094a97 100644 --- a/src/bindings/java/jmsg_host.cpp +++ b/src/bindings/java/jmsg_host.cpp @@ -186,7 +186,7 @@ Java_org_simgrid_msg_Host_getSpeed(JNIEnv * env, return -1; } - return (jdouble) MSG_get_host_speed(host); + return (jdouble) MSG_host_get_speed(host); } JNIEXPORT jdouble JNICALL diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index feb4f97f62..c5e8a474e1 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -146,10 +146,20 @@ xbt_dynar_t MSG_hosts_as_dynar(void) { /** \ingroup m_host_management * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine. */ -double MSG_get_host_speed(msg_host_t host) { +double MSG_host_get_speed(msg_host_t host) { return host->speed(); } +/** \ingroup m_host_management + * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine. + * Deprecated: use MSG_host_get_speed + */ +double MSG_get_host_speed(msg_host_t host) { + XBT_WARN("MSG_get_host_speed is deprecated: use MSG_host_get_speed"); + return MSG_host_get_speed(host); +} + + /** \ingroup m_host_management * \brief Return the number of cores. * diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index dd1747e9e7..2e11d8985e 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -180,7 +180,7 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char *name, { /* For the moment, intensity_rate is the percentage against the migration * bandwidth */ - double host_speed = MSG_get_host_speed(pm); + double host_speed = MSG_host_get_speed(pm); double update_speed = ((double)dp_intensity/100) * mig_netspeed; msg_vm_t vm = MSG_vm_create_core(pm, name); -- 2.20.1