X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a0623831eea46d64e95390771cf0cc5bef67ccb1:/examples/msg/energy-consumption/energy-consumption.c..95cd4e6e0c85be242b34630726a82bf5e8e6be17:/teshsuite/msg/energy-consumption/energy-consumption.c diff --git a/examples/msg/energy-consumption/energy-consumption.c b/teshsuite/msg/energy-consumption/energy-consumption.c similarity index 87% rename from examples/msg/energy-consumption/energy-consumption.c rename to teshsuite/msg/energy-consumption/energy-consumption.c index 87cb1d4480..662d7f66cb 100644 --- a/examples/msg/energy-consumption/energy-consumption.c +++ b/teshsuite/msg/energy-consumption/energy-consumption.c @@ -4,16 +4,16 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "simgrid/msg.h" #include "simgrid/plugins/energy.h" +#include "simgrid/msg.h" XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); -static int dvfs(int argc, char *argv[]) +static int dvfs(int argc, char* argv[]) { msg_host_t host = MSG_host_by_name("MyHost1"); - XBT_INFO("Energetic profile: %s",MSG_host_get_property_value(host,"watt_per_state")); + XBT_INFO("Energetic profile: %s", MSG_host_get_property_value(host, "watt_per_state")); XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", MSG_host_get_speed(host), sg_host_get_consumed_energy(host)); @@ -24,10 +24,10 @@ static int dvfs(int argc, char *argv[]) MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host)); // Run a task - start = MSG_get_clock(); - msg_task_t task1 = MSG_task_create ("t1", 100E6, 0, NULL); + start = MSG_get_clock(); + msg_task_t task1 = MSG_task_create("t1", 100E6, 0, NULL); XBT_INFO("Run a task of %.0E flops", MSG_task_get_flops_amount(task1)); - MSG_task_execute (task1); + MSG_task_execute(task1); MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW" " depending on load; Energy dissipated=%.0f J", @@ -35,16 +35,16 @@ static int dvfs(int argc, char *argv[]) sg_host_get_wattmax_at(host, MSG_host_get_pstate(host)), sg_host_get_consumed_energy(host)); // ========= Change power peak ========= - int pstate=2; + int pstate = 2; MSG_host_set_pstate(host, pstate); XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate, MSG_host_get_power_peak_at(host, pstate), MSG_host_get_speed(host)); // Run a second task start = MSG_get_clock(); - task1 = MSG_task_create ("t2", 100E6, 0, NULL); + task1 = MSG_task_create("t2", 100E6, 0, NULL); XBT_INFO("Run a task of %.0E flops", MSG_task_get_flops_amount(task1)); - MSG_task_execute (task1); + MSG_task_execute(task1); MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host)); @@ -57,7 +57,7 @@ static int dvfs(int argc, char *argv[]) // =========== Turn the other host off ========== XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.", - sg_host_get_consumed_energy(MSG_host_by_name("MyHost2")) ); + sg_host_get_consumed_energy(MSG_host_by_name("MyHost2"))); MSG_host_off(MSG_host_by_name("MyHost2")); start = MSG_get_clock(); MSG_process_sleep(10); @@ -66,7 +66,7 @@ static int dvfs(int argc, char *argv[]) return 0; } -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { sg_host_energy_plugin_init(); MSG_init(&argc, argv);