Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill some dead code
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 20 Mar 2016 00:01:04 +0000 (01:01 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 20 Mar 2016 00:01:28 +0000 (01:01 +0100)
include/simgrid/host.h
src/include/surf/surf.h
src/msg/msg_host.cpp
src/simdag/sd_task.cpp
src/simgrid/host.cpp
src/simix/smx_host.cpp
src/surf/surf_c_bindings.cpp
teshsuite/simdag/flatifier/flatifier.cpp

index 2555b46..70bbcca 100644 (file)
@@ -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);
index aaa3015..9b0bd39 100644 (file)
@@ -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);
 
index c5e8a47..63e06ce 100644 (file)
@@ -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
index 3768b22..f15f7bc 100644 (file)
@@ -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++) {
index 7963b08..455dfdd 100644 (file)
@@ -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);
 
index 91cb6c8..3ec8f17 100644 (file)
@@ -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);
 }
index 2dbe05f..e536732 100644 (file)
@@ -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);
 }
index e4e48f5..730e2aa 100644 (file)
@@ -98,8 +98,8 @@ int main(int argc, char **argv)
     for (i = 0; i < totalHosts; i++) {
       printf("  <host id=\"%s\" speed=\"%.0f\"", sg_host_get_name(hosts[i]), sg_host_speed(hosts[i]));
       props = sg_host_get_properties(hosts[i]);
-      if (sg_host_core_count(hosts[i])>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");