X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7a8cd62135619ad52e05ae1c929ef07e166e4260..9c6d72b5bbc9f9b0f9d61c8964fabacaaa2a9914:/src/simix/smx_host.c diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 114e14b6c2..69f45257e6 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -34,8 +34,8 @@ smx_host_t SIMIX_host_create(const char *name, /* Update global variables */ xbt_lib_set(host_lib,name,SIMIX_HOST_LEVEL,smx_host); - - return xbt_lib_get_elm_or_null(host_lib, name); + + return xbt_lib_get_or_null(host_lib, name, SIMIX_HOST_LEVEL); } /** @@ -51,8 +51,7 @@ void SIMIX_host_destroy(void *h) /* Clean Simulator data */ if (xbt_swag_size(host->process_list) != 0) { - char *msg = - bprintf("Shutting down host, but it's not empty:"); + char *msg = xbt_strdup("Shutting down host, but it's not empty:"); char *tmp; smx_process_t process = NULL; @@ -149,6 +148,28 @@ double SIMIX_host_get_speed(smx_host_t host){ get_speed(host, 1.0); } +int SIMIX_pre_host_get_core(smx_simcall_t simcall, smx_host_t host){ + return SIMIX_host_get_core(host); +} +int SIMIX_host_get_core(smx_host_t host){ + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); + + return surf_workstation_model->extension.workstation. + get_core(host); +} + +xbt_swag_t SIMIX_pre_host_get_process_list(smx_simcall_t simcall, smx_host_t host){ + return SIMIX_host_get_process_list(host); +} + +xbt_swag_t SIMIX_host_get_process_list(smx_host_t host){ + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); + smx_host_priv_t host_priv = SIMIX_host_priv(host); + + return host_priv->process_list; +} + + double SIMIX_pre_host_get_available_speed(smx_simcall_t simcall, smx_host_t host){ return SIMIX_host_get_available_speed(host); } @@ -159,6 +180,55 @@ double SIMIX_host_get_available_speed(smx_host_t host){ get_available_speed(host); } +double SIMIX_pre_host_get_current_power_peak(smx_simcall_t simcall, smx_host_t host){ + return SIMIX_host_get_current_power_peak(host); +} +double SIMIX_host_get_current_power_peak(smx_host_t host) { + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); + return surf_workstation_model->extension.workstation. + get_current_power_peak(host); +} + +double SIMIX_pre_host_get_power_peak_at(smx_simcall_t simcall, smx_host_t host, int pstate_index){ + return SIMIX_host_get_power_peak_at(host, pstate_index); +} +double SIMIX_host_get_power_peak_at(smx_host_t host, int pstate_index) { + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); + + return surf_workstation_model->extension.workstation. + get_power_peak_at(host, pstate_index); +} + +int SIMIX_pre_host_get_nb_pstates(smx_simcall_t simcall, smx_host_t host){ + return SIMIX_host_get_nb_pstates(host); +} +int SIMIX_host_get_nb_pstates(smx_host_t host) { + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); + + return surf_workstation_model->extension.workstation. + get_nb_pstates(host); +} + + +void SIMIX_pre_host_set_power_peak_at(smx_simcall_t simcall, smx_host_t host, int pstate_index){ + SIMIX_host_set_power_peak_at(host, pstate_index); +} +void SIMIX_host_set_power_peak_at(smx_host_t host, int pstate_index) { + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); + + surf_workstation_model->extension.workstation. + set_power_peak_at(host, pstate_index); +} + +double SIMIX_pre_host_get_consumed_energy(smx_simcall_t simcall, smx_host_t host){ + return SIMIX_host_get_consumed_energy(host); +} +double SIMIX_host_get_consumed_energy(smx_host_t host) { + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); + return surf_workstation_model->extension.workstation. + get_consumed_energy(host); +} + int SIMIX_pre_host_get_state(smx_simcall_t simcall, smx_host_t host){ return SIMIX_host_get_state(host); } @@ -241,7 +311,7 @@ void SIMIX_host_add_auto_restart_process(smx_host_t host, if( SIMIX_host_get_state(host) == SURF_RESOURCE_OFF && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_name(host))){ xbt_dict_set(watched_hosts_lib,sg_host_name(host),host,NULL); - XBT_DEBUG("Have push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_name(host)); + XBT_DEBUG("Have pushed host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_name(host)); } xbt_dynar_push_as(SIMIX_host_priv(host)->auto_restart_processes,smx_process_arg_t,arg); } @@ -252,7 +322,10 @@ void SIMIX_host_restart_processes(smx_host_t host) { unsigned int cpt; smx_process_arg_t arg; - xbt_dynar_foreach(SIMIX_host_priv(host)->auto_restart_processes,cpt,arg) { + xbt_dynar_t process_list = SIMIX_host_priv(host)->auto_restart_processes; + if(!process_list) return; + + xbt_dynar_foreach(process_list,cpt,arg) { smx_process_t process; @@ -283,7 +356,7 @@ void SIMIX_host_restart_processes(smx_host_t host) } } - xbt_dynar_reset(SIMIX_host_priv(host)->auto_restart_processes); + xbt_dynar_reset(process_list); } void SIMIX_host_autorestart(smx_host_t host) @@ -553,3 +626,11 @@ void SIMIX_set_category(smx_action_t action, const char *category) } #endif +xbt_dynar_t SIMIX_pre_host_get_storage_list(smx_simcall_t simcall, smx_host_t host){ + return SIMIX_host_get_storage_list(host); +} +xbt_dynar_t SIMIX_host_get_storage_list(smx_host_t host){ + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); + + return surf_workstation_model->extension.workstation.get_storage_list(host); +}