X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3e8e23939587e7ec646fba0cd59f23400507f255..c7a0ad9ac245dbab9317cb06ebf028118bc0c687:/examples/msg/energy/e2/e2.c diff --git a/examples/msg/energy/e2/e2.c b/examples/msg/energy/e2/e2.c index ee19dd82d0..dbfe96f729 100644 --- a/examples/msg/energy/e2/e2.c +++ b/examples/msg/energy/e2/e2.c @@ -29,15 +29,15 @@ int dvfs(int argc, char *argv[]) XBT_INFO("Energetic profile: %s", MSG_host_get_property_value(host,"watt_per_state")); - XBT_INFO("Initial power peak=%.0E flop/s; Consumed energy (Joules)=%.0E J", - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); double start = MSG_get_clock(); XBT_INFO("Sleep for 10 seconds"); MSG_process_sleep(10); - XBT_INFO("Done sleeping (duration: %.2f s). Current power peak=%.0E; Current consumed energy=%.2f J", + XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J", MSG_get_clock()-start, - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); // Run a task start = MSG_get_clock(); @@ -45,17 +45,17 @@ int dvfs(int argc, char *argv[]) task1 = MSG_task_create ("t1", 100E6, 0, NULL); MSG_task_execute (task1); MSG_task_destroy(task1); - XBT_INFO("Task done (duration: %.2f s). Current power peak=%.0E flop/s; Current consumed energy=%.0f J", + XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_get_clock()-start, - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); // ========= Change power peak ========= int pstate=2; - MSG_set_host_power_peak_at(host, pstate); - XBT_INFO("========= Requesting pstate %d (power should be of %.2f flop/s and is of %.2f flop/s", + MSG_host_set_pstate(host, pstate); + XBT_INFO("========= Requesting pstate %d (speed should be of %.2f flop/s and is of %.2f flop/s)", pstate, - MSG_get_host_power_peak_at(host, pstate), - MSG_get_host_current_power_peak(host)); + MSG_host_get_power_peak_at(host, pstate), + MSG_host_get_current_power_peak(host)); // Run a second task start = MSG_get_clock(); @@ -63,17 +63,26 @@ int dvfs(int argc, char *argv[]) task1 = MSG_task_create ("t2", 100E6, 0, NULL); MSG_task_execute (task1); MSG_task_destroy(task1); - XBT_INFO("Task done (duration: %.2f s). Current power peak=%.0E flop/s; Current consumed energy=%.0f J", + XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_get_clock()-start, - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); start = MSG_get_clock(); - XBT_INFO("Sleep for 10 seconds"); + XBT_INFO("Sleep for 4 seconds"); MSG_process_sleep(4); - XBT_INFO("Done sleeping (duration: %.2f s). Current power peak=%.0E flop/s; Current consumed energy=%.0f J", + XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_get_clock()-start, - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); + // =========== Turn the other host off ========== + XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.", + MSG_host_get_consumed_energy(MSG_get_host_by_name("MyHost2")) ); + MSG_host_off(MSG_get_host_by_name("MyHost2")); + start = MSG_get_clock(); + MSG_process_sleep(10); + XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", + MSG_get_clock()-start, + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); return 0; }