int new_peak_index=2;
host = MSG_host_self();; //MSG_get_host_by_name("MyHost1");
- int nb = MSG_get_host_nb_pstates(host);
+ int nb = MSG_host_get_pstate_number(host);
XBT_INFO("Number of Processor states=%d", nb);
- double current_peak = MSG_get_host_current_power_peak(host);
+ double current_peak = MSG_host_get_current_power_peak(host);
XBT_INFO("Current power peak=%f", current_peak);
// Run a task
return 0;
}
- double peak_at = MSG_get_host_power_peak_at(host, new_peak_index);
+ double peak_at = MSG_host_get_power_peak_at(host, new_peak_index);
XBT_INFO("Changing power peak value to %f (at index %d)", peak_at, new_peak_index);
- MSG_set_host_power_peak_at(host, new_peak_index);
+ MSG_host_set_pstate(host, new_peak_index);
- current_peak = MSG_get_host_current_power_peak(host);
+ current_peak = MSG_host_get_current_power_peak(host);
XBT_INFO("Current power peak=%f", current_peak);
// Run a second task
// Verify the default pstate is set to 0
host = MSG_get_host_by_name("MyHost2");
- int nb2 = MSG_get_host_nb_pstates(host);
+ int nb2 = MSG_host_get_pstate_number(host);
XBT_INFO("Number of Processor states=%d", nb2);
- double current_peak2 = MSG_get_host_current_power_peak(host);
+ double current_peak2 = MSG_host_get_current_power_peak(host);
XBT_INFO("Current power peak=%f", current_peak2);
return 0;
}
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));
+ 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",
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();
MSG_task_destroy(task1);
XBT_INFO("Task done (duration: %.2f s). Current power peak=%.0E flop/s; Current consumed energy=%.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);
+ MSG_host_set_pstate(host, pstate);
XBT_INFO("========= Requesting pstate %d (power 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();
MSG_task_destroy(task1);
XBT_INFO("Task done (duration: %.2f s). Current power peak=%.0E flop/s; Current consumed energy=%.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");
MSG_process_sleep(4);
XBT_INFO("Done sleeping (duration: %.2f s). Current power peak=%.0E flop/s; Current consumed energy=%.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));
return 0;
}
double task_time = 0;
host = MSG_host_self();
- double current_peak = MSG_get_host_current_power_peak(host);
+ double current_peak = MSG_host_get_current_power_peak(host);
XBT_INFO("Current power peak=%f", current_peak);
- double consumed_energy = MSG_get_host_consumed_energy(host);
+ double consumed_energy = MSG_host_get_consumed_energy(host);
XBT_INFO("Total energy (Joules): %f", consumed_energy);
// Process 1 - long CPU task
task_time = MSG_get_clock() - task_time;
XBT_INFO("Task simulation time: %e", task_time);
- consumed_energy = MSG_get_host_consumed_energy(host);
+ consumed_energy = MSG_host_get_consumed_energy(host);
XBT_INFO("Total energy (Joules): %f", consumed_energy);
return 0;
XBT_PUBLIC(void) __MSG_host_priv_free(msg_host_priv_t priv);
XBT_PUBLIC(void) __MSG_host_destroy(msg_host_t host);
-XBT_PUBLIC(double) MSG_get_host_power_peak_at(msg_host_t h, int pstate_index);
-XBT_PUBLIC(double) MSG_get_host_current_power_peak(msg_host_t h);
-XBT_PUBLIC(int) MSG_get_host_nb_pstates(msg_host_t h);
-XBT_PUBLIC(void) MSG_set_host_power_peak_at(msg_host_t h, int pstate);
-XBT_PUBLIC(double) MSG_get_host_consumed_energy(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_pstate_number(msg_host_t h);
+XBT_PUBLIC(void) MSG_host_set_pstate(msg_host_t h, int pstate);
+XBT_PUBLIC(double) MSG_host_get_consumed_energy(msg_host_t h);
/*property handlers*/
XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host);
* \param pstate_index pstate to test
* \return Returns the processor speed associated with pstate_index
*/
-double MSG_get_host_power_peak_at(msg_host_t host, int pstate_index) {
+double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) {
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
return (simcall_host_get_power_peak_at(host, pstate_index));
}
* \param host host to test
* \return Returns the current processor speed
*/
-double MSG_get_host_current_power_peak(msg_host_t host) {
+double MSG_host_get_current_power_peak(msg_host_t host) {
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
return simcall_host_get_current_power_peak(host);
}
*
* \param host host to test
*/
-int MSG_get_host_nb_pstates(msg_host_t host) {
+int MSG_host_get_pstate_number(msg_host_t host) {
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
return (simcall_host_get_nb_pstates(host));
* \param host host to test
* \param pstate_index pstate to switch to
*/
-void MSG_set_host_power_peak_at(msg_host_t host, int pstate_index) {
+void MSG_host_set_pstate(msg_host_t host, int pstate_index) {
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
simcall_host_set_power_peak_at(host, pstate_index);
* \param host host to test
* \return Returns the consumed energy
*/
-double MSG_get_host_consumed_energy(msg_host_t host) {
+double MSG_host_get_consumed_energy(msg_host_t host) {
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
return simcall_host_get_consumed_energy(host);
}