Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #2 from mquinson/master
[simgrid.git] / teshsuite / surf / surf_usage / surf_usage.cpp
index fe6b1d4..c05e66b 100644 (file)
@@ -9,7 +9,8 @@
 #include <stdio.h>
 #include "simgrid/sg_config.h"
 #include "surf/surf.h"
-#include "surf/surfxml_parse.h" // for reset callback
+#include "src/surf/surf_interface.hpp"
+#include "src/surf/cpu_interface.hpp"
 
 #include "xbt/log.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test,
@@ -56,18 +57,18 @@ void test(char *platform)
   hostB = sg_host_by_name("Cpu B");
 
   /* Let's check that those two processors exist */
-  XBT_DEBUG("%s : %p", surf_cpu_name(hostA->p_cpu), hostA);
-  XBT_DEBUG("%s : %p", surf_cpu_name(hostB->p_cpu), hostB);
+  XBT_DEBUG("%s : %p", sg_host_get_name(hostA), hostA);
+  XBT_DEBUG("%s : %p", sg_host_get_name(hostB), hostB);
 
   /* Let's do something on it */
-  actionA = surf_host_execute(hostA, 1000.0);
-  actionB = surf_host_execute(hostB, 1000.0);
+  actionA = hostA->pimpl_cpu->execution_start(1000.0);
+  actionB = hostB->pimpl_cpu->execution_start(1000.0);
   actionC = surf_host_sleep(hostB, 7.32);
 
   /* Use whatever calling style you want... */
-  stateActionA = surf_action_get_state(actionA);     /* When you know actionA model type */
-  stateActionB = surf_action_get_state(actionB);        /* If you're unsure about it's model type */
-  stateActionC = surf_action_get_state(actionC);     /* When you know actionA model type */
+  stateActionA = actionA->getState(); /* When you know actionA model type */
+  stateActionB = actionB->getState(); /* If you're unsure about it's model type */
+  stateActionC = actionC->getState(); /* When you know actionA model type */
 
   /* And just look at the state of these tasks */
   XBT_DEBUG("actionA : %p (%s)", actionA, string_action(stateActionA));
@@ -89,23 +90,23 @@ void test(char *platform)
     while ((action =
             surf_model_extract_failed_action_set((surf_model_t)surf_cpu_model_pm))) {
       XBT_DEBUG("\t * Failed : %p", action);
-      surf_action_unref(action);
+      action->unref();
     }
     while ((action =
             surf_model_extract_done_action_set((surf_model_t)surf_cpu_model_pm))) {
       XBT_DEBUG("\t * Done : %p", action);
-      surf_action_unref(action);
+      action->unref();
     }
     XBT_DEBUG("\t Network actions");
     while ((action =
             surf_model_extract_failed_action_set((surf_model_t)surf_network_model))) {
       XBT_DEBUG("\t * Failed : %p", action);
-      surf_action_unref(action);
+      action->unref();
     }
     while ((action =
             surf_model_extract_done_action_set((surf_model_t)surf_network_model))) {
       XBT_DEBUG("\t * Done : %p", action);
-      surf_action_unref(action);
+      action->unref();
     }
 
   } while ((surf_model_running_action_set_size((surf_model_t)surf_network_model) ||