From: Martin Quinson Date: Sun, 20 Mar 2016 00:01:04 +0000 (+0100) Subject: kill some dead code X-Git-Tag: v3_13~363 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d7fe4acd47d3cb1db46b1400d032dc4475d067b3?hp=2b3f46a61a583459ab18cc10de139010173de685 kill some dead code --- diff --git a/include/simgrid/host.h b/include/simgrid/host.h index 2555b46c09..70bbccaea6 100644 --- a/include/simgrid/host.h +++ b/include/simgrid/host.h @@ -52,8 +52,6 @@ XBT_PUBLIC(xbt_dynar_t) sg_host_get_attached_storage_list(sg_host_t host); // =========== user-level functions =============== XBT_PUBLIC(double) sg_host_speed(sg_host_t host); XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host); -XBT_PUBLIC(int) sg_host_core_count(sg_host_t host); -XBT_PUBLIC(int) sg_host_is_on(sg_host_t host); XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host); XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host); diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index aaa3015c98..9b0bd39211 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -223,17 +223,6 @@ XBT_PUBLIC(void) surf_vm_model_create(const char *name, sg_host_t host_PM); */ XBT_PUBLIC(surf_action_t) surf_network_model_communicate(surf_network_model_t model, sg_host_t src, sg_host_t dst, double size, double rate); -/** - * @brief Get the name of a surf resource (cpu, host, network, …) - * - * @param resource The surf resource - * @return The name of the surf resource - */ -XBT_PUBLIC(const char * ) surf_resource_name(surf_cpp_resource_t resource); - -/** @brief Get the available speed of cpu associated to a host */ -XBT_PUBLIC(double) surf_host_get_available_speed(sg_host_t host); - /** @brief Create a sleep action on the given host */ XBT_PUBLIC(surf_action_t) surf_host_sleep(sg_host_t host, double duration); diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index c5e8a474e1..63e06ce49c 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -228,8 +228,7 @@ void MSG_host_set_property_value(msg_host_t host, const char *name, char *value, */ int MSG_host_is_on(msg_host_t host) { - xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); - return sg_host_is_on(host); + return host->isOn(); } /** @ingroup m_host_management @@ -239,8 +238,7 @@ int MSG_host_is_on(msg_host_t host) */ int MSG_host_is_off(msg_host_t host) { - xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); - return !(sg_host_is_on(host)); + return host->isOff(); } /** \ingroup m_host_management diff --git a/src/simdag/sd_task.cpp b/src/simdag/sd_task.cpp index 3768b223d5..f15f7bc91d 100644 --- a/src/simdag/sd_task.cpp +++ b/src/simdag/sd_task.cpp @@ -839,7 +839,7 @@ double SD_task_get_execution_time(SD_task_t task, int workstation_nb, const sg_h for (int i = 0; i < workstation_nb; i++) { double time = 0.0; if (flops_amount != NULL) - time = flops_amount[i] / sg_host_speed(workstation_list[i]); + time = flops_amount[i] / workstation_list[i]->speed(); if (bytes_amount != NULL) for (int j = 0; j < workstation_nb; j++) { diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp index 7963b087f0..455dfdda51 100644 --- a/src/simgrid/host.cpp +++ b/src/simgrid/host.cpp @@ -120,28 +120,15 @@ xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host){ // =========== user-level functions =============== // ================================================ - -/** @brief Returns the total speed of a host - */ +/** @brief Returns the total speed of a host */ double sg_host_speed(sg_host_t host) { return host->speed(); } -double sg_host_get_available_speed(sg_host_t host){ - return surf_host_get_available_speed(host); -} -/** @brief Returns the number of cores of a host -*/ -int sg_host_core_count(sg_host_t host) { - return host->core_count(); -} - -/** @brief Returns the state of a host. - * @return 1 if the host is active or 0 if it has crashed. - */ -int sg_host_is_on(sg_host_t host) { - return host->isOn(); +double sg_host_get_available_speed(sg_host_t host) +{ + return host->pimpl_cpu->getAvailableSpeed(); } /** @brief Returns the number of power states for a host. @@ -192,7 +179,7 @@ void sg_host_dump(sg_host_t host) char *key,*data; XBT_INFO("Displaying host %s", sg_host_get_name(host)); - XBT_INFO(" - speed: %.0f", sg_host_speed(host)); + XBT_INFO(" - speed: %.0f", host->speed()); XBT_INFO(" - available speed: %.2f", sg_host_get_available_speed(host)); props = sg_host_get_properties(host); diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 91cb6c8649..3ec8f1707a 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -199,19 +199,16 @@ void SIMIX_host_add_auto_restart_process(sg_host_t host, arg->argv = xbt_new(char*,argc + 1); - int i; - for (i = 0; i < argc; i++) { + for (int i = 0; i < argc; i++) arg->argv[i] = xbt_strdup(argv[i]); - } arg->argv[argc] = NULL; arg->properties = properties; arg->auto_restart = auto_restart; - if( ! sg_host_is_on(host) - && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_get_name(host))){ + if( host->isOff() && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_get_name(host))){ xbt_dict_set(watched_hosts_lib,sg_host_get_name(host),host,NULL); - XBT_DEBUG("Have pushed host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_get_name(host)); + XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_get_name(host)); } xbt_dynar_push_as(sg_host_simix(host)->auto_restart_processes,smx_process_arg_t,arg); } diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 2dbe05f5fb..e536732d2d 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -162,7 +162,7 @@ double surf_solve(double max_date) surf_action_t surf_model_extract_done_action_set(surf_model_t model){ if (model->getDoneActionSet()->empty()) - return NULL; + return NULL; surf_action_t res = &model->getDoneActionSet()->front(); model->getDoneActionSet()->pop_front(); return res; @@ -170,7 +170,7 @@ surf_action_t surf_model_extract_done_action_set(surf_model_t model){ surf_action_t surf_model_extract_failed_action_set(surf_model_t model){ if (model->getFailedActionSet()->empty()) - return NULL; + return NULL; surf_action_t res = &model->getFailedActionSet()->front(); model->getFailedActionSet()->pop_front(); return res; @@ -188,19 +188,10 @@ surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_host return model->communicate(src->pimpl_netcard, dst->pimpl_netcard, size, rate); } -const char *surf_resource_name(surf_cpp_resource_t resource){ - return resource->getName(); -} - surf_action_t surf_host_sleep(sg_host_t host, double duration){ return host->pimpl_cpu->sleep(duration); } - -double surf_host_get_available_speed(sg_host_t host){ - return host->pimpl_cpu->getAvailableSpeed(); -} - surf_action_t surf_host_open(sg_host_t host, const char* fullpath){ return get_casted_host(host)->open(fullpath); } diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index e4e48f578c..730e2aae37 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -98,8 +98,8 @@ int main(int argc, char **argv) for (i = 0; i < totalHosts; i++) { printf(" 1) { - printf(" core=\"%d\"", sg_host_core_count(hosts[i])); + if (hosts[i]->core_count()>1) { + printf(" core=\"%d\"", hosts[i]->core_count()); } if (props && !xbt_dict_is_empty(props)) { printf(">\n");