Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr/gitroot/simgrid/simgrid
authorkbaati <kbaati@realopt-Latitude-E6530>
Fri, 24 Jul 2015 12:59:00 +0000 (14:59 +0200)
committerkbaati <kbaati@realopt-Latitude-E6530>
Fri, 24 Jul 2015 12:59:00 +0000 (14:59 +0200)
update PerSimGrid in contrib/

233 files changed:
.cproject
.gitignore
ChangeLog
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/Flags.cmake
buildtools/Cmake/MakeLib.cmake
buildtools/Cmake/Modules/FindGTnets.cmake
buildtools/Cmake/Modules/FindNS3.cmake
buildtools/Cmake/Option.cmake
buildtools/Cmake/PrintArgs.cmake
doc/doxygen/pls.doc
examples/java/reservationSurfPlugin/ReservationPlugin.java
examples/java/surfCpuModel/CpuConstantModel.java
examples/java/surfCpuModel/TestCpuModel.java
examples/java/surfCpuModel/surf_cpu_model.tesh
examples/java/surfPlugin/TracePlugin.java
examples/java/surfPlugin/surf_plugin.tesh
examples/msg/cloud/bound.c
examples/msg/cloud/master_worker_vm.c
examples/msg/cloud/migrate_vm.c
examples/msg/cloud/multicore.c
examples/msg/cloud/simple_vm.c
examples/msg/energy/consumption/energy_consumption.c
examples/msg/energy/onoff/onoff.c
examples/msg/energy/pstate/pstate.c
examples/msg/io/remote.c
examples/msg/masterslave/masterslave_bypass.c
examples/msg/masterslave/masterslave_cluster.c
examples/msg/masterslave/masterslave_failure.c
examples/msg/masterslave/masterslave_failure_platfgen.c
examples/msg/masterslave/masterslave_forwarder.c
examples/msg/masterslave/masterslave_kill.c
examples/msg/masterslave/masterslave_platfgen.c
examples/msg/migration/migration.c
examples/msg/ns3/ns3.tesh
examples/msg/parallel_task/parallel_task.tesh
examples/msg/parallel_task/test_ptask.c
examples/msg/properties/msg_prop.c
examples/msg/sendrecv/sendrecv.c
examples/msg/tracing/procmig.c
examples/simdag/dax/simple_dax_with_cycle.tesh
examples/simdag/dax/smalldax.tesh
examples/simdag/dot/test_simdag_dotload.tesh
examples/simdag/properties/test_prop.tesh
examples/simdag/scheduling/test_minmin.tesh
examples/simdag/test_simdag.tesh
examples/simdag/test_simdag2.tesh
examples/simdag/test_simdag_avail.tesh
examples/simdag/test_simdag_comm_throttling.tesh
examples/simdag/test_simdag_fail.tesh
examples/simdag/test_simdag_seq_access.tesh
examples/simdag/test_simdag_tracing.tesh
examples/simdag/test_simdag_typed_tasks.tesh
include/simgrid/datatypes.h
include/simgrid/host.h [new file with mode: 0644]
include/simgrid/link.h [new file with mode: 0644]
include/simgrid/modelchecker.h
include/simgrid/msg.h
include/simgrid/platf.h
include/simgrid/simdag.h
include/simgrid/simix.h
include/surf/surf_routing.h
include/xbt/automaton.hpp [new file with mode: 0644]
include/xbt/misc.h
src/bindings/java/jmsg_host.c
src/bindings/java/jmsg_process.c
src/bindings/java/org/simgrid/surf/CpuModel.java
src/bindings/java/org/simgrid/surf/Link.java [moved from src/bindings/java/org/simgrid/surf/NetworkLink.java with 61% similarity]
src/bindings/java/org/simgrid/surf/Model.java
src/bindings/java/org/simgrid/surf/NetworkAction.java
src/bindings/java/org/simgrid/surf/Plugin.java
src/bindings/java/org/simgrid/surf/Surf.java
src/bindings/java/org/simgrid/surf/SurfJNI.java
src/bindings/java/org/simgrid/surf/surfJAVA_wrap.cxx
src/bindings/java/org/simgrid/surf/surfJAVA_wrap.h
src/bindings/java/surf.i
src/bindings/java/surf_swig.cpp
src/bindings/java/surf_swig.hpp
src/bindings/java/surfdoc.i
src/bindings/lua/lua_host.c
src/bindings/lua/lua_platf.c
src/include/surf/surf.h
src/instr/instr_paje_containers.c
src/mc/mc_client_api.cpp
src/mc/mc_global.cpp
src/mc/mc_server.cpp
src/msg/msg_environment.c
src/msg/msg_global.c
src/msg/msg_gos.c
src/msg/msg_host.c
src/msg/msg_io.c
src/msg/msg_private.h
src/msg/msg_process.c
src/msg/msg_task.c
src/msg/msg_vm.c
src/simdag/private.h
src/simdag/sd_global.c
src/simdag/sd_link.c
src/simdag/sd_task.c
src/simdag/sd_workstation.c
src/simgrid/host.cpp [new file with mode: 0644]
src/simgrid/sg_config.c
src/simix/libsmx.c
src/simix/popping_accessors.h
src/simix/popping_bodies.c
src/simix/popping_enum.h
src/simix/popping_generated.c
src/simix/simcalls.in
src/simix/smx_deployment.c
src/simix/smx_environment.c
src/simix/smx_global.c
src/simix/smx_host.c
src/simix/smx_host_private.h
src/simix/smx_io.c
src/simix/smx_io_private.h
src/simix/smx_network.c
src/simix/smx_network_private.h
src/simix/smx_private.h
src/simix/smx_process.c
src/simix/smx_process_private.h
src/simix/smx_synchro.c
src/simix/smx_vm.c
src/smpi/smpi_bench.c
src/surf/cpu_cas01.cpp
src/surf/cpu_cas01.hpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/gtnets/gtnets_simulator.cc
src/surf/host_clm03.cpp
src/surf/host_clm03.hpp
src/surf/host_interface.cpp
src/surf/host_interface.hpp
src/surf/host_ptask_L07.cpp
src/surf/host_ptask_L07.hpp
src/surf/maxmin.cpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/network_gtnets.cpp
src/surf/network_gtnets.hpp
src/surf/network_ib.cpp
src/surf/network_ib.hpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/network_smpi.cpp
src/surf/network_smpi.hpp
src/surf/ns3/my-point-to-point-helper.cc
src/surf/ns3/ns3_interface.cc
src/surf/ns3/ns3_simulator.cc
src/surf/ns3/ns3_simulator.h
src/surf/ns3/red-queue.cc
src/surf/plugins/energy.cpp
src/surf/plugins/energy.hpp
src/surf/storage_interface.cpp
src/surf/storage_interface.hpp
src/surf/storage_n11.cpp
src/surf/storage_n11.hpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
src/surf/surf_routing.cpp
src/surf/surf_routing.hpp
src/surf/surf_routing_cluster.cpp
src/surf/surf_routing_cluster.hpp
src/surf/surf_routing_cluster_fat_tree.cpp
src/surf/surf_routing_cluster_fat_tree.hpp
src/surf/surf_routing_cluster_torus.cpp
src/surf/surf_routing_cluster_torus.hpp
src/surf/surf_routing_dijkstra.cpp
src/surf/surf_routing_dijkstra.hpp
src/surf/surf_routing_floyd.cpp
src/surf/surf_routing_floyd.hpp
src/surf/surf_routing_full.cpp
src/surf/surf_routing_full.hpp
src/surf/surf_routing_generic.cpp
src/surf/surf_routing_generic.hpp
src/surf/surf_routing_none.cpp
src/surf/surf_routing_none.hpp
src/surf/surf_routing_private.hpp
src/surf/surf_routing_vivaldi.cpp
src/surf/surf_routing_vivaldi.hpp
src/surf/surfxml_parse.c
src/surf/vm_hl13.cpp
src/surf/vm_hl13.hpp
src/surf/vm_interface.cpp
src/surf/vm_interface.hpp
src/xbt/lib.c
src/xbt/log.c
src/xbt/xbt_sg_synchro.c
teshsuite/msg/host_on_off/host_on_off.c
teshsuite/msg/host_on_off/host_on_off_recv.c
teshsuite/msg/host_on_off/host_on_off_wait.c
teshsuite/msg/host_on_off_processes/host_on_off_processes.c
teshsuite/msg/storage/concurrent_rw.c
teshsuite/simdag/availability/availability_test.tesh
teshsuite/simdag/basic/basic0.tesh
teshsuite/simdag/basic/basic1.tesh
teshsuite/simdag/basic/basic2.tesh
teshsuite/simdag/basic/basic3.tesh
teshsuite/simdag/basic/basic4.tesh
teshsuite/simdag/basic/basic5.tesh
teshsuite/simdag/basic/basic6.tesh
teshsuite/simdag/incomplete/incomplete.tesh
teshsuite/simdag/network/mxn/test_intra_all2all.tesh
teshsuite/simdag/network/mxn/test_intra_independent_comm.tesh
teshsuite/simdag/network/mxn/test_intra_scatter.tesh
teshsuite/simdag/network/p2p/test_latency1.tesh
teshsuite/simdag/network/p2p/test_latency2.tesh
teshsuite/simdag/network/p2p/test_latency3.tesh
teshsuite/simdag/network/p2p/test_latency_bound.tesh
teshsuite/simdag/network/test_reinit_costs.tesh
teshsuite/simdag/partask/test_comp_only_par.tesh
teshsuite/simdag/partask/test_comp_only_seq.tesh
teshsuite/simdag/platforms/basic_link_test.c
teshsuite/simdag/platforms/basic_link_test.tesh
teshsuite/simdag/platforms/basic_parsing_test.tesh
teshsuite/simdag/platforms/basic_parsing_test_bypass.tesh
teshsuite/simdag/platforms/basic_parsing_test_sym_full.tesh
teshsuite/simdag/platforms/bogus_disk_attachment.tesh
teshsuite/simdag/platforms/bogus_missing_gateway.tesh
teshsuite/simdag/platforms/bogus_two_hosts_asymetric.tesh
teshsuite/simdag/platforms/flatifier.c
teshsuite/simdag/platforms/flatifier.tesh
teshsuite/simdag/platforms/get_full_link.tesh
teshsuite/surf/surf_usage/surf_usage.c
teshsuite/surf/surf_usage/surf_usage2.c

index 11b5c6e..65f4132 100644 (file)
--- a/.cproject
+++ b/.cproject
@@ -5,12 +5,12 @@
                        <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.1011977604" moduleId="org.eclipse.cdt.core.settings" name="Default">
                                <externalSettings/>
                                <extensions>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
                                        <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
                                        <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
                                        <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
                                        <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
                                        <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
                                </extensions>
                        </storageModule>
                        <storageModule moduleId="cdtBuildSystem" version="4.0.0">
                                                        <builder id="cdt.managedbuild.target.gnu.builder.base.1747533038" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
                                                        <tool id="cdt.managedbuild.tool.gnu.archiver.base.374652938" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
                                                        <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.738159103" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
-                                                               <option id="gnu.cpp.compiler.option.include.paths.216814103" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+                                                               <option id="gnu.cpp.compiler.option.include.paths.216814103" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="/usr/lib/jvm/java-7-openjdk-amd64/include"/>
+                                                                       <listOptionValue builtIn="false" value="/usr/include/ns3.22"/>
+                                                                       <listOptionValue builtIn="false" value="/opt/gtnets/include"/>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1641160853" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
                                                        </tool>
                                                        <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1053916774" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
-                                                               <option id="gnu.c.compiler.option.include.paths.100642505" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+                                                               <option id="gnu.c.compiler.option.include.paths.100642505" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="/usr/lib/jvm/java-7-openjdk-amd64/include"/>
+                                                                       <listOptionValue builtIn="false" value="/usr/include/ns3.22"/>
+                                                                       <listOptionValue builtIn="false" value="/opt/gtnets/include"/>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.538328935" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
                                                        </tool>
                                                                </inputType>
                                                        </tool>
                                                        <tool id="cdt.managedbuild.tool.gnu.assembler.base.1593279917" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
-                                                               <option id="gnu.both.asm.option.include.paths.2076655261" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
+                                                               <option id="gnu.both.asm.option.include.paths.2076655261" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="/usr/lib/jvm/java-7-openjdk-amd64/include"/>
+                                                                       <listOptionValue builtIn="false" value="/usr/include/ns3.22"/>
+                                                                       <listOptionValue builtIn="false" value="/opt/gtnets/include"/>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2071407067" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
                                                        </tool>
index 367a41b..91a4a13 100644 (file)
@@ -180,6 +180,7 @@ examples/msg/icomms/toto.txt
 examples/msg/masterslave/masterslave_console
 examples/msg/irc_isend/peer
 examples/msg/irc_isend/toto.txt
+examples/msg/ns3/ns3
 examples/simdag/sd_avail
 examples/simdag/ex_sd_seq_access
 examples/simdag/sd_seq_access
index fced57f..c4ab1f6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+New function: simcall_process_get_kill_time()
+
+ surf.java:
+ * class NetworkLink renamed to Link
+
 SimGrid (3.12) NOT RELEASED; urgency=low
 
  cMSG:
index 25c59bb..5bee0ca 100644 (file)
@@ -301,6 +301,7 @@ IF(NOT enable_memcheck)
   ADD_TESH(tesh-simdag-flatifier                 --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms flatifier.tesh)
   ADD_TESH(tesh-simdag-link                      --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms basic_link_test.tesh)
   ADD_TESH(tesh-simdag-reinit-costs              --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/network/test_reinit_costs.tesh)
+  set_property(TEST tesh-simdag-reinit-costs PROPERTY WILL_FAIL TRUE)
   ADD_TESH(tesh-simdag-parser                    --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms basic_parsing_test.tesh)
   ADD_TESH(tesh-simdag-parser-sym-full           --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms basic_parsing_test_sym_full.tesh)
   ADD_TESH(tesh-simdag-full-links                --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms get_full_link.tesh)
index df8b11b..3237bad 100644 (file)
@@ -75,10 +75,6 @@ TEST_BIG_ENDIAN(BIGENDIAN)
 include(FindGraphviz)
 include(FindLibSigc++)
 
-set(HAVE_GTNETS 0)
-if(enable_gtnets)
-  include(FindGTnets)
-endif()
 if(enable_java)
   find_package(Java REQUIRED COMPONENTS Runtime Development)
   find_package(JNI REQUIRED)
@@ -99,9 +95,20 @@ endif()
 if(enable_lua)
   include(FindLua51Simgrid)
 endif()
+
+set(HAVE_GTNETS 0)
+if(enable_gtnets)
+  include(FindGTnets)
+  if (NOT HAVE_GTNETS)
+    message(FATAL_ERROR "Cannot find GTNetS. Please install it, or disable that cmake option")
+  endif()
+endif()
 set(HAVE_NS3 0)
 if(enable_ns3)
   include(FindNS3)
+  if (NOT HAVE_NS3)
+    message(FATAL_ERROR "Cannot find NS3. Please install it (apt-get install ns3 libns3-dev) or disable that cmake option")
+  endif()
 endif()
 
 # algorithm 1.50.0
@@ -114,9 +121,9 @@ if(Boost_FOUND)
   include_directories(${Boost_INCLUDE_DIRS})
 else()
   if(APPLE) #MAC
-    message(FATAL_ERROR, "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')")
+    message(FATAL_ERROR "Failed to find Boost libraries (Try to install them with 'sudo fink install boost1.53.nopython')")
   else()
-    message(FATAL_ERROR, "Failed to find Boost libraries")
+    message(FATAL_ERROR "Failed to find Boost libraries")
   endif()
 endif()
 
index 94d3a08..7bd63de 100644 (file)
@@ -393,6 +393,7 @@ endif()
 
 set(SIMGRID_SRC
   src/simgrid/sg_config.c
+  src/simgrid/host.cpp
   src/simgrid/util.hpp
   )
 
@@ -464,7 +465,7 @@ set(JSURF_JAVA_GENERATED_SRC
   src/bindings/java/org/simgrid/surf/LmmVariable.java
   src/bindings/java/org/simgrid/surf/Model.java
   src/bindings/java/org/simgrid/surf/NetworkAction.java
-  src/bindings/java/org/simgrid/surf/NetworkLink.java
+  src/bindings/java/org/simgrid/surf/Link.java
   src/bindings/java/org/simgrid/surf/Plugin.java
   src/bindings/java/org/simgrid/surf/Resource.java
   src/bindings/java/org/simgrid/surf/ResourceState.java
@@ -687,6 +688,8 @@ set(headers_to_install
   include/simgrid/platf_generator.h
   include/simgrid/plugins.h
   include/simgrid/simix.h
+  include/simgrid/host.h
+  include/simgrid/link.h
   include/smpi/mpi.h
   include/smpi/smpi.h
   include/smpi/smpi_cocci.h
@@ -698,6 +701,7 @@ set(headers_to_install
   include/xbt/RngStream.h
   include/xbt/asserts.h
   include/xbt/automaton.h
+  include/xbt/automaton.hpp
   include/xbt/base.h
   include/xbt/config.h
   include/xbt/cunit.h
index 7bdf3b0..ccc81bc 100644 (file)
@@ -11,7 +11,7 @@ if(NOT __VISUALC__ AND NOT __BORLANDC__)
   elseif(HAVE_CXX0X)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
   else()
-    message(STATUS "Missing support for C++11.")
+    message(FATAL_ERROR "Missing support for C++11.")
   endif()
 endif()
 
index f8d2a4f..e9777ee 100644 (file)
@@ -129,13 +129,7 @@ if(MMALLOC_WANT_OVERRIDE_LEGACY AND HAVE_GNU_LD)
 endif()
 
 if(HAVE_NS3)
-  if(${NS3_VERSION_MINOR} EQUAL 10)
-    SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_NS3_3_10")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_NS3_3_10")
-  else()
-    SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3.${NS3_VERSION_MINOR}-core -lns3.${NS3_VERSION_MINOR}-csma -lns3.${NS3_VERSION_MINOR}-point-to-point -lns3.${NS3_VERSION_MINOR}-internet -lns3.${NS3_VERSION_MINOR}-applications")
-  endif()
+  SET(SIMGRID_DEP "${SIMGRID_DEP} -lns3.${NS3_VERSION_MINOR}-core -lns3.${NS3_VERSION_MINOR}-csma -lns3.${NS3_VERSION_MINOR}-point-to-point -lns3.${NS3_VERSION_MINOR}-internet -lns3.${NS3_VERSION_MINOR}-applications")
 endif()
 
 if(HAVE_POSIX_GETTIME)
index bd12fa6..04e51d6 100644 (file)
@@ -1,9 +1,14 @@
 find_library(HAVE_GTNETS_LIB
-  NAME gtnets
-  PATH_SUFFIXES lib64 lib lib64/gtnets lib/gtnets
-  PATHS
-  ${gtnets_path}
+  NAME gtsim
+  PATHS ${gtnets_path} ${gtnets_path}/lib
   )
+  
+if (HAVE_GTNETS_LIB)
+  message(STATUS "Looking for GTNetS library - found")
+else()
+  message(STATUS "Looking for GTNetS library - no found (search path: ${gtnets_path})")
+  message(STATUS "  library file name must be libgtsim.so (not gtnets.so, not libgtsim-opt.so)")
+endif()
 
 find_path(HAVE_SIMULATOR_H
   NAME simulator.h
@@ -11,12 +16,17 @@ find_path(HAVE_SIMULATOR_H
   PATHS
   ${gtnets_path}
   )
+if (HAVE_GTNETS_LIB)
+  message(STATUS "Looking for GTNetS header simulator.h - found")
+else()
+  message(STATUS "Looking for GTNetS header simulator.h - no found")
+endif()
 
 string(REPLACE "/libgtnets.${LIB_EXE}" ""  GTNETS_LIB_PATH "${HAVE_GTNETS_LIB}")
 
 if(HAVE_GTNETS_LIB AND HAVE_SIMULATOR_H)
 
-  execute_process(COMMAND ${CMAKE_CXX_COMPILER} -I${HAVE_SIMULATOR_H} -lgtnets -L${GTNETS_LIB_PATH} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gtnets.cpp
+  execute_process(COMMAND ${CMAKE_CXX_COMPILER} -I${HAVE_SIMULATOR_H} -lgtsim -L${GTNETS_LIB_PATH} ${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/test_prog/prog_gtnets.cpp
     OUTPUT_VARIABLE COMPILE_GTNETS_VAR)
   if(COMPILE_GTNETS_VAR)
     SET(HAVE_GTNETS 0)
@@ -32,7 +42,7 @@ if(HAVE_GTNETS_LIB AND HAVE_SIMULATOR_H)
 
     string(REGEX MATCH "${GTNETS_LIB_PATH}" operation "$ENV{LD_LIBRARY_PATH}")
     if(NOT operation)
-      message(FATAL_ERROR "\n\nTo use GTNETS don't forget to set LD_LIBRARY_PATH with \n\texport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GTNETS_LIB_PATH}\n\n")
+      message(FATAL_ERROR "\nGTNetS library found but unusable. Did you set LD_LIBRARY_PATH?\n\texport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GTNETS_LIB_PATH}\n\n")
     endif()
 
   endif()
index eb64091..7e8d7ea 100644 (file)
@@ -1,19 +1,10 @@
-# If you use NS-3 version 3.14 (prefer used at most 3.13) be sure having do
-# ln -sf libns3.14.1-applications-debug.so libns3-applications.so
-# ln -sf libns3.14.1-internet-debug.so libns3-internet.so
-# ln -sf libns3.14.1-point-to-point-debug.so libns3-point-to-point.so
-# ln -sf libns3.14.1-csma-debug.so libns3-csma.so
-# ln -sf libns3.14.1-core-debug.so libns3-core.so
 
-find_library(HAVE_NS3_LIB
-  NAME ns3
-  PATH_SUFFIXES lib64 lib ns3/lib
-  PATHS
-  ${ns3_path}
-  )
+## ADDING A NS3 VERSION.
+#   - Add ns3.${version}-core to the NAME line of the find_library below
+#   - Add include/ns3{version} to the PATH_SUFFIXES line of the find_path below
 
 find_library(HAVE_NS3_CORE_LIB
-  NAME ns3-core ns3.14-core ns3.17-core
+  NAME ns3-core ns3.14-core ns3.15-core ns3.16-core ns3.17-core ns3.18-core ns3.19-core ns3.20-core ns3.21-core ns3.22-core
   PATH_SUFFIXES lib64 lib ns3/lib
   PATHS
   ${ns3_path}
@@ -21,27 +12,20 @@ find_library(HAVE_NS3_CORE_LIB
 
 find_path(HAVE_CORE_MODULE_H
   NAME ns3/core-module.h
-  PATH_SUFFIXES include ns3/include include/ns3.14.1 include/ns3.17
+  PATH_SUFFIXES include ns3/include include/ns3.14 include/ns3.15 include/ns3.16 include/ns3.17 include/ns3.18 include/ns3.19 include/ns3.20 include/ns3.21 include/ns3.22
   PATHS
   ${ns3_path}
   )
 
-message(STATUS "Looking for core-module.h")
+
+
 if(HAVE_CORE_MODULE_H)
-  message(STATUS "Looking for core-module.h - found")
+  message(STATUS "Looking for ns3/core-module.h - found")
 else()
-  message(STATUS "Looking for core-module.h - not found")
+  message(STATUS "Looking for ns3/core-module.h - not found")
 endif()
 mark_as_advanced(HAVE_CORE_MODULE_H)
 
-message(STATUS "Looking for lib ns3")
-if(HAVE_NS3_LIB)
-  message(STATUS "Looking for lib ns3 - found")
-else()
-  message(STATUS "Looking for lib ns3 - not found")
-endif()
-mark_as_advanced(HAVE_NS3_LIB)
-
 message(STATUS "Looking for lib ns3-core")
 if(HAVE_NS3_CORE_LIB)
   message(STATUS "Looking for lib ns3-core - found")
index 9c01b51..89e6969 100644 (file)
@@ -1,4 +1,4 @@
-### ARGs use -D[var]=[ON/OFF] or [1/0] or [true/false](see after)
+### ARGs use -D[var]=[ON/OFF] or [1/0] or [true/false](see below)
 ### ex: cmake -Denable_java=ON -Denable_gtnets=ON ./
 
 set(BIBTEX2HTML ${BIBTEX2HTML} CACHE PATH "Path to bibtex2html")
index 928da8f..84485c9 100644 (file)
@@ -102,11 +102,16 @@ message("        CFlags ......................: ${CMAKE_C_FLAGS}")
 message("        CXXFlags ....................: ${CMAKE_CXX_FLAGS}")
 message("        LDFlags .....................: ${CMAKE_C_LINK_FLAGS}")
 message("")
-if(NOT APPLE AND NOT WIN32)
-  message("        Compile Gtnets ..............: ${HAVE_GTNETS}")
-  message("        Compile NS-3 ................: ${HAVE_NS3}")
-  message("        Gtnets path .................: ${gtnets_path}")
-  message("        NS-3 path ...................: ${ns3_path}")
+
+if (HAVE_GTNETS)
+  message("        Compile Gtnets ..............: yes (path: ${gtnets_path})")
+else()
+  message("        Compile Gtnets ..............: NO (path: ${gtnets_path})")
+endif()
+if (HAVE_NS3)
+  message("        Compile NS-3 ................: yes (path: ${ns3_path})")
+else()
+  message("        Compile NS-3 ................: NO  (path: ${ns3_path})")
 endif()
 
 message("        Compile Java ................: ${HAVE_Java}")
index e236b5f..e8a223f 100644 (file)
@@ -4,269 +4,191 @@ It is possible to use a packet-level network simulator
 instead of the default flow-based simulation. You may want to use such
 an approach if you have doubts about the validity of the default model
 or if you want to perform some validation experiments. At the moment,
-we support the GTNetS simulator and since version 3.6.2, ns-3.
+we support the NS3 and GTNetS simulators.
 
 
-\section pls_simgrid_configuration_gtnets Using GTNetS
+\section pls_simgrid_configuration_gtnets GTNetS as a SimGrid model
 
+\subsection pls_simgrid_configuration_gtnets_compile Compiling a patched version of  GTNetS
 
-<i>
-To enable GTNetS model inside SimGrid it is needed to patch the GTNetS simulator source code
-and build/install it from scratch
-</i>
-
- - <b>Download and enter the recent downloaded GTNetS directory</b>
+GTNetS needs to be patched to work with SimGrid, so the easiest
+solution is to run the following commands:
 
 \verbatim
+# Get the files that we prepared for you
 svn checkout svn://scm.gforge.inria.fr/svn/simgrid/contrib/trunk/GTNetS/
 cd GTNetS
-\endverbatim
-
-
- - <b>Use the following commands to unzip and patch GTNetS package to work within SimGrid.</b>
 
-\verbatim
+# Unpack and patch the sources
 unzip gtnets-current.zip
 tar zxvf gtnets-current-patch.tgz
 cd gtnets-current
-cat ../00*.patch | patch -p1
-\endverbatim
-
-  - <b>OPTIONALLY</b> you can use a patch for itanium 64bit processor family.
+cat ../*.patch | patch -p1
 
-\verbatim
-cat ../AMD64-FATAL-Removed-DUL_SIZE_DIFF-Added-fPIC-compillin.patch | patch -p1
-\endverbatim
-
- - <b>Compile GTNetS</b>
-
-   Due to portability issues it is possible that GTNetS does not compile in your architecture. The patches furnished in SimGrid SVN repository are intended for use in Linux architecture only. Unfortunately, we do not have the time, the money, neither the manpower to guarantee GTNetS portability. We advice you to use one of GTNetS communication channel to get more help in compiling GTNetS.
-
-
-\verbatim
+# Compile GTNetS
 ln -sf Makefile.linux Makefile
 sed -i 's/-fPIC/-fPIC -fpermissive/g' Makefile
 make depend
-make debug
+make opt   # compile an optimized version (required)
+make debug # compile a debug version (optional)
+
+# Install under /opt 
+mkdir -p /opt/gtnets/include /opt/gtnets/lib
+cp -fr SRC/*.h /opt/gtnets/include
+cp libgtsim-opt.so /opt/gtnets/lib/libgtsim.so
 \endverbatim
 
+Some remarks:
 
- - <b>NOTE</b> A lot of warnings are expected but the application should compile
- just fine. If the makefile insists in compiling some QT libraries
- please try a make clean before asking for help.
+<ul>
 
+  <li>The patch
+   AMD64-FATAL-Removed-DUL_SIZE_DIFF-Added-fPIC-compillin.patch is
+   only useful if you want to compile on Itanium 64bits (but should be
+   harmless on other architectures). Note that we only provide support
+   for Linux so far.  Your patches are welcome to improve this ;)</li>
 
- - <b>To compile optimized version</b>
+  <li>The compilation spits a lot of warnings, but the application
+   should compile by the end. If the makefile insists in compiling
+   some QT libraries please try a make clean before asking for help.</li>
 
-\verbatim
-make opt
-\endverbatim
+  <li>If you need to use another version of GTNetS, then you will
+   probably need to modify the patch. Please drop us a line: we will
+   gratefully integrate your work. For the record, the version that we
+   provide were downloaded from <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/software/gtnets-current.zip">here</a>
+   on June 12th, 2008.</li>
 
+  <li>Of course you can install GTNets wherever you want on your hard
+   disk. We provide the commands for /opt just to help you.</li>
+</ul>
 
- - <b>Installing GTNetS</b>
-
- It is important to put the full path of your libgtsim-xxxx.so file when creating the symbolic link. Replace < userhome > by some path you have write access to.
+Add the following to your .bashrc so that it gets defined each time:
 
 \verbatim
-ln -sf /<absolute_path>/gtnets_current/libgtsim-debug.so /<userhome>/usr/lib/libgtnets.so
-export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/<userhome>/usr/lib/
-mkdir /<userhome>/usr/include/gtnets
-cp -fr SRC/*.h /<userhome>/usr/include/gtnets
+export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/opt/gtnets/lib/
 \endverbatim
 
+\subsection pls_simgrid_configuration_gtnets_config Enabling SimGrid's support for GTNetS
 
- - <b>Enable GTNetS support in SimGrid</b>
-
-In order to enable gtnets with simgrid you have to give where is gtnets. (path to \<gtnets_path\>/lib and \<gtnets_path\>/include)
+You just have to enable GTNetS in ccmake or cmake as follows, and
+recompile SimGrid.
 
 \verbatim
-cmake . -Denable_gtnets=ON -Dgtnets_path=/<userhome>/usr
+cmake . -Denable_gtnets=ON -Dgtnets_path=/opt/gtnets
 \endverbatim
 
- - <b>Once you have followed all the instructions for compiling and
-   installing successfully you can activate this feature at
-   runntime with the following options:</b>
+By the end of the configuration, cmake reports whether GTNetS was found.
+You can also double-check by executing the tests after the compilation.
 
 \verbatim
-cd simgrid
-make
-ctest -R gtnets
+$ ctest -R gtnets
+(several tests should be run)
 \endverbatim
 
+\subsection pls_simgrid_configuration_gtnets_use Using GTNetS from SimGrid
 
- - <b>Or try the GTNetS model dogbone example with</b>
+A working example can be found in the folder examples/msg/gtnets.
 
 \verbatim
-gtnets/gtnets gtnets/onelink-p.xml gtnets/onelink-d.xml --cfg=network_model:GTNets
+gtnets/gtnets gtnets/onelink-p.xml gtnets/onelink-d.xml --cfg=network/model:GTNets
 \endverbatim
 
+For more information, please refer to the <a
+href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/index.html">GTNetS
+Website</a> or to this
+<a href="http://gforge.inria.fr/docman/view.php/12/6283/GTNetS
+HowTo.html">possibly outdated longer HowTo</a>
 
- A long version of this <a href="http://gforge.inria.fr/docman/view.php/12/6283/GTNetS HowTo.html">HowTo</a>  it is available
+\section pls_simgrid_configuration_ns3 NS3 as a SimGrid model
 
+You may want to replace the SimGrid network models by the ones of the
+well known packet-level network simulator <a href="http://www.nsnam.org/">NS-3</a> instead.
+This section explains how to do so.
 
- More about GTNetS simulator at <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/index.html">GTNetS Website</a>
-
-
- - <b>DISCLAIMER</b>
- The patches provided by us worked successfully with GTNetS found
- <a href="http://www.ece.gatech.edu/research/labs/MANIACS/GTNetS/software/gtnets-current.zip">here</a>,
- dated from 12th June 2008. Due to the discontinuing development of
- GTNetS it is impossible to precise a version number. We STRONGLY recommend you
- to download and install the GTNetS version found in SimGrid repository as explained above.
-
-\section pls_simgrid_configuration_ns3 Using NS3
-
-It is possible to use discrete-event network simulator <a href="http://www.nsnam.org/">(ns-3)</a> for Internet systems
-instead of the default one.
-
-A ns-3 platform is created according to the platform file you provide in SimGrid format. However from this configuration, we had to set up some extra parameters :
-
-<ul>
-<li>
-First, whenever possible, we let default ns3 values and we don't changed it ; in case you have doubts on values for those parameters (TCP parameters for example), blame ns-3...
-</li>
+\subsection pls_simgrid_configuration_ns3_install Installing NS3
 
-<li>
-Second, routing used inside ns-3 is a global and static one, relying on a shortest path algorithm. We did so by using ns3::Ipv4GlobalRoutingHelper::PopulateRoutingTables.
-</li>
-
-<li>
-Third, we also choose to restrict the way your platform is built : end hosts cannot have more than one interface card (so, only one &lt;link&gt; in your SimGrid platform should link
-an end host to the platform ; if not, your end host will be considered as a router.
-</li>
-
-</ul>
-<i>
-To use ns3 model inside SimGrid you have to install at least the version 3.10 of ns3 simulator.
-</i>
-
-- <b>Download and enter the lateast release (here the 3.12.1)</b>
+The easiest is to install it with the package manager.  Under
+Debian/Ubuntu, simply type as root:
 
 \verbatim
-http://www.nsnam.org/release/ns-allinone-3.12.1.tar.bz2
-tar -xf ns-allinone-3.12.1.tar.bz2
-cd ns-allinone-3.12.1/ns-3.12.1/
+apt-get install libns3-dev ns3
 \endverbatim
 
-- <b>Configure, make and install ns3</b>
+You can also install it from scratch with the following commands:
 
 \verbatim
+# Download the source
+wget http://www.nsnam.org/release/ns-allinone-3.22.tar.bz2
+tar -xf ns-allinone-3.22.tar.bz2
+cd ns-allinone-3.22/ns-3.22/
+# Configure, build and install
 ./waf configure --prefix="ns-3_install_directory"
 ./waf
 ./waf install
 \endverbatim
 
-After install ns-3 you should have directories into your "ns-3_install_directory":
-       \li include/ns3/
-  \li lib/
-  \li bin/ (with 3.12)
-
-In some cases, include/ns3 does not exist, but there is an /include/ns3.XX . Then, a simple symbolic link is enough. From the /path/to/ns3/installation/include directory, run:
-\verbatim
-ln -s -T ns3.XX/ns3 ns3
-\endverbatim
-
-Make sure to replace 3.XX with your version of NS3, e.g., 3.17, or 3.18.
-Check the correct presence of the symbolic link using
-\verbatim
-ls -al
-\endverbatim
-
-and you should see an ns3 link pointing to ns3.XX. E.g., ns3 -> ns3.17/ns3
-You also need to add to the LD_LIBRARY_PATH : "ns-3_install_directory/lib".
+For more information, please refer to the NS-3 documentation.
 
-- <b>Enable ns-3 support on SimGrid</b>
+\subsection pls_simgrid_configuration_ns3_config Enabling SimGrid's support for NS3
 
-Enabling ns-3 integration with Simgrid requires several intermediate steps.
--# Modify "simgrid_path/buildtools/CMake/MakeLib.cmake".\n
-The "-lns3.${NS3_VERSION_MINOR}-[module]" should match the library names in your "ns-3_install_directory/lib". The "module" can be one of the following: core, csma, point-to-oint, internet, applications, bridge, mpi, config-store, stats, network. For this, in the "MakeLib.cmake" file find the "else" branch of "if(HAVE_NS3)" statement. Replace the se of "-lns3.${NS3_VERSION_MINOR}-[module]" with "-lns3[version]-[module]-debug" in "SET(SIMGRID_DEP)". On the same branch, add "-I/path/to/ns-3_install_directory/include" to MAKE_C_FLAGS and "CMAKE_CXX_FLAGS".
--# There might be a need for creating symbolic links of each ns3 library from "ns-3_install_directory/lib" to "/usr/lib".
--# In order to enable ns-3 with simgrid you have to give where is ns-3 to the simgrid configuration command. (path to \<ns3_path\>/lib and \<ns3_path\>/include)
+Normally, you just have to enable NS3 in ccmake or cmake as follows.
+If you installed NS3 in a regular path, just drop the ns3_path
+configuration item.
 
 \verbatim
 cmake . -Denable_ns3=ON -Dns3_path=<ns3_path>
 \endverbatim
 
-With the output of the configuration you can see if ns-3 is detected (see CFlags: ; CPPFlags: ; Compile NS-3: , NS-3 path:).
+By the end of the configuration, cmake reports whether NS-3 was found.
+You can also double-check by executing the tests after the compilation.
 
 \verbatim
-Configuration of package `simgrid' on arch (=4):
-            BUILDNAME :        UNIX
-            SITE      :        Linux_2.6.38-11-generic_x86_64
-            Release   :        simgrid-3.6.1
-
-        Compiler: c++ :        /usr/bin/c++
-               version:        4.6.1
-        Compiler: c   :        /usr/bin/gcc
-               version:        4.6.1
-
-              CFlags  :        -O3 -finline-functions -funroll-loops -fno-strict-aliasing -L/usr/lib/x86_64-linux-gnu -I/usr/include
-                                       -L/home/navarrop/Install/ns3-3.10/lib -I/home/navarrop/Install/ns3-3.10/include -g3  -D_NS3_3_10
-              CPPFlags:        -I/home/navarrop/Install/ns3-3.10/include -L/home/navarrop/Install/ns3-3.10/lib
-
-       Compile Gtnets :        0
-       Compile NS-3   :        1 ---------------------> Be sure this option is "1" otherwise ns-3 is not activated
-       Gtnets path    :
-       NS-3 path      :        /home/navarrop/Install/ns3-3.10
-       Compile Lua    :
-       Compile Smpi   :        OFF
-       Compile Static :        OFF
-
-       Maintainer mode:        OFF
-       Supernovae mode:        OFF
-       Model checking :        OFF
-       Tracing mode   :        OFF
-       Jedule  mode   :        OFF
-       Latency bound  :        OFF
-        Graphviz mode  :
-
-       Simgrid dependencies:   -lm -lpthread -lns3 -lrt
-       Smpi dependencies   :
-
-       INSTALL_PREFIX:         /usr/local
--- Configuring done
--- Generating done
--- Build files have been written to: /home/navarrop/workspace/simgrid/build
+$ ctest -R ns3
+(several tests should be run)
 \endverbatim
 
-Now you can compile SimGrid
-\verbatim
-make
-\endverbatim
+If you have a NS3 version that is not known (yet) to SimGrid, the
+detection may fail. In that case, edit  the file
+buildtools/Cmake/Modules/FindNS3.cmake in your SimGrid tree. The
+required changes are very easy, and documented at the beginning of
+this file.
 
-Then you can see if ns-3 is well activated by testing
-\verbatim
-ctest -R ns3
-\endverbatim
+If the compilation fails when linking the library because of some .a
+file that cannot be used dynamically, that's probably because you only
+installed the libns3-dev library on your Debian, where you also need
+libns3-3. That's probably a bug of the libns3-dev package that should
+depend on the dynamic libraries corresponding to its .so files.
 
-You should see
-\verbatim
-    Start 182: msg-ns3-thread
-1/3 Test #182: msg-ns3-thread ...................   Passed    0.35 sec
-    Start 183: msg-ns3-ucontext
-2/3 Test #183: msg-ns3-ucontext .................   Passed    0.22 sec
-    Start 184: msg-ns3-raw
-3/3 Test #184: msg-ns3-raw ......................   Passed    0.23 sec
-\endverbatim
+\subsection pls_simgrid_configuration_ns3_use Using NS3 from SimGrid
 
-- <b>Use case</b>
+A working example of NS3/SimGrid interactions can be found in
+examples/msg/ns3. Basically, you just have to run your SimGrid
+simulation with the configuration option "network/model" set to the
+value "NS3". The rest remains unchanged.
 
-An example of using Simgrid with NS3 can be found in:
+The following should work from the examples/msg/ns3 folder (ns3 here
+is the name of our example binary).
 
 \verbatim
-path/to/simgrid/examples/src/surf/ns3/
+./ns3 ./3hosts_2links_p.xml 3hosts_2links_d.xml --cfg=network/model:NS3 --log=root.threshold:info
 \endverbatim
 
-From the example folder above, the command line sintax is
+A ns-3 platform is automatically created from the SimGrid platform
+file that you will provide. There is some caveats to know:
 
-\verbatim
-<simgrid_executable> <platform description file> <deployment file> --cfg=network/model:NS3 --log=surf.threshold:info
-\endverbatim
+<ul>
+  <li>The default values (e.g., TCP parameters) are the ns3
+    values. Don't blame us for them.</li>  
+
+  <li>NS3 networks are routed using the shortest path algorithm, using
+    ns3::Ipv4GlobalRoutingHelper::PopulateRoutingTables.</li>
+
+  <li>End hosts cannot have more than one interface card (so, only one
+   &lt;link&gt; in your SimGrid platform should link an end host to
+   the platform ; if not, your end host will be considered as a
+   router.  </li>
+</ul>
 
-This example should work:
-\verbatim
-./ns3 ./3hosts_2links_p.xml 3hosts_2links_d.xml --cfg=network/model:NS3 --log=root.threshold:info
-\endverbatim
 
 More about ns-3 simulator <a href="http://www.nsnam.org/">(Official website)</a>
 
index 8cf24b7..c23c31d 100644 (file)
@@ -28,7 +28,7 @@ public class ReservationPlugin extends Plugin {
   }
 
   public void updateBandwidthRoute(String src, String dst, double bandwidth){
-    NetworkLink[] route = Surf.getRoute(src, dst);
+    Link[] route = Surf.getRoute(src, dst);
     for (int i =0; i<route.length; i++){
       Msg.info("Trace: bandwidth of "+route[i].getName()+" before "+route[i].getBandwidth());
       route[i].updateBandwidth(bandwidth);//getName();
@@ -36,11 +36,11 @@ public class ReservationPlugin extends Plugin {
     }
   }
 
+  @Override
   public void networkCommunicateCallback(NetworkAction action, RoutingEdge src, RoutingEdge dst, double size, double rate){
     if (src.getName().equals(this.src) && dst.getName().equals(this.dst)) {
       action.setBound(this.bandwidth);
     }
     Msg.info("Trace: Communicate message of size "+size+" with rate "+rate+" and bound "+action.getBound()+" from "+src.getName()+" to "+dst.getName());
   }
-
 }
index fb2925a..7a9e5de 100644 (file)
@@ -10,7 +10,6 @@ public class CpuConstantModel extends CpuModel {
   private List<CpuConstant> cpus = new ArrayList<CpuConstant>();
 
   public CpuConstantModel() {
-    super("Cpu Constant");
     Msg.info("Initialize Cpu Constant Model");
   }
 
index 068cb8f..92dbf93 100644 (file)
@@ -35,7 +35,7 @@ public class TestCpuModel {
     /* construct the platform and deploy the application */
     Msg.createEnvironment(args[0]);
     Msg.deployApplication(args[1]);
-    Msg.info("Cpu Loaded: "+Surf.getCpuModel().getName());
+    Msg.info("Cpu Loaded: "+Surf.getCpuModel().getClass().getName());
 
     /*  execute the simulation. */
     Msg.run();
index 4fceb61..990b8c6 100644 (file)
@@ -10,7 +10,7 @@ $ java -classpath ${classpath:=.} surfCpuModel/TestCpuModel ${srcdir:=.}/../plat
 > [0.000000] [jmsg/INFO] New Cpu(Ginette, 4.8492E7, 1.0)
 > [0.000000] [jmsg/INFO] New Cpu(Bourassa, 4.8492E7, 1.0)
 > [0.000000] [jmsg/INFO] UpdateActionState of 0 actions
-> [0.000000] [jmsg/INFO] Cpu Loaded: Cpu Constant
+> [0.000000] [jmsg/INFO] Cpu Loaded: surfCpuModel.CpuConstantModel
 > [Tremblay:surfCpuModel.Sender:(1) 0.000000] [jmsg/INFO] helloo!
 > [Jupiter:surfCpuModel.Receiver:(2) 0.000000] [jmsg/INFO] helloo!
 > [0.000000] [jmsg/INFO] Sleep action of duration -1.0 sleeping true
index ac1d677..e2329f5 100644 (file)
@@ -18,42 +18,50 @@ public class TracePlugin extends Plugin {
     activateCpuStateChangedCallback();
     activateCpuActionStateChangedCallback();
 
-    activateNetworkLinkCreatedCallback();
-    activateNetworkLinkDestructedCallback();
-    activateNetworkLinkStateChangedCallback();
+    activateLinkCreatedCallback();
+    activateLinkDestructedCallback();
+    activateLinkStateChangedCallback();
     activateNetworkActionStateChangedCallback();
   }
 
+  @Override
   public void cpuCreatedCallback(Cpu cpu) {
     Msg.info("Trace: Cpu created "+cpu.getName());
   }
 
+  @Override
   public void cpuDestructedCallback(Cpu cpu) {
     Msg.info("Trace: Cpu destructed "+cpu.getName());
   }
 
+  @Override
   public void cpuStateChangedCallback(Cpu cpu, ResourceState old, ResourceState cur){
     Msg.info("Trace: Cpu state changed "+cpu.getName());
   }
 
+  @Override
   public void cpuActionStateChangedCallback(CpuAction action, ActionState old, ActionState cur){
-    Msg.info("Trace: CpuAction state changed "+action.getModel().getName());
+    Msg.info("Trace: CpuAction state changed");
   }
 
-  public void networkLinkCreatedCallback(NetworkLink link) {
-    Msg.info("Trace: NetworkLink created "+link.getName());
+  @Override
+  public void networkLinkCreatedCallback(Link link) {
+    Msg.info("Trace: Link created "+link.getName());
   }
 
-  public void networkLinkDestructedCallback(NetworkLink link) {
-    Msg.info("Trace: NetworkLink destructed "+link.getName());
+  @Override
+  public void networkLinkDestructedCallback(Link link) {
+    Msg.info("Trace: Link destructed "+link.getName());
   }
 
-  public void networkLinkStateChangedCallback(NetworkLink link, ResourceState old, ResourceState cur){
-    Msg.info("Trace: NetworkLink state changed "+link.getName());
+  @Override
+  public void networkLinkStateChangedCallback(Link link, ResourceState old, ResourceState cur){
+    Msg.info("Trace: Link state changed "+link.getName());
   }
 
+  @Override
   public void networkActionStateChangedCallback(NetworkAction action, ActionState old, ActionState cur){
-    Msg.info("Trace: NetworkAction state changed "+action.getModel().getName());
+    Msg.info("Trace: NetworkAction state changed");
   }
 
 }
index e6fdeea..c28f77a 100644 (file)
@@ -1,9 +1,10 @@
 #! tesh
+! output sort
 
 $ java -classpath ${classpath:=.} surfPlugin/TestPlugin ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/surfPlugin/surfPluginDeployment.xml
 > [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created __loopback__
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed __loopback__
+> [0.000000] [jmsg/INFO] Trace: Link created __loopback__
+> [0.000000] [jmsg/INFO] Trace: Link state changed __loopback__
 > [0.000000] [jmsg/INFO] Trace: Cpu created Tremblay
 > [0.000000] [jmsg/INFO] Trace: Cpu state changed Tremblay
 > [0.000000] [jmsg/INFO] Trace: Cpu created Jupiter
@@ -14,37 +15,37 @@ $ java -classpath ${classpath:=.} surfPlugin/TestPlugin ${srcdir:=.}/../platform
 > [0.000000] [jmsg/INFO] Trace: Cpu state changed Ginette
 > [0.000000] [jmsg/INFO] Trace: Cpu created Bourassa
 > [0.000000] [jmsg/INFO] Trace: Cpu state changed Bourassa
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 6
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 6
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 3
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 3
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 7
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 7
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 9
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 9
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 2
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 2
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 8
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 8
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 1
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 1
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 4
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 4
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 0
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 0
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created 5
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed 5
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created loopback
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed loopback
+> [0.000000] [jmsg/INFO] Trace: Link created 6
+> [0.000000] [jmsg/INFO] Trace: Link state changed 6
+> [0.000000] [jmsg/INFO] Trace: Link created 3
+> [0.000000] [jmsg/INFO] Trace: Link state changed 3
+> [0.000000] [jmsg/INFO] Trace: Link created 7
+> [0.000000] [jmsg/INFO] Trace: Link state changed 7
+> [0.000000] [jmsg/INFO] Trace: Link created 9
+> [0.000000] [jmsg/INFO] Trace: Link state changed 9
+> [0.000000] [jmsg/INFO] Trace: Link created 2
+> [0.000000] [jmsg/INFO] Trace: Link state changed 2
+> [0.000000] [jmsg/INFO] Trace: Link created 8
+> [0.000000] [jmsg/INFO] Trace: Link state changed 8
+> [0.000000] [jmsg/INFO] Trace: Link created 1
+> [0.000000] [jmsg/INFO] Trace: Link state changed 1
+> [0.000000] [jmsg/INFO] Trace: Link created 4
+> [0.000000] [jmsg/INFO] Trace: Link state changed 4
+> [0.000000] [jmsg/INFO] Trace: Link created 0
+> [0.000000] [jmsg/INFO] Trace: Link state changed 0
+> [0.000000] [jmsg/INFO] Trace: Link created 5
+> [0.000000] [jmsg/INFO] Trace: Link state changed 5
+> [0.000000] [jmsg/INFO] Trace: Link created loopback
+> [0.000000] [jmsg/INFO] Trace: Link state changed loopback
 > [Tremblay:surfPlugin.Sender:(1) 0.000000] [jmsg/INFO] helloo!
 > [Tremblay:surfPlugin.Sender:(1) 0.000000] [jmsg/INFO] host count: 1
 > [Tremblay:surfPlugin.Sender:(1) 0.000000] [jmsg/INFO] sender time: 0.0
 > [Jupiter:surfPlugin.Receiver:(2) 0.000000] [jmsg/INFO] helloo!
 > [Jupiter:surfPlugin.Receiver:(2) 0.000000] [jmsg/INFO] try to get a task
-> [0.019014] [jmsg/INFO] Trace: NetworkAction state changed network
+> [0.019014] [jmsg/INFO] Trace: NetworkAction state changed
 > [Jupiter:surfPlugin.Receiver:(2) 0.019014] [jmsg/INFO] Got at time 0.019014486310327584
 > [Tremblay:surfPlugin.Sender:(1) 0.019014] [jmsg/INFO] goodbye!
-> [0.019146] [jmsg/INFO] Trace: CpuAction state changed cpu
+> [0.019146] [jmsg/INFO] Trace: CpuAction state changed
 > [Jupiter:surfPlugin.Receiver:(2) 0.019146] [jmsg/INFO] goodbye!
 > [0.019146] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
 > [0.019146] [jmsg/INFO] Trace: Cpu destructed Fafard
@@ -52,15 +53,15 @@ $ java -classpath ${classpath:=.} surfPlugin/TestPlugin ${srcdir:=.}/../platform
 > [0.019146] [jmsg/INFO] Trace: Cpu destructed Bourassa
 > [0.019146] [jmsg/INFO] Trace: Cpu destructed Jupiter
 > [0.019146] [jmsg/INFO] Trace: Cpu destructed Ginette
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed __loopback__
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed loopback
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 0
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 1
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 2
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 3
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 4
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 5
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 6
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 7
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 8
-> [0.019146] [jmsg/INFO] Trace: NetworkLink destructed 9
+> [0.019146] [jmsg/INFO] Trace: Link destructed loopback
+> [0.019146] [jmsg/INFO] Trace: Link destructed 5
+> [0.019146] [jmsg/INFO] Trace: Link destructed 0
+> [0.019146] [jmsg/INFO] Trace: Link destructed 1
+> [0.019146] [jmsg/INFO] Trace: Link destructed 9
+> [0.019146] [jmsg/INFO] Trace: Link destructed 4
+> [0.019146] [jmsg/INFO] Trace: Link destructed 7
+> [0.019146] [jmsg/INFO] Trace: Link destructed 3
+> [0.019146] [jmsg/INFO] Trace: Link destructed 8
+> [0.019146] [jmsg/INFO] Trace: Link destructed 6
+> [0.019146] [jmsg/INFO] Trace: Link destructed 2
+> [0.019146] [jmsg/INFO] Trace: Link destructed __loopback__
index d9c6adc..0c471b0 100644 (file)
@@ -344,7 +344,7 @@ static int master_main(int argc, char *argv[])
   {
     msg_host_t vm0 = MSG_vm_create_core(pm0, "VM0");
 
-    s_ws_params_t params;
+    s_vm_params_t params;
     memset(&params, 0, sizeof(params));
     params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes
     MSG_host_set_params(vm0, &params);
index 3d1fb4c..77617dd 100644 (file)
@@ -70,7 +70,7 @@ int master_fun(int argc, char *argv[])
     XBT_INFO("create %s on PM(%s)", vm_name, MSG_host_get_name(pm));
     msg_vm_t vm = MSG_vm_create_core(pm, vm_name);
 
-    s_ws_params_t params;
+    s_vm_params_t params;
     memset(&params, 0, sizeof(params));
     params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes
     MSG_host_set_params(vm, &params);
index 03a08be..9bd4b36 100644 (file)
@@ -33,8 +33,8 @@ static int migration_worker_main(int argc, char *argv[])
   char *vm_name = argv[1];
   char *dst_pm_name = argv[2];
 
-  msg_vm_t vm = MSG_get_host_by_name(vm_name);
-  msg_host_t dst_pm = MSG_get_host_by_name(dst_pm_name);
+  msg_vm_t vm = MSG_host_by_name(vm_name);
+  msg_host_t dst_pm = MSG_host_by_name(dst_pm_name);
 
   vm_migrate(vm, dst_pm);
 
@@ -64,7 +64,7 @@ static int master_main(int argc, char *argv[])
   msg_host_t pm1 = xbt_dynar_get_as(hosts_dynar, 1, msg_host_t);
   msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t);
   msg_vm_t vm0, vm1;
-  s_ws_params_t params;
+  s_vm_params_t params;
   memset(&params, 0, sizeof(params));
 
 
index 8fb26bf..28c409b 100644 (file)
@@ -177,7 +177,7 @@ static void test_vm_pin(void)
   msg_vm_t vm2 = MSG_vm_create_core(pm2, "VM2");
   msg_vm_t vm3 = MSG_vm_create_core(pm2, "VM3");
 
-  s_ws_params_t params;
+  s_vm_params_t params;
   memset(&params, 0, sizeof(params));
   params.ramsize = 1L * 1024 * 1024;
   params.skip_stage1 = 1;
index 3d10a25..b1f1220 100644 (file)
@@ -255,7 +255,7 @@ static int master_main(int argc, char *argv[])
   XBT_INFO("### Relocate VM0 between PM0 and PM1");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   {
-    s_ws_params_t params;
+    s_vm_params_t params;
     memset(&params, 0, sizeof(params));
     params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes
     MSG_host_set_params(vm0, &params);
index 2b70166..45027a8 100644 (file)
@@ -24,7 +24,7 @@ int dvfs(int argc, char *argv[])
 {
   msg_host_t host = NULL;
   msg_task_t task1 = NULL;
-  host = MSG_get_host_by_name("MyHost1");
+  host = MSG_host_by_name("MyHost1");
 
 
   XBT_INFO("Energetic profile: %s",
@@ -78,8 +78,8 @@ int dvfs(int argc, char *argv[])
 
   // =========== Turn the other host off ==========
   XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.",
-                 MSG_host_get_consumed_energy(MSG_get_host_by_name("MyHost2")) );
-  MSG_host_off(MSG_get_host_by_name("MyHost2"));
+                 MSG_host_get_consumed_energy(MSG_host_by_name("MyHost2")) );
+  MSG_host_off(MSG_host_by_name("MyHost2"));
   start = MSG_get_clock();
   MSG_process_sleep(10);
   XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J",
index 2a03378..40a0979 100644 (file)
@@ -65,7 +65,7 @@ static void simulate_shutdown(msg_host_t host) {
 }
 
 static int onoff(int argc, char *argv[]) {
-       msg_host_t host1 = MSG_get_host_by_name("MyHost1");
+       msg_host_t host1 = MSG_host_by_name("MyHost1");
 
        XBT_INFO("Energetic profile: %s",
                        MSG_host_get_property_value(host1,"watt_per_state"));
index 143251f..4716a87 100644 (file)
@@ -77,7 +77,7 @@ int dvfs(int argc, char *argv[])
 
 
   // Verify the default pstate is set to 0
-  host = MSG_get_host_by_name("MyHost2");
+  host = MSG_host_by_name("MyHost2");
   int nb2 = MSG_host_get_nb_pstates(host);
   XBT_INFO("Count of Processor states=%d", nb2);
 
index 620ab81..fd7ebe8 100644 (file)
@@ -54,7 +54,7 @@ int host(int argc, char *argv[]){
 
     msg_host_t src, dest;
     src= MSG_host_self();
-    dest = MSG_get_host_by_name(argv[3]);
+    dest = MSG_host_by_name(argv[3]);
     if (atoi(argv[5])){
       XBT_INFO("Move '%s' (of size %llu) from '%s' to '%s'", filename,
            MSG_file_get_size(file), MSG_host_get_name(src),
index 6ba7bc5..1648f9f 100644 (file)
@@ -192,7 +192,7 @@ int master(int argc, char *argv[])
     slaves = xbt_new0(msg_host_t, slaves_count);
 
     for (i = 4; i < argc; i++) {
-      slaves[i - 4] = MSG_get_host_by_name(argv[i]);
+      slaves[i - 4] = MSG_host_by_name(argv[i]);
       if (slaves[i - 4] == NULL) {
         XBT_INFO("Unknown host %s. Stopping Now!", argv[i]);
         abort();
index dbb760c..4a7864b 100644 (file)
@@ -59,7 +59,7 @@ int master(int argc, char *argv[])
     slaves = xbt_new0(msg_host_t, slaves_count);
 
     for (i = 4; i < argc; i++) {
-      slaves[i - 4] = MSG_get_host_by_name(argv[i]);
+      slaves[i - 4] = MSG_host_by_name(argv[i]);
       if (slaves[i - 4] == NULL) {
         XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
         abort();
index cc8398a..6207395 100644 (file)
@@ -44,7 +44,7 @@ int master(int argc, char *argv[])
     slaves = xbt_new0(msg_host_t, slaves_count);
 
     for (i = 4; i < argc; i++) {
-      slaves[i - 4] = MSG_get_host_by_name(argv[i]);
+      slaves[i - 4] = MSG_host_by_name(argv[i]);
       if (slaves[i - 4] == NULL) {
         XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
         abort();
index 3f030c1..65420d8 100644 (file)
@@ -125,7 +125,7 @@ int master(int argc, char *argv[])
     slaves = xbt_new0(msg_host_t, slaves_count);
 
     for (i = 0; i < argc; i++) {
-      slaves[i] = MSG_get_host_by_name(argv[i]);
+      slaves[i] = MSG_host_by_name(argv[i]);
       if (slaves[i] == NULL) {
         XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
         abort();
@@ -320,7 +320,7 @@ int main(int argc, char *argv[])
     MSG_process_auto_restart_set(process, TRUE);
     hostname_list[i] = (char*) MSG_host_get_name(host);
   }
-  host_master = MSG_get_host_by_name("host_master");
+  host_master = MSG_host_by_name("host_master");
   MSG_process_create_with_arguments("master", master, NULL, host_master,
                                     xbt_dynar_length(host_dynar),
                                     hostname_list);
index cf66fae..96cb6f8 100644 (file)
@@ -68,7 +68,7 @@ int master(int argc, char *argv[])
     slaves = xbt_new0(msg_host_t, slaves_count);
 
     for (i = 4; i < argc; i++) {
-      slaves[i - 4] = MSG_get_host_by_name(argv[i]);
+      slaves[i - 4] = MSG_host_by_name(argv[i]);
       xbt_assert(slaves[i - 4] != NULL, "Unknown host %s. Stopping Now! ",
                   argv[i]);
     }
@@ -140,7 +140,7 @@ int forwarder(int argc, char *argv[])
     slaves = xbt_new0(msg_host_t, slaves_count);
 
     for (i = 1; i < argc; i++) {
-      slaves[i - 1] = MSG_get_host_by_name(argv[i]);
+      slaves[i - 1] = MSG_host_by_name(argv[i]);
       if (slaves[i - 1] == NULL) {
         XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
         abort();
index 9c8e09e..438a485 100644 (file)
@@ -29,7 +29,7 @@ static int master(int argc, char *argv[])
   msg_process_t bob = NULL;
 
   XBT_INFO("Hello!");
-  bob = MSG_process_create("slave", slave, NULL, MSG_get_host_by_name("Fafard"));
+  bob = MSG_process_create("slave", slave, NULL, MSG_host_by_name("Fafard"));
   MSG_process_sleep(10.0);
 
   XBT_INFO("Resume process");
index 134fae7..ef94493 100644 (file)
@@ -79,7 +79,7 @@ int master(int argc, char *argv[])
     slaves = xbt_new0(msg_host_t, slaves_count);
 
     for (i = 0; i < argc; i++) {
-      slaves[i] = MSG_get_host_by_name(argv[i]);
+      slaves[i] = MSG_host_by_name(argv[i]);
       if (slaves[i] == NULL) {
         XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
         abort();
index ef06bf1..35fc18a 100644 (file)
@@ -30,7 +30,7 @@ static int emigrant(int argc, char *argv[])
   msg_task_t task;
   XBT_INFO
       ("I'll look for a new job on another machine where the grass is greener.");
-  MSG_process_migrate(MSG_process_self(), MSG_get_host_by_name("Boivin"));
+  MSG_process_migrate(MSG_process_self(), MSG_host_by_name("Boivin"));
   
   XBT_INFO("Yeah, found something to do");
   task = MSG_task_create("job", 98095000, 0, NULL);
@@ -38,8 +38,8 @@ static int emigrant(int argc, char *argv[])
   MSG_task_destroy(task);
   MSG_process_sleep(2);
   XBT_INFO("Moving back home after work");
-  MSG_process_migrate(MSG_process_self(), MSG_get_host_by_name("Jacquelin"));
-  MSG_process_migrate(MSG_process_self(), MSG_get_host_by_name("Boivin"));
+  MSG_process_migrate(MSG_process_self(), MSG_host_by_name("Jacquelin"));
+  MSG_process_migrate(MSG_process_self(), MSG_host_by_name("Boivin"));
   MSG_process_sleep(4);
   xbt_mutex_acquire(mutex);
   process_to_migrate = MSG_process_self();
@@ -60,7 +60,7 @@ static int policeman(int argc, char *argv[])
   xbt_mutex_acquire(mutex);
   XBT_INFO("Wait a bit before migrating the emigrant.");
   while (process_to_migrate == NULL) xbt_cond_wait(cond, mutex);
-  MSG_process_migrate(process_to_migrate, MSG_get_host_by_name("Jacquelin"));
+  MSG_process_migrate(process_to_migrate, MSG_host_by_name("Jacquelin"));
   XBT_INFO("I moved the emigrant");
   MSG_process_resume(process_to_migrate);
   xbt_mutex_release(mutex);
index 5eab1f4..96a8de1 100644 (file)
@@ -4,31 +4,31 @@ p 3hosts 2links
 
 $ ns3/ns3 ${srcdir:=.}/examples/platforms/small_platform_one_link_routes.xml ${srcdir:=.}/examples/msg/ns3/3hosts_2links_d.xml --cfg=network/model:NS3
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'NS3'
-> [Jupiter:slave:(2) 0.000249] [msg_test/INFO] FLOW[1] : Receive 100 bytes from Tremblay to Jupiter
+> [Jupiter:slave:(2) 0.000250] [msg_test/INFO] FLOW[1] : Receive 100 bytes from Tremblay to Jupiter
 
 p 6hosts 3links
 
 $ ns3/ns3 ${srcdir:=.}/examples/platforms/small_platform_one_link_routes.xml ${srcdir:=.}/examples/msg/ns3/3links-d.xml --cfg=network/model:NS3
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'NS3'
-> [Jupiter:slave:(2) 0.003027] [msg_test/INFO] FLOW[1] : Receive 100000 bytes from Tremblay to Jupiter
-> [Ginette:slave:(4) 0.161074] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from Fafard to Ginette
-> [Lovelace:slave:(6) 1.256527] [msg_test/INFO] FLOW[3] : Receive 2000000 bytes from Bourassa to Lovelace
+> [Jupiter:slave:(2) 0.003057] [msg_test/INFO] FLOW[1] : Receive 100000 bytes from Tremblay to Jupiter
+> [Ginette:slave:(4) 0.162674] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from Fafard to Ginette
+> [Lovelace:slave:(6) 1.269505] [msg_test/INFO] FLOW[3] : Receive 2000000 bytes from Bourassa to Lovelace
 
 $ ns3/ns3 ${srcdir:=.}/examples/platforms/small_platform_one_link_routes.xml ${srcdir:=.}/examples/msg/ns3/3links-d-timer.xml --cfg=network/model:NS3
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'NS3'
-> [Jupiter:slave:(2) 0.003027] [msg_test/INFO] FLOW[1] : Receive 100000 bytes from Tremblay to Jupiter
-> [Ginette:slave:(4) 0.161074] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from Fafard to Ginette
-> [Lovelace:slave:(6) 1.256527] [msg_test/INFO] FLOW[3] : Receive 2000000 bytes from Bourassa to Lovelace
-> [Lovelace:slave:(7) 3.256527] [msg_test/INFO] FLOW[4] : Receive 2000000 bytes from Bourassa to Lovelace
+> [Jupiter:slave:(2) 0.003057] [msg_test/INFO] FLOW[1] : Receive 100000 bytes from Tremblay to Jupiter
+> [Ginette:slave:(4) 0.162674] [msg_test/INFO] FLOW[2] : Receive 1000000 bytes from Fafard to Ginette
+> [Lovelace:slave:(6) 1.269505] [msg_test/INFO] FLOW[3] : Receive 2000000 bytes from Bourassa to Lovelace
+> [Lovelace:slave:(7) 3.269505] [msg_test/INFO] FLOW[4] : Receive 2000000 bytes from Bourassa to Lovelace
 
 p One cluster
 
 $ ns3/ns3 ${srcdir:=.}/examples/platforms/cluster.xml ${srcdir:=.}/examples/msg/ns3/One_cluster-d.xml --cfg=network/model:NS3
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'NS3'
-> [node-6.acme.org:slave:(2) 0.006755] [msg_test/INFO] FLOW[1] : Receive 100 bytes from node-2.acme.org to node-6.acme.org
+> [node-6.acme.org:slave:(2) 0.007311] [msg_test/INFO] FLOW[1] : Receive 100 bytes from node-2.acme.org to node-6.acme.org
 
 p Two clusters
 
 $ ns3/ns3 ${srcdir:=.}/examples/platforms/clusters_routing_full.xml ${srcdir:=.}/examples/msg/ns3/Two_clusters-d.xml --cfg=network/model:NS3
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'NS3'
-> [c-16.me:slave:(2) 0.012729] [msg_test/INFO] FLOW[1] : Receive 100 bytes from c-3.me to c-16.me
+> [c-16.me:slave:(2) 0.026463] [msg_test/INFO] FLOW[1] : Receive 100 bytes from c-3.me to c-16.me
index e54ff4a..81e0feb 100644 (file)
@@ -4,13 +4,13 @@ p Testing a simple master/slave example application
 
 ! output sort
 $ $SG_TEST_EXENV parallel_task/parallel_task$EXEEXT ${srcdir:=.}/../platforms/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > [  0.009378] (1:test@Fafard) Goodbye now!
 > [  0.009378] (0:@) Simulation time 0.00937836
 
 ! output sort
 $ $SG_TEST_EXENV parallel_task/test_ptask$EXEEXT ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/parallel_task/test_ptask_deployment.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > [ 20.625396] (1:execute@Ginette) execution_time=20.6254 
 > [ 83.232398] (2:redistribute@Ginette) redistribution_time=83.2324 
 > [ 83.232398] (0:@) Simulation time 83.2324
index dc0e965..93a6596 100644 (file)
@@ -38,7 +38,7 @@ int execute(int argc, char *argv[])
   XBT_DEBUG("host_list_size=%d", host_list_size);
   m_host_list = calloc(host_list_size, sizeof(msg_host_t));
   for (i = 1; i <= host_list_size; i++) {
-    m_host_list[i - 1] = MSG_get_host_by_name(argv[i]);
+    m_host_list[i - 1] = MSG_host_by_name(argv[i]);
     xbt_assert(m_host_list[i - 1] != NULL,
                 "Unknown host %s. Stopping Now! ", argv[i]);
   }
@@ -94,7 +94,7 @@ int redistribute(int argc, char *argv[])
   XBT_DEBUG("host_list_size=%d", host_list_size);
   m_host_list = calloc(host_list_size, sizeof(msg_host_t));
   for (i = 1; i <= host_list_size; i++) {
-    m_host_list[i - 1] = MSG_get_host_by_name(argv[i]);
+    m_host_list[i - 1] = MSG_host_by_name(argv[i]);
     xbt_assert(m_host_list[i - 1] != NULL,
                 "Unknown host %s. Stopping Now! ", argv[i]);
   }
index d460550..74af332 100644 (file)
@@ -37,7 +37,7 @@ msg_error_t test_all(const char *platform_file,
 
 static void test_host(const char*hostname) 
 {
-  msg_host_t thehost = MSG_get_host_by_name(hostname);
+  msg_host_t thehost = MSG_host_by_name(hostname);
   xbt_dict_t props = MSG_host_get_properties(thehost);
   xbt_dict_cursor_t cursor = NULL;
   char *key, *data;
index 1046db4..6e5c1cc 100644 (file)
@@ -48,7 +48,7 @@ int sender(int argc, char *argv[])
 
   XBT_INFO("host = %s", argv[1]);
 
-  host = MSG_get_host_by_name(argv[1]);
+  host = MSG_host_by_name(argv[1]);
 
   if (host == NULL) {
     XBT_INFO("Unknown host %s. Stopping Now! ", argv[1]);
index 94562ac..021a664 100644 (file)
@@ -37,7 +37,7 @@ static int emigrant(int argc, char *argv[])
     destination = (char*)MSG_task_get_data (task);
     MSG_task_destroy (task);
     if (!destination) break; //there is no destination, die
-    MSG_process_migrate(MSG_process_self(), MSG_get_host_by_name(destination));
+    MSG_process_migrate(MSG_process_self(), MSG_host_by_name(destination));
     MSG_process_sleep(2); // I am tired, have to sleep for 2 seconds
     free (destination);
     task = NULL;
index 5af0a70..2878170 100644 (file)
@@ -3,7 +3,7 @@ p Test the DAX loader with a DAX comprising a cycle.
 
 ! expect return 255
 $ $SG_TEST_EXENV ./dax_test --log=no_loc ${srcdir:=.}/../2clusters.xml ${srcdir:=.}/simple_dax_with_cycle.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [sd_daxparse/WARNING] the task root is not marked
 > [0.000000] [sd_daxparse/WARNING] the task 1@task1 is in a cycle
 > [0.000000] [sd_daxparse/WARNING] the task 2@task2 is in a cycle
index 57297a4..92908c9 100644 (file)
@@ -2,7 +2,7 @@
 p Test the DAX loader on a small DAX instance
 
 $ $SG_TEST_EXENV ${bindir:=.}/dax_test --log=no_loc ../2clusters.xml ./smalldax.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [sd_daxparse/WARNING] Ignoring file o1 size redefinition from 1000000 to 304
 > [0.000000] [sd_daxparse/WARNING] Ignoring file o2 size redefinition from 1000000 to 304
 > [0.000000] [test/INFO] ------------------- Display all tasks of the loaded DAG ---------------------------
index 79b64fd..2b8a811 100644 (file)
@@ -2,7 +2,7 @@
 p Test the loader of DAG written in the DOT format
 
 $ $SG_TEST_EXENV ./dot_test --log=no_loc ${srcdir:=.}/../2clusters.xml ${srcdir:=.}/dag.dot
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [test/INFO] ------------------- Display all tasks of the loaded DAG ---------------------------
 > [0.000000] [sd_task/INFO] Displaying task root
 > [0.000000] [sd_task/INFO]   - state:  schedulable  not runnable    
@@ -235,7 +235,7 @@ $ rm -f dag.trace
 
 ! expect return 2
 $ $SG_TEST_EXENV ./simulate_dot --log=no_loc  "--log=sd_dotparse.thres:verbose" ${srcdir:=.}/../2clusters.xml ${srcdir:=.}/dag_with_bad_schedule.dot
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [sd_dotparse/VERBOSE] The schedule is ignored, the task end is not correctly scheduled
 > [0.000000] [sd_dotparse/VERBOSE] The schedule is ignored, the task 1 is not correctly scheduled
 > [0.000000] [sd_dotparse/VERBOSE] The task 0 starts on the computer 1 at the position : 1 like the task 2
@@ -245,7 +245,7 @@ $ $SG_TEST_EXENV ./simulate_dot --log=no_loc  "--log=sd_dotparse.thres:verbose"
 > [0.000000] [test/CRITICAL] The dot file with the provided scheduling is wrong, more information with the option : --log=sd_dotparse.thres:verbose
 
 $ $SG_TEST_EXENV ./simulate_dot --log=no_loc ${srcdir:=.}/../2clusters.xml ${srcdir:=.}/dag_with_good_schedule.dot
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [test/INFO] ------------------- Display all tasks of the loaded DAG ---------------------------
 > [0.000000] [sd_task/INFO] Displaying task root
 > [0.000000] [sd_task/INFO]   - state:    runnable    
@@ -493,7 +493,7 @@ $ rm -f ${srcdir:=.}/dag_with_good_schedule.trace
 
 ! expect return 2
 $ $SG_TEST_EXENV ./dot_test --log=no_loc ${srcdir:=.}/../2clusters.xml ${srcdir:=.}/dag_with_cycle.dot
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [sd_daxparse/WARNING] the task root is not marked
 > [0.000000] [sd_daxparse/WARNING] the task 0 is in a cycle
 > [0.000000] [sd_daxparse/WARNING] the task 1 is in a cycle
index 1a7eca6..7c969a5 100755 (executable)
@@ -3,7 +3,7 @@
 p Simple test of simdag with properties
 
 $ $SG_TEST_EXENV properties/sd_prop ${srcdir:=.}/../platforms/prop.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [test/INFO] Property list for workstation host1
 > [0.000000] [test/INFO]       Property: mem has value: 4
 > [0.000000] [test/INFO]       Property: NewProp has value: newValue
index 5734d51..4c51b10 100644 (file)
@@ -3,7 +3,7 @@
 p Simple test of simdag
 
 $ $SG_TEST_EXENV ${bindir:=.}/minmin_test --log=sd_daxparse.thresh:critical ${srcdir:=.}/simulacrum_7_hosts.xml ${srcdir:=.}/Montage_25.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [test/INFO] Schedule ID00002@mProjectPP on Host 27
 > [0.000105] [test/INFO] Schedule ID00000@mProjectPP on Host 26
 > [0.000120] [test/INFO] Schedule ID00003@mProjectPP on Host 30
index 0ad23c9..d81c786 100644 (file)
@@ -3,7 +3,7 @@
 p Simple test of simdag
 
 $ $SG_TEST_EXENV ./sd_test ${srcdir:=.}/../platforms/platform.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [sd_test/INFO] Computation time for 2000000.000000 flops on Jacquelin: 0.014563
 > [0.000000] [sd_test/INFO] Computation time for 1000000.000000 flops on Intel: 0.007282
 > [0.000000] [sd_test/INFO] Route between Jacquelin and Intel:
index 3c7bad8..471e20e 100644 (file)
@@ -3,5 +3,5 @@
 p Simple test of simdag
 
 $ $SG_TEST_EXENV ./sd_test2 ${srcdir:=.}/2clusters.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [3.251960] [sd_test/INFO] Simulation time: 3.251960
index f2782ac..87134ea 100644 (file)
@@ -3,7 +3,7 @@
 p Test of the management of availability traces with simdag
 
 $ $SG_TEST_EXENV ${bindir:=.}/sd_avail two_hosts.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [1.000000] [sd_avail/INFO] link1: bw=125000000, lat=0.000100
 > [1.000000] [sd_avail/INFO] Jupiter: power=12500000
 > [1.000000] [sd_avail/INFO] Tremblay: power=12500000
index e36f2c7..9136658 100644 (file)
@@ -3,7 +3,7 @@ p Modify the rate of communication tasks even when they are auto-scheduled
 
 $ $SG_TEST_EXENV ./sd_comm_throttling --cfg=network/TCP_gamma:4194304 ${srcdir:=.}/2clusters.xml
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [1.000000] [sd_comm_throttling/INFO] Simulation stopped after 1.0000 seconds
 > [1.000000] [sd_comm_throttling/INFO] Task 'Task A' start time: 0.000000, finish time: 1.000000
 > [2.080300] [sd_comm_throttling/INFO] Simulation stopped after 2.0803 seconds
index 77ca4cc..6990010 100644 (file)
@@ -3,7 +3,7 @@
 p Test of the management of failed tasks simdag
 
 $ $SG_TEST_EXENV ${bindir:=.}/sd_fail
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [sd_fail/INFO] First test: COMP_SEQ task
 > [0.000000] [sd_fail/INFO] Schedule task 'Poor task' on workstation 'Faulty Host'
 > [10.000000] [sd_task/INFO] Displaying task Poor task
index 0c9e7db..6b6eb66 100644 (file)
@@ -3,7 +3,7 @@
 p Simple test of simdag
 
 $ $SG_TEST_EXENV ./sd_seq_access ${srcdir:=.}/2clusters.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [sd_workstation/INFO] Displaying workstation C2-05
 > [0.000000] [sd_workstation/INFO]   - power: 5000000000
 > [0.000000] [sd_workstation/INFO]   - available power: 1.00
index e9da676..8c50b9f 100644 (file)
@@ -6,7 +6,7 @@ p Simple test of simdag
 $ $SG_TEST_EXENV ./simdag_tracing --cfg=tracing:yes --cfg=tracing/categorized:yes ${srcdir:=.}/2clusters.xml
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/categorized' to 'yes'
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [0.000000] [sd_seq_access/INFO] Access mode of C2-05 is sequential
 > [0.000000] [sd_seq_access/INFO] Access mode of C2-06 is sequential
 > [0.000000] [sd_seq_access/INFO] Task A is currently running on C2-05 (SD_TASK_COMP_SEQ)
index 3199f80..69a2b64 100644 (file)
@@ -3,7 +3,7 @@ p Usage test of simdag's typed tasks
 
 $ $SG_TEST_EXENV ./sd_typed_tasks_test --cfg=network/TCP_gamma:4194304 ${srcdir:=.}/2clusters.xml
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > [2.080300] [sd_typed_tasks_test/INFO] Task 'Seq. comp. 1' start time: 0.000000, finish time: 1.000000
 > [2.080300] [sd_typed_tasks_test/INFO] Task 'Par. Comp. 1' start time: 0.000000, finish time: 0.080000
 > [2.080300] [sd_typed_tasks_test/INFO] Task 'Par. Comp. 3' start time: 0.000000, finish time: 0.400000
index e46e72b..3a407d8 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef SIMGRID_DATATYPES_H_
 #define SIMGRID_DATATYPES_H_
 
-typedef struct ws_params {
+typedef struct vm_params {
   int ncpus;
   sg_size_t ramsize;
   int overcommit;
@@ -24,6 +24,6 @@ typedef struct ws_params {
 
   /* set migration speed */
   double mig_speed;
-} s_ws_params_t, *ws_params_t;
+} s_vm_params_t, *vm_params_t;
 
 #endif /* SIMGRID_DATATYPES_H_ */
diff --git a/include/simgrid/host.h b/include/simgrid/host.h
new file mode 100644 (file)
index 0000000..fd0c576
--- /dev/null
@@ -0,0 +1,66 @@
+/* Copyright (c) 2013-2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_HOST_H_
+#define SIMGRID_HOST_H_
+
+#include <xbt/dict.h>
+#include <xbt/dynar.h>
+SG_BEGIN_DECL()
+
+typedef xbt_dictelm_t sg_host_t;
+XBT_PUBLIC(sg_host_t) sg_host_by_name(const char *name);
+XBT_PUBLIC(sg_host_t) sg_host_by_name_or_create(const char *name);
+static XBT_INLINE char *sg_host_get_name(sg_host_t host){
+       return host->key;
+}
+XBT_PUBLIC(xbt_dynar_t) sg_hosts_as_dynar(void);
+
+#ifdef __cplusplus
+#define DEFINE_EXTERNAL_CLASS(klass) class klass;
+class Cpu;
+#else
+#define DEFINE_EXTERNAL_CLASS(klass) typedef struct klass klass;
+#endif
+
+// ========== MSG Layer ==============
+typedef struct s_msg_host_priv *msg_host_priv_t;
+msg_host_priv_t sg_host_msg(sg_host_t host);
+XBT_PUBLIC(void) sg_host_msg_set(sg_host_t host, msg_host_priv_t priv);
+XBT_PUBLIC(void) sg_host_msg_destroy(sg_host_t host);
+
+// ========== SD Layer ==============
+typedef struct SD_workstation *SD_workstation_priv_t;
+SD_workstation_priv_t sg_host_sd(sg_host_t host);
+XBT_PUBLIC(void) sg_host_sd_set(sg_host_t host, SD_workstation_priv_t priv);
+XBT_PUBLIC(void) sg_host_sd_destroy(sg_host_t host);
+
+// ========== Simix layer =============
+typedef struct s_smx_host_priv *smx_host_priv_t;
+XBT_PUBLIC(smx_host_priv_t) sg_host_simix(sg_host_t host);
+XBT_PUBLIC(void) sg_host_simix_set(sg_host_t host, smx_host_priv_t priv);
+XBT_PUBLIC(void) sg_host_simix_destroy(sg_host_t host);
+
+// ========== SURF CPU ============
+DEFINE_EXTERNAL_CLASS(Cpu);
+typedef Cpu *surf_cpu_t;
+XBT_PUBLIC(surf_cpu_t) sg_host_surfcpu(sg_host_t host);
+XBT_PUBLIC(void) sg_host_surfcpu_set(sg_host_t host, surf_cpu_t cpu);
+XBT_PUBLIC(void) sg_host_surfcpu_destroy(sg_host_t host);
+
+// ========== RoutingEdge ============
+DEFINE_EXTERNAL_CLASS(RoutingEdge);
+XBT_PUBLIC(RoutingEdge*) sg_host_edge(sg_host_t host);
+XBT_PUBLIC(void) sg_host_edge_set(sg_host_t host, RoutingEdge* edge);
+XBT_PUBLIC(void) sg_host_edge_destroy(sg_host_t host, int do_callback);
+
+
+// Module initializer. Won't survive the conversion to C++. Hopefully.
+XBT_PUBLIC(void) sg_host_init(void);
+
+SG_END_DECL()
+
+#endif /* SIMGRID_HOST_H_ */
diff --git a/include/simgrid/link.h b/include/simgrid/link.h
new file mode 100644 (file)
index 0000000..8a81bb9
--- /dev/null
@@ -0,0 +1,34 @@
+/* Public interface to the Link datatype                                    */
+
+/* Copyright (c) 2015. The SimGrid Team. All rights reserved.               */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef INCLUDE_SIMGRID_LINK_H_
+#define INCLUDE_SIMGRID_LINK_H_
+
+
+#ifdef __cplusplus
+class Link;
+#else
+typedef struct Link Link;
+#endif
+
+
+
+/* C interface */
+SG_BEGIN_DECL()
+XBT_PUBLIC(const char*) sg_link_name(Link *link);
+XBT_PUBLIC(Link *) sg_link_by_name(const char *name);
+XBT_PUBLIC(int) sg_link_is_shared(Link *link);
+XBT_PUBLIC(double) sg_link_bandwidth(Link *link);
+XBT_PUBLIC(double) sg_link_latency(Link *link);
+XBT_PUBLIC(void*) sg_link_data(Link *link);
+XBT_PUBLIC(void) sg_link_data_set(Link *link,void *data);
+XBT_PUBLIC(int) sg_link_amount(void);
+XBT_PUBLIC(Link**) sg_link_list(void);
+XBT_PUBLIC(void) sg_link_exit(void);
+SG_END_DECL()
+
+#endif /* INCLUDE_SIMGRID_LINK_H_ */
index 15b877d..53e1214 100644 (file)
@@ -6,33 +6,45 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+/** \file modelchecker.h
+ *
+ *  This is the API used by the user simulated program to communicate
+ *  with the MC.
+ */
+
+#ifndef SIMGRID_MODELCHECKER_H
+#define SIMGRID_MODELCHECKER_H
+
 #include <stdbool.h>
 
 #include <simgrid_config.h> /* HAVE_MC ? */
 #include <xbt.h>
 #include "xbt/automaton.h"
 
-#ifndef SIMGRID_MODELCHECKER_H
-#define SIMGRID_MODELCHECKER_H
-
 SG_BEGIN_DECL()
 
 XBT_PUBLIC(int) MC_random(int min, int max);
 
 #ifdef HAVE_MC
 
-extern int _sg_do_model_check; /* please don't use directly: we inline MC_is_active, but that's what you should use */
+/* Internal variable used to check if we're running under the MC
+ *
+ * Please don't use directly: you should use MC_is_active. */
+extern int _sg_do_model_check;
 extern int _sg_mc_visited;
 
 #define MC_is_active()                  _sg_do_model_check
 #define MC_visited_reduction()          _sg_mc_visited
 
+/** Assertion for the model-checker
+ *
+ *  This function is used to define safety properties to verify.
+ */
 XBT_PUBLIC(void) MC_assert(int);
+
 XBT_PUBLIC(void) MC_automaton_new_propositional_symbol(const char* id, int(*fct)(void));
 XBT_PUBLIC(void) MC_automaton_new_propositional_symbol_pointer(const char *id, int* value);
-XBT_PUBLIC(void) MC_automaton_new_propositional_symbol_callback(const char* id,
-  xbt_automaton_propositional_symbol_callback_type callback,
-  void* data, xbt_automaton_propositional_symbol_free_function_type free_function);
+
 XBT_PUBLIC(void *) MC_snapshot(void);
 XBT_PUBLIC(int) MC_compare_snapshots(void *s1, void *s2);
 XBT_PUBLIC(void) MC_cut(void);
@@ -46,8 +58,6 @@ XBT_PUBLIC(void) MC_ignore(void *addr, size_t size);
 #define MC_assert(a)                    xbt_assert(a)
 #define MC_automaton_new_propositional_symbol(a, b) ((void)0)
 #define MC_automaton_new_propositional_symbol_pointer(a, b) ((void)0)
-#define MC_automaton_new_propositional_symbol_callback(id,callback,data,free_function) \
-  if(free_function) free_function(data);
 #define MC_snapshot()                   ((void*)0)
 #define MC_compare_snapshots(a, b)      0
 #define MC_cut()                        ((void)0)
index f04ce91..7fd3357 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2014. The SimGrid Team.
+/* Copyright (c) 2004-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -33,8 +33,6 @@ typedef struct As *msg_as_t;
 
 /* ******************************** Host ************************************ */
 
-XBT_PUBLIC_DATA(int) MSG_HOST_LEVEL;
-
 /** @brief Host datatype.
     @ingroup m_host_management
 
@@ -45,9 +43,9 @@ XBT_PUBLIC_DATA(int) MSG_HOST_LEVEL;
     some <em>private data</em> that can be only accessed by local
     process.
  */
-typedef xbt_dictelm_t msg_host_t;
+typedef sg_host_t msg_host_t;
 
-typedef struct msg_host_priv {
+typedef struct s_msg_host_priv {
   int        dp_enabled;
   xbt_dict_t dp_objs;
   double     dp_updated_by_deleted_tasks;
@@ -58,13 +56,7 @@ typedef struct msg_host_priv {
 #ifdef MSG_USE_DEPRECATED
   msg_mailbox_t *mailboxes;     /**< the channels  */
 #endif
-} s_msg_host_priv_t, *msg_host_priv_t;
-
-static inline msg_host_priv_t MSG_host_priv(msg_host_t host){
-  return (msg_host_priv_t )xbt_lib_get_level(host, MSG_HOST_LEVEL);
-}
-
-
+} s_msg_host_priv_t;
 
 /* ******************************** Task ************************************ */
 
@@ -89,11 +81,6 @@ typedef struct msg_task *msg_task_t;
 
 /* ******************************** VM ************************************* */
 typedef msg_host_t msg_vm_t;
-typedef msg_host_priv_t msg_vm_priv_t;
-
-static inline msg_vm_priv_t MSG_vm_priv(msg_vm_t vm){
-  return (msg_vm_priv_t) xbt_lib_get_level(vm, MSG_HOST_LEVEL);
-}
 
 /** ******************************** File ************************************ */
 
@@ -234,16 +221,10 @@ XBT_PUBLIC(void) MSG_config(const char *key, const char *value);
  *
  *  We allow to link against compiled versions that differ in the patch level.
  */
-#define MSG_init(argc,argv)  {                                          \
-    int ver_major,ver_minor,ver_patch;                                  \
-    sg_version(&ver_major,&ver_minor,&ver_patch);                       \
-    if ((ver_major != SIMGRID_VERSION_MAJOR) ||                         \
-        (ver_minor != SIMGRID_VERSION_MINOR)) {                         \
-      fprintf(stderr,"FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, and then linked against SimGrid %d.%d.%d. Please fix this.\n", \
-              SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,ver_major,ver_minor,ver_patch); \
-    }                                                                   \
-    MSG_init_nocheck(argc,argv);                                        \
-  }
+#define MSG_init(argc,argv)  do {                                                          \
+       sg_version_check(SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH);\
+    MSG_init_nocheck(argc,argv);                                                        \
+  } while (0)
 
 XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv);
 XBT_PUBLIC(msg_error_t) MSG_main(void);
@@ -288,7 +269,6 @@ XBT_PUBLIC(msg_error_t) MSG_file_move(msg_file_t fd, const char* fullpath);
 XBT_PUBLIC(msg_error_t) MSG_file_rcopy(msg_file_t fd, msg_host_t host, const char* fullpath);
 XBT_PUBLIC(msg_error_t) MSG_file_rmove(msg_file_t fd, msg_host_t host, const char* fullpath);
 /************************** Storage handling ***********************************/
-XBT_PUBLIC(msg_host_t) MSG_get_storage_by_name(const char *name);
 XBT_PUBLIC(const char *) MSG_storage_get_name(msg_storage_t storage);
 XBT_PUBLIC(sg_size_t) MSG_storage_get_free_size(msg_storage_t storage);
 XBT_PUBLIC(sg_size_t) MSG_storage_get_used_size(msg_storage_t storage);
@@ -309,6 +289,8 @@ XBT_PUBLIC(xbt_dict_t) MSG_as_router_get_properties(const char* asr);
 XBT_PUBLIC(void) MSG_as_router_set_property_value(const char* asr, const char *name, char *value,void_f_pvoid_t free_ctn);
 
 /************************** Host handling ***********************************/
+XBT_PUBLIC(msg_host_t) MSG_host_by_name(const char *name);
+#define MSG_get_host_by_name(n) MSG_host_by_name(n) /* Rewrite the old name into the new one transparently */
 XBT_PUBLIC(msg_error_t) MSG_host_set_data(msg_host_t host, void *data);
 XBT_PUBLIC(void *) MSG_host_get_data(msg_host_t host);
 XBT_PUBLIC(const char *) MSG_host_get_name(msg_host_t host);
@@ -324,7 +306,6 @@ XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h);
 XBT_PUBLIC(double) MSG_host_get_wattmin_at(msg_host_t host, int pstate);
 XBT_PUBLIC(double) MSG_host_get_wattmax_at(msg_host_t host, int pstate);
 
-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_host_get_power_peak_at(msg_host_t h, int pstate);
@@ -332,6 +313,13 @@ XBT_PUBLIC(double) MSG_host_get_current_power_peak(msg_host_t h);
 XBT_PUBLIC(int)    MSG_host_get_nb_pstates(msg_host_t h);
 XBT_PUBLIC(void)   MSG_host_set_pstate(msg_host_t h, int pstate);
 XBT_PUBLIC(int)    MSG_host_get_pstate(msg_host_t host);
+XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
+XBT_PUBLIC(int) MSG_get_host_number(void);
+XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, vm_params_t params);
+XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, vm_params_t params);
+XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
+XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host);
+XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
 
 XBT_PUBLIC(double) MSG_host_get_consumed_energy(msg_host_t h);
 
@@ -346,14 +334,6 @@ XBT_PUBLIC(void) MSG_host_set_property_value(msg_host_t host,
 
 XBT_PUBLIC(void) MSG_create_environment(const char *file);
 
-XBT_PUBLIC(msg_host_t) MSG_get_host_by_name(const char *name);
-XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
-XBT_PUBLIC(int) MSG_get_host_number(void);
-XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, ws_params_t params);
-XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, ws_params_t params);
-XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
-XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host);
-XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
 /************************** Process handling *********************************/
 XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
                                            xbt_main_func_t code,
index 580cb27..8a0a95f 100644 (file)
@@ -10,6 +10,7 @@
 #define SG_PLATF_H
 
 #include <xbt.h>
+#include <simgrid/host.h>
 
 SG_BEGIN_DECL()
 
@@ -81,7 +82,6 @@ XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_weibull(const
                                                                            double scale,
                                                                            double shape);
 
-typedef xbt_dictelm_t sg_host_t;
 static inline char* sg_host_name(sg_host_t host) {
   return host->key;
 }
index adcc3a0..68d6963 100644 (file)
@@ -11,6 +11,7 @@
 #include "xbt/dynar.h"
 #include "xbt/dict.h"
 
+#include "simgrid/link.h"
 
 SG_BEGIN_DECL()
 /** @brief Workstation datatype
@@ -38,11 +39,6 @@ typedef enum {
   SD_WORKSTATION_SEQUENTIAL_ACCESS  /**< @brief Only one task can be executed, the others wait in a FIFO. */
 } e_SD_workstation_access_mode_t;
 
-typedef enum {
-  SD_LINK_SHARED,
-  SD_LINK_FATPIPE
-} e_SD_link_sharing_policy_t;
-
 /** @brief Link datatype
     @ingroup SD_datatypes_management
 
@@ -51,7 +47,7 @@ typedef enum {
     links between two workstations.
 
     @see SD_link_management */
-typedef struct SD_link *SD_link_t;
+typedef Link *SD_link_t;
 
 /** @brief Task datatype
     @ingroup SD_datatypes_management
@@ -121,14 +117,42 @@ XBT_PUBLIC(const char*) SD_as_router_get_property_value(const char * as,
  *  @{
  */
 XBT_PUBLIC(const SD_link_t *) SD_link_get_list(void);
-XBT_PUBLIC(int) SD_link_get_number(void);
-XBT_PUBLIC(void *) SD_link_get_data(SD_link_t link);
-XBT_PUBLIC(void) SD_link_set_data(SD_link_t link, void *data);
-XBT_PUBLIC(const char *) SD_link_get_name(SD_link_t link);
-XBT_PUBLIC(double) SD_link_get_current_bandwidth(SD_link_t link);
-XBT_PUBLIC(double) SD_link_get_current_latency(SD_link_t link);
-XBT_PUBLIC(e_SD_link_sharing_policy_t) SD_link_get_sharing_policy(SD_link_t
-                                                                  link);
+/** @brief Returns the number of links in the whole platform */
+static inline int SD_link_get_number(void) {
+  return sg_link_amount();
+}
+
+/** @brief Returns the user data of a link */
+static inline void *SD_link_get_data(SD_link_t link) {
+  return sg_link_data(link);
+}
+
+/** @brief Sets the user data of a link
+ *
+ * The new data can be \c NULL. The old data should have been freed first
+ * if it was not \c NULL.
+ */
+static inline void SD_link_set_data(SD_link_t link, void *data) {
+       sg_link_data_set(link, data);
+}
+/** @brief Returns the name of a link  */
+static inline const char *SD_link_get_name(SD_link_t link) {
+  return sg_link_name(link);
+}
+/** @brief Returns the current bandwidth of a link (in bytes per second) */
+static inline double SD_link_get_current_bandwidth(SD_link_t link) {
+  return sg_link_bandwidth(link);
+}
+/** @brief Returns the current latency of a link (in seconds) */
+static inline double SD_link_get_current_latency(SD_link_t link){
+  return sg_link_latency(link);
+}
+/** @brief Returns the sharing policy of this workstation.
+ *  @return true if the link is shared, and false if it's a fatpipe
+ */
+static inline int SD_link_is_shared(SD_link_t link) {
+  return sg_link_is_shared(link);
+}
 /** @} */
 
 /************************** Workstation handling ****************************/
index c16e39d..6bc2e58 100644 (file)
@@ -15,6 +15,7 @@
 #include "xbt/swag.h"
 #include "simgrid/platf.h"
 #include "simgrid/datatypes.h"
+#include "simgrid/host.h"
 
 SG_BEGIN_DECL()
 
@@ -35,8 +36,6 @@ typedef union u_smx_scalar u_smx_scalar_t;
 
     \see m_host_management
   @{ */
-typedef xbt_dictelm_t smx_host_t;
-typedef struct s_smx_host_priv *smx_host_priv_t;
 typedef enum {
   SIMIX_WAITING,
   SIMIX_READY,
@@ -80,7 +79,7 @@ typedef struct s_smx_synchro *smx_synchro_t; /* FIXME: replace by specialized sy
 /** @brief Process datatype
     @ingroup simix_process_management
 
-    A processt may be defined as a <em>code</em>, with some <em>private
+    A process may be defined as a <em>code</em>, with some <em>private
     data</em>, executing in a <em>location</em>.
     \see m_process_management
   @{ */
@@ -99,11 +98,11 @@ typedef enum {
  * const char *name: a name for the object. It is for user-level information and can be NULL
  * xbt_main_func_t code: is a function describing the behavior of the process
  * void *data: data a pointer to any data one may want to attach to the new object.
- * smx_host_t host: the location where the new process is executed
+ * sg_host_t host: the location where the new process is executed
  * int argc, char **argv: parameters passed to code
  * xbt_dict_t pros: properties
  */
-typedef void (*smx_creation_func_t) ( /* process */ smx_process_t*,
+typedef smx_process_t (*smx_creation_func_t) (
                                       /* name */ const char*,
                                       /* code */ xbt_main_func_t,
                                       /* userdata */ void*,
@@ -134,7 +133,7 @@ typedef void (*void_pfn_smxprocess_t) (smx_process_t);
 /* Process kill */
 typedef void (*void_pfn_smxprocess_t_smxprocess_t) (smx_process_t, smx_process_t);
 /* for auto-restart function */
-typedef void (*void_pfn_smxhost_t) (smx_host_t);
+typedef void (*void_pfn_sghost_t) (sg_host_t);
 
 /* The following function pointer types describe the interface that any context
    factory should implement */
@@ -260,16 +259,14 @@ XBT_PUBLIC(void) SIMIX_process_set_function(const char* process_host,
                                             double process_kill_time);
 
 /*********************************** Host *************************************/
-//XBT_PUBLIC(xbt_dict_t) SIMIX_host_get_dict(u_smx_scalar_t *args);
-XBT_PUBLIC(smx_host_t) SIMIX_host_get_by_name(const char *name);
-XBT_PUBLIC(smx_host_t) SIMIX_host_self(void);
+XBT_PUBLIC(sg_host_t) SIMIX_host_self(void);
 XBT_PUBLIC(const char*) SIMIX_host_self_get_name(void);
 #define SIMIX_host_get_name(h) sg_host_name(h)  /* DEPRECATED: SIMIX_host_get_name */
-XBT_PUBLIC(void) SIMIX_host_on(smx_host_t host);
-XBT_PUBLIC(void) SIMIX_host_off(smx_host_t host, smx_process_t issuer);
+XBT_PUBLIC(void) SIMIX_host_on(sg_host_t host);
+XBT_PUBLIC(void) SIMIX_host_off(sg_host_t host, smx_process_t issuer);
 XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
 XBT_PUBLIC(void*) SIMIX_host_self_get_data(void);
-XBT_PUBLIC(xbt_dict_t) SIMIX_host_get_mounted_storage_list(smx_host_t host);
+XBT_PUBLIC(xbt_dict_t) SIMIX_host_get_mounted_storage_list(sg_host_t host);
 /********************************* Process ************************************/
 XBT_PUBLIC(int) SIMIX_process_count(void);
 XBT_PUBLIC(smx_process_t) SIMIX_process_self(void);
@@ -300,75 +297,73 @@ XBT_PUBLIC(void) SIMIX_comm_finish(smx_synchro_t synchro);
 /******************************************************************************/
 
 /******************************* Host simcalls ********************************/
-/* TODO use handlers and keep smx_host_t hidden from higher levels */
-XBT_PUBLIC(smx_host_t) simcall_host_get_by_name(const char *name);
-XBT_PUBLIC(const char *) simcall_host_get_name(smx_host_t host);
-XBT_PUBLIC(xbt_dict_t) simcall_host_get_properties(smx_host_t host);
-XBT_PUBLIC(void) simcall_host_on(smx_host_t host);
-XBT_PUBLIC(void) simcall_host_off(smx_host_t host);
-XBT_PUBLIC(int) simcall_host_get_core(smx_host_t host);
-XBT_PUBLIC(xbt_swag_t) simcall_host_get_process_list(smx_host_t host);
-XBT_PUBLIC(double) simcall_host_get_speed(smx_host_t host);
-XBT_PUBLIC(double) simcall_host_get_available_speed(smx_host_t host);
+/* TODO use handlers and keep sg_host_t hidden from higher levels */
+XBT_PUBLIC(const char *) simcall_host_get_name(sg_host_t host);
+XBT_PUBLIC(xbt_dict_t) simcall_host_get_properties(sg_host_t host);
+XBT_PUBLIC(void) simcall_host_on(sg_host_t host);
+XBT_PUBLIC(void) simcall_host_off(sg_host_t host);
+XBT_PUBLIC(int) simcall_host_get_core(sg_host_t host);
+XBT_PUBLIC(xbt_swag_t) simcall_host_get_process_list(sg_host_t host);
+XBT_PUBLIC(double) simcall_host_get_speed(sg_host_t host);
+XBT_PUBLIC(double) simcall_host_get_available_speed(sg_host_t host);
 /* Two possible states, 1 - CPU ON and 0 CPU OFF */
-XBT_PUBLIC(int) simcall_host_get_state(smx_host_t host);
-XBT_PUBLIC(void *) simcall_host_get_data(smx_host_t host);
+XBT_PUBLIC(int) simcall_host_get_state(sg_host_t host);
+XBT_PUBLIC(void *) simcall_host_get_data(sg_host_t host);
 
-XBT_PUBLIC(void) simcall_host_set_data(smx_host_t host, void *data);
+XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data);
 
-XBT_PUBLIC(double) simcall_host_get_current_power_peak(smx_host_t host);
-XBT_PUBLIC(double) simcall_host_get_power_peak_at(smx_host_t host, int pstate_index);
-XBT_PUBLIC(int) simcall_host_get_nb_pstates(smx_host_t host);
-XBT_PUBLIC(void) simcall_host_set_pstate(smx_host_t host, int pstate_index);
-XBT_PUBLIC(int) simcall_host_get_pstate(smx_host_t host);
-XBT_PUBLIC(double) simcall_host_get_consumed_energy(smx_host_t host);
-XBT_PUBLIC(double) simcall_host_get_wattmin_at(smx_host_t host, int pstate);
-XBT_PUBLIC(double) simcall_host_get_wattmax_at(smx_host_t host, int pstate);
+XBT_PUBLIC(double) simcall_host_get_current_power_peak(sg_host_t host);
+XBT_PUBLIC(double) simcall_host_get_power_peak_at(sg_host_t host, int pstate_index);
+XBT_PUBLIC(int) simcall_host_get_nb_pstates(sg_host_t host);
+XBT_PUBLIC(void) simcall_host_set_pstate(sg_host_t host, int pstate_index);
+XBT_PUBLIC(int) simcall_host_get_pstate(sg_host_t host);
+XBT_PUBLIC(double) simcall_host_get_consumed_energy(sg_host_t host);
+XBT_PUBLIC(double) simcall_host_get_wattmin_at(sg_host_t host, int pstate);
+XBT_PUBLIC(double) simcall_host_get_wattmax_at(sg_host_t host, int pstate);
 
-XBT_PUBLIC(smx_synchro_t) simcall_host_execute(const char *name, smx_host_t host,
+XBT_PUBLIC(smx_synchro_t) simcall_process_execute(const char *name,
                                                 double flops_amount,
                                                 double priority, double bound, unsigned long affinity_mask);
-XBT_PUBLIC(smx_synchro_t) simcall_host_parallel_execute(const char *name,
+XBT_PUBLIC(smx_synchro_t) simcall_process_parallel_execute(const char *name,
                                                      int host_nb,
-                                                     smx_host_t *host_list,
+                                                     sg_host_t *host_list,
                                                      double *flops_amount,
                                                      double *bytes_amount,
                                                      double amount,
                                                      double rate);
-XBT_PUBLIC(void) simcall_host_execution_destroy(smx_synchro_t execution);
-XBT_PUBLIC(void) simcall_host_execution_cancel(smx_synchro_t execution);
-XBT_PUBLIC(double) simcall_host_execution_get_remains(smx_synchro_t execution);
-XBT_PUBLIC(e_smx_state_t) simcall_host_execution_get_state(smx_synchro_t execution);
-XBT_PUBLIC(void) simcall_host_execution_set_priority(smx_synchro_t execution, double priority);
-XBT_PUBLIC(void) simcall_host_execution_set_bound(smx_synchro_t execution, double bound);
-XBT_PUBLIC(void) simcall_host_execution_set_affinity(smx_synchro_t execution, smx_host_t host, unsigned long mask);
-XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_synchro_t execution);
-XBT_PUBLIC(xbt_dict_t) simcall_host_get_mounted_storage_list(smx_host_t host);
-XBT_PUBLIC(xbt_dynar_t) simcall_host_get_attached_storage_list(smx_host_t host);
-XBT_PUBLIC(void) simcall_host_get_params(smx_host_t vm, ws_params_t param);
-XBT_PUBLIC(void) simcall_host_set_params(smx_host_t vm, ws_params_t param);
+XBT_PUBLIC(void) simcall_process_execution_destroy(smx_synchro_t execution);
+XBT_PUBLIC(void) simcall_process_execution_cancel(smx_synchro_t execution);
+XBT_PUBLIC(double) simcall_process_execution_get_remains(smx_synchro_t execution);
+XBT_PUBLIC(e_smx_state_t) simcall_process_execution_get_state(smx_synchro_t execution);
+XBT_PUBLIC(void) simcall_process_execution_set_priority(smx_synchro_t execution, double priority);
+XBT_PUBLIC(void) simcall_process_execution_set_bound(smx_synchro_t execution, double bound);
+XBT_PUBLIC(void) simcall_process_execution_set_affinity(smx_synchro_t execution, sg_host_t host, unsigned long mask);
+XBT_PUBLIC(e_smx_state_t) simcall_process_execution_wait(smx_synchro_t execution);
+XBT_PUBLIC(xbt_dict_t) simcall_host_get_mounted_storage_list(sg_host_t host);
+XBT_PUBLIC(xbt_dynar_t) simcall_host_get_attached_storage_list(sg_host_t host);
+XBT_PUBLIC(void) simcall_host_get_params(sg_host_t vm, vm_params_t param);
+XBT_PUBLIC(void) simcall_host_set_params(sg_host_t vm, vm_params_t param);
 
 /******************************* VM simcalls ********************************/
 // Create the vm_workstation at the SURF level
-XBT_PUBLIC(void*) simcall_vm_create(const char *name, smx_host_t host);
-XBT_PUBLIC(int) simcall_vm_get_state(smx_host_t vm);
-XBT_PUBLIC(void) simcall_vm_start(smx_host_t vm);
-XBT_PUBLIC(void) simcall_vm_migrate(smx_host_t vm, smx_host_t dst_pm);
-XBT_PUBLIC(void *) simcall_vm_get_pm(smx_host_t vm);
-XBT_PUBLIC(void) simcall_vm_set_bound(smx_host_t vm, double bound);
-XBT_PUBLIC(void) simcall_vm_set_affinity(smx_host_t vm, smx_host_t pm, unsigned long mask);
-XBT_PUBLIC(void) simcall_vm_resume(smx_host_t vm);
-XBT_PUBLIC(void) simcall_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm);
-XBT_PUBLIC(void) simcall_vm_save(smx_host_t vm);
-XBT_PUBLIC(void) simcall_vm_restore(smx_host_t vm);
-XBT_PUBLIC(void) simcall_vm_suspend(smx_host_t vm);
-XBT_PUBLIC(void) simcall_vm_destroy(smx_host_t vm);
-XBT_PUBLIC(void) simcall_vm_shutdown(smx_host_t vm);
+XBT_PUBLIC(void*) simcall_vm_create(const char *name, sg_host_t host);
+XBT_PUBLIC(int) simcall_vm_get_state(sg_host_t vm);
+XBT_PUBLIC(void) simcall_vm_start(sg_host_t vm);
+XBT_PUBLIC(void) simcall_vm_migrate(sg_host_t vm, sg_host_t dst_pm);
+XBT_PUBLIC(void *) simcall_vm_get_pm(sg_host_t vm);
+XBT_PUBLIC(void) simcall_vm_set_bound(sg_host_t vm, double bound);
+XBT_PUBLIC(void) simcall_vm_set_affinity(sg_host_t vm, sg_host_t pm, unsigned long mask);
+XBT_PUBLIC(void) simcall_vm_resume(sg_host_t vm);
+XBT_PUBLIC(void) simcall_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm);
+XBT_PUBLIC(void) simcall_vm_save(sg_host_t vm);
+XBT_PUBLIC(void) simcall_vm_restore(sg_host_t vm);
+XBT_PUBLIC(void) simcall_vm_suspend(sg_host_t vm);
+XBT_PUBLIC(void) simcall_vm_destroy(sg_host_t vm);
+XBT_PUBLIC(void) simcall_vm_shutdown(sg_host_t vm);
 
 /**************************** Process simcalls ********************************/
 /* Constructor and Destructor */
-XBT_PUBLIC(void) simcall_process_create(smx_process_t *process,
-                                          const char *name,
+XBT_PUBLIC(smx_process_t) simcall_process_create(const char *name,
                                           xbt_main_func_t code,
                                           void *data,
                                           const char *hostname,
@@ -385,7 +380,7 @@ XBT_PUBLIC(void) SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, in
 /* Process handling */
 XBT_PUBLIC(void) simcall_process_cleanup(smx_process_t process);
 XBT_PUBLIC(void) simcall_process_change_host(smx_process_t process,
-                 smx_host_t dest);
+                 sg_host_t dest);
 XBT_PUBLIC(void) simcall_process_suspend(smx_process_t process);
 XBT_PUBLIC(void) simcall_process_resume(smx_process_t process);
 
@@ -393,13 +388,14 @@ XBT_PUBLIC(void) simcall_process_resume(smx_process_t process);
 XBT_PUBLIC(int) simcall_process_count(void);
 XBT_PUBLIC(void *) simcall_process_get_data(smx_process_t process);
 XBT_PUBLIC(void) simcall_process_set_data(smx_process_t process, void *data);
-XBT_PUBLIC(smx_host_t) simcall_process_get_host(smx_process_t process);
+XBT_PUBLIC(sg_host_t) simcall_process_get_host(smx_process_t process);
 XBT_PUBLIC(const char *) simcall_process_get_name(smx_process_t process);
 XBT_PUBLIC(int) simcall_process_get_PID(smx_process_t process);
 XBT_PUBLIC(int) simcall_process_get_PPID(smx_process_t process);
 XBT_PUBLIC(int) simcall_process_is_suspended(smx_process_t process);
 XBT_PUBLIC(xbt_dict_t) simcall_process_get_properties(smx_process_t host);
 XBT_PUBLIC(void) simcall_process_set_kill_time(smx_process_t process, double kill_time);
+XBT_PUBLIC(double) simcall_process_get_kill_time(smx_process_t process);
 XBT_PUBLIC(void) simcall_process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void *data);
 XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_process_t process, int auto_restart);
 XBT_PUBLIC(smx_process_t) simcall_process_restart(smx_process_t process);
@@ -413,7 +409,7 @@ XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration);
 XBT_PUBLIC(smx_rdv_t) simcall_rdv_create(const char *name);
 XBT_PUBLIC(void) simcall_rdv_destroy(smx_rdv_t rvp);
 XBT_PUBLIC(smx_rdv_t) simcall_rdv_get_by_name(const char *name);
-XBT_PUBLIC(int) simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host);
+XBT_PUBLIC(int) simcall_rdv_comm_count_by_host(smx_rdv_t rdv, sg_host_t host);
 XBT_PUBLIC(smx_synchro_t) simcall_rdv_get_head(smx_rdv_t rdv);
 XBT_PUBLIC(smx_process_t) simcall_rdv_get_receiver(smx_rdv_t rdv);
 XBT_PUBLIC(void) simcall_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process);
@@ -503,11 +499,11 @@ XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
 /*****************************   File   **********************************/
 XBT_PUBLIC(void *) simcall_file_get_data(smx_file_t fd);
 XBT_PUBLIC(void) simcall_file_set_data(smx_file_t fd, void *data);
-XBT_PUBLIC(sg_size_t) simcall_file_read(smx_file_t fd, sg_size_t size, smx_host_t host);
-XBT_PUBLIC(sg_size_t) simcall_file_write(smx_file_t fd, sg_size_t size, smx_host_t host);
-XBT_PUBLIC(smx_file_t) simcall_file_open(const char* fullpath, smx_host_t host);
-XBT_PUBLIC(int) simcall_file_close(smx_file_t fd, smx_host_t host);
-XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd, smx_host_t host);
+XBT_PUBLIC(sg_size_t) simcall_file_read(smx_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PUBLIC(sg_size_t) simcall_file_write(smx_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PUBLIC(smx_file_t) simcall_file_open(const char* fullpath, sg_host_t host);
+XBT_PUBLIC(int) simcall_file_close(smx_file_t fd, sg_host_t host);
+XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd, sg_host_t host);
 XBT_PUBLIC(sg_size_t) simcall_file_get_size(smx_file_t fd);
 XBT_PUBLIC(xbt_dynar_t) simcall_file_get_info(smx_file_t fd);
 XBT_PUBLIC(sg_size_t) simcall_file_tell(smx_file_t fd);
index 6484c87..f0cc591 100644 (file)
 SG_BEGIN_DECL()
 
 XBT_PUBLIC_DATA(xbt_lib_t) host_lib;
-XBT_PUBLIC_DATA(int) ROUTING_HOST_LEVEL; //Routing level
-XBT_PUBLIC_DATA(int)  SURF_CPU_LEVEL;    //Surf cpu level
-XBT_PUBLIC_DATA(int) SURF_HOST_LEVEL;    //Surf workstation level
-XBT_PUBLIC_DATA(int) SIMIX_HOST_LEVEL;  //Simix host level
-XBT_PUBLIC_DATA(int) SIMIX_STORAGE_LEVEL;  //Simix storage level
-XBT_PUBLIC_DATA(int)  MSG_HOST_LEVEL;    //Msg level
-XBT_PUBLIC_DATA(int)  SD_HOST_LEVEL;    //Simdag host level
-XBT_PUBLIC_DATA(int)  SD_STORAGE_LEVEL;    //Simdag storage level
-XBT_PUBLIC_DATA(int)  COORD_HOST_LEVEL;  //Coordinates level
-XBT_PUBLIC_DATA(int) NS3_HOST_LEVEL;    //host node for ns3
-
-XBT_PUBLIC_DATA(xbt_lib_t) link_lib;
-XBT_PUBLIC_DATA(int) SD_LINK_LEVEL;    //Simdag level
-XBT_PUBLIC_DATA(int) SURF_LINK_LEVEL;  //Surf level
-XBT_PUBLIC_DATA(int) NS3_LINK_LEVEL;    //link for ns3
+XBT_PUBLIC_DATA(int) SURF_HOST_LEVEL;     //Surf workstation level
+XBT_PUBLIC_DATA(int) SIMIX_STORAGE_LEVEL; //Simix storage level
+XBT_PUBLIC_DATA(int) SD_STORAGE_LEVEL;    //Simdag storage level
+XBT_PUBLIC_DATA(int) COORD_HOST_LEVEL;    //Coordinates level
+XBT_PUBLIC_DATA(int) NS3_HOST_LEVEL;      //host node for ns3
 
 XBT_PUBLIC_DATA(xbt_lib_t) as_router_lib;
 XBT_PUBLIC_DATA(int) ROUTING_ASR_LEVEL;  //Routing level
diff --git a/include/xbt/automaton.hpp b/include/xbt/automaton.hpp
new file mode 100644 (file)
index 0000000..8b3827d
--- /dev/null
@@ -0,0 +1,38 @@
+/* Copyright (c) 2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef _XBT_AUTOMATON_HPP
+#define _XBT_AUTOMATON_HPP
+
+#include <utility>
+
+#include <xbt/automaton.h>
+
+namespace simgrid {
+namespace xbt {
+
+/** Add a proposition to an automaton (the C++ way)
+ *
+ *  This API hides all the callback and dynamic allocation hell from
+ *  the used which can use C++ style functors and lambda expressions.
+ */
+template<class F>
+xbt_automaton_propositional_symbol_t add_proposition(
+  xbt_automaton_t a, const char* id, F f)
+{
+  F* callback = new F(std::move(f));
+  return xbt_automaton_propositional_symbol_new_callback(
+    a, id,
+    [](void* callback) -> int { return (*(F*)callback)(); },
+    callback,
+    [](void* callback) -> void { delete (F*)callback; }
+  );
+}
+
+}
+}
+
+#endif
index a8d8c00..3d29597 100644 (file)
@@ -29,6 +29,9 @@ XBT_PUBLIC(const char *) xbt_procname(void);
     SIMGRID_VERSION_MAJOR and friends give the version numbers of the used header files */
 XBT_PUBLIC(void) sg_version(int *major,int *minor,int *patch);
 
+/** Helps ensuring that the header version (SIMGRID_VERSION_MAJOR and friends) and the dynamic library version do match. */
+void sg_version_check(int lib_version_major,int lib_version_minor,int lib_version_patch);
+
 /** Contains all the parameters we got from the command line */
 XBT_PUBLIC_DATA(xbt_dynar_t) sg_cmdline;
 
index d0ac0be..5549651 100644 (file)
@@ -77,7 +77,7 @@ Java_org_simgrid_msg_Host_getByName(JNIEnv * env, jclass cls,
   }
   const char *name = (*env)->GetStringUTFChars(env, jname, 0);
   /* get the host by name       (the hosts are created during the grid resolution) */
-  host = MSG_get_host_by_name(name);
+  host = MSG_host_by_name(name);
 
   if (!host) {                  /* invalid name */
     jxbt_throw_host_not_found(env, name);
index a65f183..0f8a905 100644 (file)
@@ -131,7 +131,7 @@ Java_org_simgrid_msg_Process_create(JNIEnv * env,
   }
 
   /* bind/retrieve the msg host */
-  host = MSG_get_host_by_name(hostname);
+  host = MSG_host_by_name(hostname);
 
   if (!(host)) {    /* not bound */
     jxbt_throw_host_not_found(env, hostname);
index 28c239b..684a1c7 100644 (file)
@@ -55,13 +55,8 @@ public class CpuModel extends Model {
     SurfJNI.CpuModel_change_ownership(this, swigCPtr, true);
   }
 
-  
-  /**
-    * CpuModel constructon
-    * @param name The name of the cpumodel
-    */
-  public CpuModel(String name) {
-    this(SurfJNI.new_CpuModel(name), true);
+  public CpuModel() {
+    this(SurfJNI.new_CpuModel(), true);
     SurfJNI.CpuModel_director_connect(this, swigCPtr, swigCMemOwn, true);
   }
 
@@ -11,15 +11,15 @@ package org.simgrid.surf;
 /**
  * A generic resource for the network component
  */
-public class NetworkLink extends Resource {
+public class Link extends Resource {
   private long swigCPtr;
 
-  protected NetworkLink(long cPtr, boolean cMemoryOwn) {
-    super(SurfJNI.NetworkLink_SWIGUpcast(cPtr), cMemoryOwn);
+  protected Link(long cPtr, boolean cMemoryOwn) {
+    super(SurfJNI.Link_SWIGUpcast(cPtr), cMemoryOwn);
     swigCPtr = cPtr;
   }
 
-  protected static long getCPtr(NetworkLink obj) {
+  protected static long getCPtr(Link obj) {
     return (obj == null) ? 0 : obj.swigCPtr;
   }
 
@@ -31,24 +31,24 @@ public class NetworkLink extends Resource {
     if (swigCPtr != 0) {
       if (swigCMemOwn) {
         swigCMemOwn = false;
-        SurfJNI.delete_NetworkLink(swigCPtr);
+        SurfJNI.delete_Link(swigCPtr);
       }
       swigCPtr = 0;
     }
     super.delete();
   }
 
-  protected static long[] cArrayUnwrap(NetworkLink[] arrayWrapper) {
+  protected static long[] cArrayUnwrap(Link[] arrayWrapper) {
       long[] cArray = new long[arrayWrapper.length];
       for (int i=0; i<arrayWrapper.length; i++)
-        cArray[i] = NetworkLink.getCPtr(arrayWrapper[i]);
+        cArray[i] = Link.getCPtr(arrayWrapper[i]);
       return cArray;
   }
 
-  protected static NetworkLink[] cArrayWrap(long[] cArray, boolean cMemoryOwn) {
-    NetworkLink[] arrayWrapper = new NetworkLink[cArray.length];
+  protected static Link[] cArrayWrap(long[] cArray, boolean cMemoryOwn) {
+    Link[] arrayWrapper = new Link[cArray.length];
     for (int i=0; i<cArray.length; i++)
-      arrayWrapper[i] = new NetworkLink(cArray[i], cMemoryOwn);
+      arrayWrapper[i] = new Link(cArray[i], cMemoryOwn);
     return arrayWrapper;
   }
 
@@ -57,7 +57,7 @@ public class NetworkLink extends Resource {
     * @return The bandwidth of the link
     */
   public double getBandwidth() {
-    return SurfJNI.NetworkLink_getBandwidth(swigCPtr, this);
+    return SurfJNI.Link_getBandwidth(swigCPtr, this);
   }
 
   
@@ -65,7 +65,7 @@ public class NetworkLink extends Resource {
     * @param value The new bandwidth
     */
   public void updateBandwidth(double value, double date) {
-    SurfJNI.NetworkLink_updateBandwidth__SWIG_0(swigCPtr, this, value, date);
+    SurfJNI.Link_updateBandwidth__SWIG_0(swigCPtr, this, value, date);
   }
 
   
@@ -73,7 +73,7 @@ public class NetworkLink extends Resource {
     * @param value The new bandwidth
     */
   public void updateBandwidth(double value) {
-    SurfJNI.NetworkLink_updateBandwidth__SWIG_1(swigCPtr, this, value);
+    SurfJNI.Link_updateBandwidth__SWIG_1(swigCPtr, this, value);
   }
 
   
@@ -81,7 +81,7 @@ public class NetworkLink extends Resource {
     * @return The latency of the link
     */
   public double getLatency() {
-    return SurfJNI.NetworkLink_getLatency(swigCPtr, this);
+    return SurfJNI.Link_getLatency(swigCPtr, this);
   }
 
   
@@ -89,7 +89,7 @@ public class NetworkLink extends Resource {
     * @param value The new latency
     */
   public void updateLatency(double value, double date) {
-    SurfJNI.NetworkLink_updateLatency__SWIG_0(swigCPtr, this, value, date);
+    SurfJNI.Link_updateLatency__SWIG_0(swigCPtr, this, value, date);
   }
 
   
@@ -97,7 +97,7 @@ public class NetworkLink extends Resource {
     * @param value The new latency
     */
   public void updateLatency(double value) {
-    SurfJNI.NetworkLink_updateLatency__SWIG_1(swigCPtr, this, value);
+    SurfJNI.Link_updateLatency__SWIG_1(swigCPtr, this, value);
   }
 
 }
index f0da148..6f4787f 100644 (file)
@@ -46,14 +46,6 @@ public class Model {
   }
 
   
-  /**
-    * @return The name of the model
-    */
-  public String getName() {
-    return SurfJNI.Model_getName(swigCPtr, this);
-  }
-
-  
   /**
     * Share the resources between the actions
     * @param now the current time
index 76d3ae8..d1df779 100644 (file)
@@ -10,7 +10,7 @@ package org.simgrid.surf;
 
 /**
   * An network action created by network model
-  * @see NetworkLink
+  * @see Link
   */
 public class NetworkAction extends Action {
   private long swigCPtr;
index 957a707..4b20246 100644 (file)
@@ -82,28 +82,28 @@ public class Plugin {
     if (getClass() == Plugin.class) SurfJNI.Plugin_cpuActionStateChangedCallback(swigCPtr, this, CpuAction.getCPtr(action), action, arg1.swigValue(), arg2.swigValue()); else SurfJNI.Plugin_cpuActionStateChangedCallbackSwigExplicitPlugin(swigCPtr, this, CpuAction.getCPtr(action), action, arg1.swigValue(), arg2.swigValue());
   }
 
-  public void activateNetworkLinkCreatedCallback() {
-    SurfJNI.Plugin_activateNetworkLinkCreatedCallback(swigCPtr, this);
+  public void activateLinkCreatedCallback() {
+    SurfJNI.Plugin_activateLinkCreatedCallback(swigCPtr, this);
   }
 
-  public void networkLinkCreatedCallback(NetworkLink link) {
-    if (getClass() == Plugin.class) SurfJNI.Plugin_networkLinkCreatedCallback(swigCPtr, this, NetworkLink.getCPtr(link), link); else SurfJNI.Plugin_networkLinkCreatedCallbackSwigExplicitPlugin(swigCPtr, this, NetworkLink.getCPtr(link), link);
+  public void networkLinkCreatedCallback(Link link) {
+    if (getClass() == Plugin.class) SurfJNI.Plugin_networkLinkCreatedCallback(swigCPtr, this, Link.getCPtr(link), link); else SurfJNI.Plugin_networkLinkCreatedCallbackSwigExplicitPlugin(swigCPtr, this, Link.getCPtr(link), link);
   }
 
-  public void activateNetworkLinkDestructedCallback() {
-    SurfJNI.Plugin_activateNetworkLinkDestructedCallback(swigCPtr, this);
+  public void activateLinkDestructedCallback() {
+    SurfJNI.Plugin_activateLinkDestructedCallback(swigCPtr, this);
   }
 
-  public void networkLinkDestructedCallback(NetworkLink link) {
-    if (getClass() == Plugin.class) SurfJNI.Plugin_networkLinkDestructedCallback(swigCPtr, this, NetworkLink.getCPtr(link), link); else SurfJNI.Plugin_networkLinkDestructedCallbackSwigExplicitPlugin(swigCPtr, this, NetworkLink.getCPtr(link), link);
+  public void networkLinkDestructedCallback(Link link) {
+    if (getClass() == Plugin.class) SurfJNI.Plugin_networkLinkDestructedCallback(swigCPtr, this, Link.getCPtr(link), link); else SurfJNI.Plugin_networkLinkDestructedCallbackSwigExplicitPlugin(swigCPtr, this, Link.getCPtr(link), link);
   }
 
-  public void activateNetworkLinkStateChangedCallback() {
-    SurfJNI.Plugin_activateNetworkLinkStateChangedCallback(swigCPtr, this);
+  public void activateLinkStateChangedCallback() {
+    SurfJNI.Plugin_activateLinkStateChangedCallback(swigCPtr, this);
   }
 
-  public void networkLinkStateChangedCallback(NetworkLink link, ResourceState arg1, ResourceState arg2) {
-    if (getClass() == Plugin.class) SurfJNI.Plugin_networkLinkStateChangedCallback(swigCPtr, this, NetworkLink.getCPtr(link), link, arg1.swigValue(), arg2.swigValue()); else SurfJNI.Plugin_networkLinkStateChangedCallbackSwigExplicitPlugin(swigCPtr, this, NetworkLink.getCPtr(link), link, arg1.swigValue(), arg2.swigValue());
+  public void networkLinkStateChangedCallback(Link link, ResourceState arg1, ResourceState arg2) {
+    if (getClass() == Plugin.class) SurfJNI.Plugin_networkLinkStateChangedCallback(swigCPtr, this, Link.getCPtr(link), link, arg1.swigValue(), arg2.swigValue()); else SurfJNI.Plugin_networkLinkStateChangedCallbackSwigExplicitPlugin(swigCPtr, this, Link.getCPtr(link), link, arg1.swigValue(), arg2.swigValue());
   }
 
   public void activateNetworkActionStateChangedCallback() {
index 4165404..3437a60 100644 (file)
@@ -50,8 +50,8 @@ public class Surf {
     SurfJNI.setCpu(name, Cpu.getCPtr(cpu), cpu);
   }
 
-  public static NetworkLink[] getRoute(String srcName, String dstName) {
-     return NetworkLink.cArrayWrap(SurfJNI.getRoute(srcName, dstName), false);
+  public static Link[] getRoute(String srcName, String dstName) {
+     return Link.cArrayWrap(SurfJNI.getRoute(srcName, dstName), false);
 }
 
 }
index 3502cf5..aad944c 100644 (file)
@@ -51,15 +51,15 @@ public class SurfJNI {
   public final static native void Plugin_activateCpuActionStateChangedCallback(long jarg1, Plugin jarg1_);
   public final static native void Plugin_cpuActionStateChangedCallback(long jarg1, Plugin jarg1_, long jarg2, CpuAction jarg2_, int jarg3, int jarg4);
   public final static native void Plugin_cpuActionStateChangedCallbackSwigExplicitPlugin(long jarg1, Plugin jarg1_, long jarg2, CpuAction jarg2_, int jarg3, int jarg4);
-  public final static native void Plugin_activateNetworkLinkCreatedCallback(long jarg1, Plugin jarg1_);
-  public final static native void Plugin_networkLinkCreatedCallback(long jarg1, Plugin jarg1_, long jarg2, NetworkLink jarg2_);
-  public final static native void Plugin_networkLinkCreatedCallbackSwigExplicitPlugin(long jarg1, Plugin jarg1_, long jarg2, NetworkLink jarg2_);
-  public final static native void Plugin_activateNetworkLinkDestructedCallback(long jarg1, Plugin jarg1_);
-  public final static native void Plugin_networkLinkDestructedCallback(long jarg1, Plugin jarg1_, long jarg2, NetworkLink jarg2_);
-  public final static native void Plugin_networkLinkDestructedCallbackSwigExplicitPlugin(long jarg1, Plugin jarg1_, long jarg2, NetworkLink jarg2_);
-  public final static native void Plugin_activateNetworkLinkStateChangedCallback(long jarg1, Plugin jarg1_);
-  public final static native void Plugin_networkLinkStateChangedCallback(long jarg1, Plugin jarg1_, long jarg2, NetworkLink jarg2_, int jarg3, int jarg4);
-  public final static native void Plugin_networkLinkStateChangedCallbackSwigExplicitPlugin(long jarg1, Plugin jarg1_, long jarg2, NetworkLink jarg2_, int jarg3, int jarg4);
+  public final static native void Plugin_activateLinkCreatedCallback(long jarg1, Plugin jarg1_);
+  public final static native void Plugin_networkLinkCreatedCallback(long jarg1, Plugin jarg1_, long jarg2, Link jarg2_);
+  public final static native void Plugin_networkLinkCreatedCallbackSwigExplicitPlugin(long jarg1, Plugin jarg1_, long jarg2, Link jarg2_);
+  public final static native void Plugin_activateLinkDestructedCallback(long jarg1, Plugin jarg1_);
+  public final static native void Plugin_networkLinkDestructedCallback(long jarg1, Plugin jarg1_, long jarg2, Link jarg2_);
+  public final static native void Plugin_networkLinkDestructedCallbackSwigExplicitPlugin(long jarg1, Plugin jarg1_, long jarg2, Link jarg2_);
+  public final static native void Plugin_activateLinkStateChangedCallback(long jarg1, Plugin jarg1_);
+  public final static native void Plugin_networkLinkStateChangedCallback(long jarg1, Plugin jarg1_, long jarg2, Link jarg2_, int jarg3, int jarg4);
+  public final static native void Plugin_networkLinkStateChangedCallbackSwigExplicitPlugin(long jarg1, Plugin jarg1_, long jarg2, Link jarg2_, int jarg3, int jarg4);
   public final static native void Plugin_activateNetworkActionStateChangedCallback(long jarg1, Plugin jarg1_);
   public final static native void Plugin_networkActionStateChangedCallback(long jarg1, Plugin jarg1_, long jarg2, NetworkAction jarg2_, int jarg3, int jarg4);
   public final static native void Plugin_networkActionStateChangedCallbackSwigExplicitPlugin(long jarg1, Plugin jarg1_, long jarg2, NetworkAction jarg2_, int jarg3, int jarg4);
@@ -72,7 +72,6 @@ public class SurfJNI {
   public final static native void delete_TmgrTrace(long jarg1);
   public final static native long TmgrTraceEvent_getIdx(long jarg1, TmgrTraceEvent jarg1_);
   public final static native void delete_TmgrTraceEvent(long jarg1);
-  public final static native String Model_getName(long jarg1, Model jarg1_);
   public final static native double Model_shareResources(long jarg1, Model jarg1_, double jarg2);
   public final static native double Model_shareResourcesLazy(long jarg1, Model jarg1_, double jarg2);
   public final static native double Model_shareResourcesFull(long jarg1, Model jarg1_, double jarg2);
@@ -82,7 +81,7 @@ public class SurfJNI {
   public final static native long Model_getRunningActionSet(long jarg1, Model jarg1_);
   public final static native void Model_addTraces(long jarg1, Model jarg1_);
   public final static native void delete_Model(long jarg1);
-  public final static native long new_CpuModel(String jarg1);
+  public final static native long new_CpuModel();
   public final static native void delete_CpuModel(long jarg1);
   public final static native long CpuModel_createCpu(long jarg1, CpuModel jarg1_, String jarg2, double[] jarg3, int jarg4, double jarg5, long jarg6, TmgrTrace jarg6_, int jarg7, int jarg8, long jarg9, TmgrTrace jarg9_, long jarg10, XbtDict jarg10_);
   public final static native void CpuModel_director_connect(CpuModel obj, long cptr, boolean mem_own, boolean weak_global);
@@ -115,13 +114,13 @@ public class SurfJNI {
   public final static native void Cpu_setState(long jarg1, Cpu jarg1_, int jarg2);
   public final static native void Cpu_director_connect(Cpu obj, long cptr, boolean mem_own, boolean weak_global);
   public final static native void Cpu_change_ownership(Cpu obj, long cptr, boolean take_or_release);
-  public final static native void delete_NetworkLink(long jarg1);
-  public final static native double NetworkLink_getBandwidth(long jarg1, NetworkLink jarg1_);
-  public final static native void NetworkLink_updateBandwidth__SWIG_0(long jarg1, NetworkLink jarg1_, double jarg2, double jarg3);
-  public final static native void NetworkLink_updateBandwidth__SWIG_1(long jarg1, NetworkLink jarg1_, double jarg2);
-  public final static native double NetworkLink_getLatency(long jarg1, NetworkLink jarg1_);
-  public final static native void NetworkLink_updateLatency__SWIG_0(long jarg1, NetworkLink jarg1_, double jarg2, double jarg3);
-  public final static native void NetworkLink_updateLatency__SWIG_1(long jarg1, NetworkLink jarg1_, double jarg2);
+  public final static native void delete_Link(long jarg1);
+  public final static native double Link_getBandwidth(long jarg1, Link jarg1_);
+  public final static native void Link_updateBandwidth__SWIG_0(long jarg1, Link jarg1_, double jarg2, double jarg3);
+  public final static native void Link_updateBandwidth__SWIG_1(long jarg1, Link jarg1_, double jarg2);
+  public final static native double Link_getLatency(long jarg1, Link jarg1_);
+  public final static native void Link_updateLatency__SWIG_0(long jarg1, Link jarg1_, double jarg2, double jarg3);
+  public final static native void Link_updateLatency__SWIG_1(long jarg1, Link jarg1_, double jarg2);
   public final static native long new_Action(long jarg1, Model jarg1_, double jarg2, boolean jarg3);
   public final static native void delete_Action(long jarg1);
   public final static native long Action_getModel(long jarg1, Action jarg1_);
@@ -157,7 +156,7 @@ public class SurfJNI {
   public final static native int SURF_RESOURCE_OFF_get();
   public final static native long CpuModel_SWIGUpcast(long jarg1);
   public final static native long Cpu_SWIGUpcast(long jarg1);
-  public final static native long NetworkLink_SWIGUpcast(long jarg1);
+  public final static native long Link_SWIGUpcast(long jarg1);
   public final static native long CpuAction_SWIGUpcast(long jarg1);
   public final static native long NetworkAction_SWIGUpcast(long jarg1);
 
@@ -174,13 +173,13 @@ public class SurfJNI {
     self.cpuActionStateChangedCallback((action == 0) ? null : new CpuAction(action, false), ActionState.swigToEnum(arg1), ActionState.swigToEnum(arg2));
   }
   public static void SwigDirector_Plugin_networkLinkCreatedCallback(Plugin self, long link) {
-    self.networkLinkCreatedCallback((link == 0) ? null : new NetworkLink(link, false));
+    self.networkLinkCreatedCallback((link == 0) ? null : new Link(link, false));
   }
   public static void SwigDirector_Plugin_networkLinkDestructedCallback(Plugin self, long link) {
-    self.networkLinkDestructedCallback((link == 0) ? null : new NetworkLink(link, false));
+    self.networkLinkDestructedCallback((link == 0) ? null : new Link(link, false));
   }
   public static void SwigDirector_Plugin_networkLinkStateChangedCallback(Plugin self, long link, int arg1, int arg2) {
-    self.networkLinkStateChangedCallback((link == 0) ? null : new NetworkLink(link, false), ResourceState.swigToEnum(arg1), ResourceState.swigToEnum(arg2));
+    self.networkLinkStateChangedCallback((link == 0) ? null : new Link(link, false), ResourceState.swigToEnum(arg1), ResourceState.swigToEnum(arg2));
   }
   public static void SwigDirector_Plugin_networkActionStateChangedCallback(Plugin self, long action, int old, int cur) {
     self.networkActionStateChangedCallback((action == 0) ? null : new NetworkAction(action, false), ActionState.swigToEnum(old), ActionState.swigToEnum(cur));
index cd127fb..c0feca4 100644 (file)
@@ -1167,7 +1167,7 @@ void SwigDirector_Plugin::cpuActionStateChangedCallback(CpuAction *action, e_sur
   if (swigjobj) jenv->DeleteLocalRef(swigjobj);
 }
 
-void SwigDirector_Plugin::networkLinkCreatedCallback(NetworkLink *link) {
+void SwigDirector_Plugin::networkLinkCreatedCallback(Link *link) {
   JNIEnvWrapper swigjnienv(this) ;
   JNIEnv * jenv = swigjnienv.getJNIEnv() ;
   jobject swigjobj = (jobject) NULL ;
@@ -1179,7 +1179,7 @@ void SwigDirector_Plugin::networkLinkCreatedCallback(NetworkLink *link) {
   }
   swigjobj = swig_get_self(jenv);
   if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
-    *((NetworkLink **)&jlink) = (NetworkLink *) link; 
+    *((Link **)&jlink) = (Link *) link; 
     jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[4], swigjobj, jlink);
     if (jenv->ExceptionCheck() == JNI_TRUE) return ;
   } else {
@@ -1188,7 +1188,7 @@ void SwigDirector_Plugin::networkLinkCreatedCallback(NetworkLink *link) {
   if (swigjobj) jenv->DeleteLocalRef(swigjobj);
 }
 
-void SwigDirector_Plugin::networkLinkDestructedCallback(NetworkLink *link) {
+void SwigDirector_Plugin::networkLinkDestructedCallback(Link *link) {
   JNIEnvWrapper swigjnienv(this) ;
   JNIEnv * jenv = swigjnienv.getJNIEnv() ;
   jobject swigjobj = (jobject) NULL ;
@@ -1200,7 +1200,7 @@ void SwigDirector_Plugin::networkLinkDestructedCallback(NetworkLink *link) {
   }
   swigjobj = swig_get_self(jenv);
   if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
-    *((NetworkLink **)&jlink) = (NetworkLink *) link; 
+    *((Link **)&jlink) = (Link *) link; 
     jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[5], swigjobj, jlink);
     if (jenv->ExceptionCheck() == JNI_TRUE) return ;
   } else {
@@ -1209,7 +1209,7 @@ void SwigDirector_Plugin::networkLinkDestructedCallback(NetworkLink *link) {
   if (swigjobj) jenv->DeleteLocalRef(swigjobj);
 }
 
-void SwigDirector_Plugin::networkLinkStateChangedCallback(NetworkLink *link, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2) {
+void SwigDirector_Plugin::networkLinkStateChangedCallback(Link *link, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2) {
   JNIEnvWrapper swigjnienv(this) ;
   JNIEnv * jenv = swigjnienv.getJNIEnv() ;
   jobject swigjobj = (jobject) NULL ;
@@ -1223,7 +1223,7 @@ void SwigDirector_Plugin::networkLinkStateChangedCallback(NetworkLink *link, e_s
   }
   swigjobj = swig_get_self(jenv);
   if (swigjobj && jenv->IsSameObject(swigjobj, NULL) == JNI_FALSE) {
-    *((NetworkLink **)&jlink) = (NetworkLink *) link; 
+    *((Link **)&jlink) = (Link *) link; 
     jarg1 = (jint) arg1;
     jarg2 = (jint) arg2;
     jenv->CallStaticVoidMethod(Swig::jclass_SurfJNI, Swig::director_methids[6], swigjobj, jlink, jarg1, jarg2);
@@ -1307,13 +1307,13 @@ void SwigDirector_Plugin::swig_connect_director(JNIEnv *jenv, jobject jself, jcl
       "cpuActionStateChangedCallback", "(Lorg/simgrid/surf/CpuAction;Lorg/simgrid/surf/ActionState;Lorg/simgrid/surf/ActionState;)V", NULL 
     },
     {
-      "networkLinkCreatedCallback", "(Lorg/simgrid/surf/NetworkLink;)V", NULL 
+      "networkLinkCreatedCallback", "(Lorg/simgrid/surf/Link;)V", NULL 
     },
     {
-      "networkLinkDestructedCallback", "(Lorg/simgrid/surf/NetworkLink;)V", NULL 
+      "networkLinkDestructedCallback", "(Lorg/simgrid/surf/Link;)V", NULL 
     },
     {
-      "networkLinkStateChangedCallback", "(Lorg/simgrid/surf/NetworkLink;Lorg/simgrid/surf/ResourceState;Lorg/simgrid/surf/ResourceState;)V", NULL 
+      "networkLinkStateChangedCallback", "(Lorg/simgrid/surf/Link;Lorg/simgrid/surf/ResourceState;Lorg/simgrid/surf/ResourceState;)V", NULL 
     },
     {
       "networkActionStateChangedCallback", "(Lorg/simgrid/surf/NetworkAction;Lorg/simgrid/surf/ActionState;Lorg/simgrid/surf/ActionState;)V", NULL 
@@ -1348,7 +1348,7 @@ void SwigDirector_Plugin::swig_connect_director(JNIEnv *jenv, jobject jself, jcl
 }
 
 
-SwigDirector_CpuModel::SwigDirector_CpuModel(JNIEnv *jenv, char const *name) : CpuModel(name), Swig::Director(jenv) {
+SwigDirector_CpuModel::SwigDirector_CpuModel(JNIEnv *jenv) : CpuModel(), Swig::Director(jenv) {
 }
 
 double SwigDirector_CpuModel::shareResources(double now) {
@@ -2226,7 +2226,7 @@ SWIGEXPORT jlongArray JNICALL Java_org_simgrid_surf_SurfJNI_ActionList_1getArray
     jlong *elts = jenv->GetLongArrayElements(jresult, NULL);
     l = 0;
     for(ActionList::iterator it(result->begin()), itend(result->end()); it != itend ; ++it) {
-      elts[l++] = (jlong)static_cast<ActionPtr>(&*it);
+      elts[l++] = (jlong)static_cast<Action*>(&*it);
     }
     jenv->ReleaseLongArrayElements(jresult, elts, 0);
   }
@@ -2322,7 +2322,7 @@ SWIGEXPORT jlongArray JNICALL Java_org_simgrid_surf_SurfJNI_getRoute(JNIEnv *jen
   jlongArray jresult = 0 ;
   char *arg1 = (char *) 0 ;
   char *arg2 = (char *) 0 ;
-  NetworkLinkDynar result;
+  LinkDynar result;
   
   (void)jenv;
   (void)jcls;
@@ -2341,7 +2341,7 @@ SWIGEXPORT jlongArray JNICALL Java_org_simgrid_surf_SurfJNI_getRoute(JNIEnv *jen
     long l = xbt_dynar_length(result);
     jresult = jenv->NewLongArray(l);
     unsigned i;
-    NetworkLink *link;
+    Link *link;
     jlong *elts = jenv->GetLongArrayElements(jresult, NULL);
     xbt_dynar_foreach(result, i, link) {
       elts[i] = (jlong)link;
@@ -2537,98 +2537,98 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1cpuActionStateChan
 }
 
 
-SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateNetworkLinkCreatedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateLinkCreatedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
   Plugin *arg1 = (Plugin *) 0 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
   arg1 = *(Plugin **)&jarg1; 
-  (arg1)->activateNetworkLinkCreatedCallback();
+  (arg1)->activateLinkCreatedCallback();
 }
 
 
 SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkCreatedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
   Plugin *arg1 = (Plugin *) 0 ;
-  NetworkLink *arg2 = (NetworkLink *) 0 ;
+  Link *arg2 = (Link *) 0 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
   (void)jarg2_;
   arg1 = *(Plugin **)&jarg1; 
-  arg2 = *(NetworkLink **)&jarg2; 
+  arg2 = *(Link **)&jarg2; 
   (arg1)->networkLinkCreatedCallback(arg2);
 }
 
 
 SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkCreatedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
   Plugin *arg1 = (Plugin *) 0 ;
-  NetworkLink *arg2 = (NetworkLink *) 0 ;
+  Link *arg2 = (Link *) 0 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
   (void)jarg2_;
   arg1 = *(Plugin **)&jarg1; 
-  arg2 = *(NetworkLink **)&jarg2; 
+  arg2 = *(Link **)&jarg2; 
   (arg1)->Plugin::networkLinkCreatedCallback(arg2);
 }
 
 
-SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateNetworkLinkDestructedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateLinkDestructedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
   Plugin *arg1 = (Plugin *) 0 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
   arg1 = *(Plugin **)&jarg1; 
-  (arg1)->activateNetworkLinkDestructedCallback();
+  (arg1)->activateLinkDestructedCallback();
 }
 
 
 SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkDestructedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
   Plugin *arg1 = (Plugin *) 0 ;
-  NetworkLink *arg2 = (NetworkLink *) 0 ;
+  Link *arg2 = (Link *) 0 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
   (void)jarg2_;
   arg1 = *(Plugin **)&jarg1; 
-  arg2 = *(NetworkLink **)&jarg2; 
+  arg2 = *(Link **)&jarg2; 
   (arg1)->networkLinkDestructedCallback(arg2);
 }
 
 
 SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkDestructedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
   Plugin *arg1 = (Plugin *) 0 ;
-  NetworkLink *arg2 = (NetworkLink *) 0 ;
+  Link *arg2 = (Link *) 0 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
   (void)jarg2_;
   arg1 = *(Plugin **)&jarg1; 
-  arg2 = *(NetworkLink **)&jarg2; 
+  arg2 = *(Link **)&jarg2; 
   (arg1)->Plugin::networkLinkDestructedCallback(arg2);
 }
 
 
-SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateNetworkLinkStateChangedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1activateLinkStateChangedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
   Plugin *arg1 = (Plugin *) 0 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
   arg1 = *(Plugin **)&jarg1; 
-  (arg1)->activateNetworkLinkStateChangedCallback();
+  (arg1)->activateLinkStateChangedCallback();
 }
 
 
 SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateChangedCallback(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) {
   Plugin *arg1 = (Plugin *) 0 ;
-  NetworkLink *arg2 = (NetworkLink *) 0 ;
+  Link *arg2 = (Link *) 0 ;
   e_surf_resource_state_t arg3 ;
   e_surf_resource_state_t arg4 ;
   
@@ -2637,7 +2637,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateCh
   (void)jarg1_;
   (void)jarg2_;
   arg1 = *(Plugin **)&jarg1; 
-  arg2 = *(NetworkLink **)&jarg2; 
+  arg2 = *(Link **)&jarg2; 
   arg3 = (e_surf_resource_state_t)jarg3; 
   arg4 = (e_surf_resource_state_t)jarg4; 
   (arg1)->networkLinkStateChangedCallback(arg2,arg3,arg4);
@@ -2646,7 +2646,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateCh
 
 SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateChangedCallbackSwigExplicitPlugin(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_, jint jarg3, jint jarg4) {
   Plugin *arg1 = (Plugin *) 0 ;
-  NetworkLink *arg2 = (NetworkLink *) 0 ;
+  Link *arg2 = (Link *) 0 ;
   e_surf_resource_state_t arg3 ;
   e_surf_resource_state_t arg4 ;
   
@@ -2655,7 +2655,7 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Plugin_1networkLinkStateCh
   (void)jarg1_;
   (void)jarg2_;
   arg1 = *(Plugin **)&jarg1; 
-  arg2 = *(NetworkLink **)&jarg2; 
+  arg2 = *(Link **)&jarg2; 
   arg3 = (e_surf_resource_state_t)jarg3; 
   arg4 = (e_surf_resource_state_t)jarg4; 
   (arg1)->Plugin::networkLinkStateChangedCallback(arg2,arg3,arg4);
@@ -2835,21 +2835,6 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1TmgrTraceEvent(JNI
 }
 
 
-SWIGEXPORT jstring JNICALL Java_org_simgrid_surf_SurfJNI_Model_1getName(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
-  jstring jresult = 0 ;
-  Model *arg1 = (Model *) 0 ;
-  char *result = 0 ;
-  
-  (void)jenv;
-  (void)jcls;
-  (void)jarg1_;
-  arg1 = *(Model **)&jarg1; 
-  result = (char *)(arg1)->getName();
-  if (result) jresult = jenv->NewStringUTF((const char *)result);
-  return jresult;
-}
-
-
 SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Model_1shareResources(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) {
   jdouble jresult = 0 ;
   Model *arg1 = (Model *) 0 ;
@@ -2982,23 +2967,14 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1Model(JNIEnv *jenv
 }
 
 
-SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1CpuModel(JNIEnv *jenv, jclass jcls, jstring jarg1) {
+SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_new_1CpuModel(JNIEnv *jenv, jclass jcls) {
   jlong jresult = 0 ;
-  char *arg1 = (char *) 0 ;
   CpuModel *result = 0 ;
   
   (void)jenv;
   (void)jcls;
-  arg1 = 0;
-  if (jarg1) {
-    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
-    if (!arg1) return 0;
-  }
-  result = (CpuModel *)new SwigDirector_CpuModel(jenv,(char const *)arg1);
+  result = (CpuModel *)new SwigDirector_CpuModel(jenv);
   *(CpuModel **)&jresult = result; 
-  {
-    
-  }
   return jresult;
 }
 
@@ -3530,97 +3506,97 @@ SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1change_1ownership(JNI
 }
 
 
-SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1NetworkLink(JNIEnv *jenv, jclass jcls, jlong jarg1) {
-  NetworkLink *arg1 = (NetworkLink *) 0 ;
+SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_delete_1Link(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+  Link *arg1 = (Link *) 0 ;
   
   (void)jenv;
   (void)jcls;
-  arg1 = *(NetworkLink **)&jarg1; 
+  arg1 = *(Link **)&jarg1; 
   delete arg1;
 }
 
 
-SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_NetworkLink_1getBandwidth(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Link_1getBandwidth(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
   jdouble jresult = 0 ;
-  NetworkLink *arg1 = (NetworkLink *) 0 ;
+  Link *arg1 = (Link *) 0 ;
   double result;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
-  arg1 = *(NetworkLink **)&jarg1; 
+  arg1 = *(Link **)&jarg1; 
   result = (double)(arg1)->getBandwidth();
   jresult = (jdouble)result; 
   return jresult;
 }
 
 
-SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_NetworkLink_1updateBandwidth_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jdouble jarg3) {
-  NetworkLink *arg1 = (NetworkLink *) 0 ;
+SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateBandwidth_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jdouble jarg3) {
+  Link *arg1 = (Link *) 0 ;
   double arg2 ;
   double arg3 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
-  arg1 = *(NetworkLink **)&jarg1; 
+  arg1 = *(Link **)&jarg1; 
   arg2 = (double)jarg2; 
   arg3 = (double)jarg3; 
   (arg1)->updateBandwidth(arg2,arg3);
 }
 
 
-SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_NetworkLink_1updateBandwidth_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) {
-  NetworkLink *arg1 = (NetworkLink *) 0 ;
+SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateBandwidth_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) {
+  Link *arg1 = (Link *) 0 ;
   double arg2 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
-  arg1 = *(NetworkLink **)&jarg1; 
+  arg1 = *(Link **)&jarg1; 
   arg2 = (double)jarg2; 
   (arg1)->updateBandwidth(arg2);
 }
 
 
-SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_NetworkLink_1getLatency(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
+SWIGEXPORT jdouble JNICALL Java_org_simgrid_surf_SurfJNI_Link_1getLatency(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) {
   jdouble jresult = 0 ;
-  NetworkLink *arg1 = (NetworkLink *) 0 ;
+  Link *arg1 = (Link *) 0 ;
   double result;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
-  arg1 = *(NetworkLink **)&jarg1; 
+  arg1 = *(Link **)&jarg1; 
   result = (double)(arg1)->getLatency();
   jresult = (jdouble)result; 
   return jresult;
 }
 
 
-SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_NetworkLink_1updateLatency_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jdouble jarg3) {
-  NetworkLink *arg1 = (NetworkLink *) 0 ;
+SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateLatency_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2, jdouble jarg3) {
+  Link *arg1 = (Link *) 0 ;
   double arg2 ;
   double arg3 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
-  arg1 = *(NetworkLink **)&jarg1; 
+  arg1 = *(Link **)&jarg1; 
   arg2 = (double)jarg2; 
   arg3 = (double)jarg3; 
   (arg1)->updateLatency(arg2,arg3);
 }
 
 
-SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_NetworkLink_1updateLatency_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) {
-  NetworkLink *arg1 = (NetworkLink *) 0 ;
+SWIGEXPORT void JNICALL Java_org_simgrid_surf_SurfJNI_Link_1updateLatency_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jdouble jarg2) {
+  Link *arg1 = (Link *) 0 ;
   double arg2 ;
   
   (void)jenv;
   (void)jcls;
   (void)jarg1_;
-  arg1 = *(NetworkLink **)&jarg1; 
+  arg1 = *(Link **)&jarg1; 
   arg2 = (double)jarg2; 
   (arg1)->updateLatency(arg2);
 }
@@ -4081,11 +4057,11 @@ SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Cpu_1SWIGUpcast(JNIEnv *j
     return baseptr;
 }
 
-SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_NetworkLink_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
+SWIGEXPORT jlong JNICALL Java_org_simgrid_surf_SurfJNI_Link_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) {
     jlong baseptr = 0;
     (void)jenv;
     (void)jcls;
-    *(Resource **)&baseptr = *(NetworkLink **)&jarg1;
+    *(Resource **)&baseptr = *(Link **)&jarg1;
     return baseptr;
 }
 
index c3567e3..53d5d17 100644 (file)
@@ -21,9 +21,9 @@ public:
     virtual void cpuDestructedCallback(Cpu *cpu);
     virtual void cpuStateChangedCallback(Cpu *cpu, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2);
     virtual void cpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t arg1, e_surf_action_state_t arg2);
-    virtual void networkLinkCreatedCallback(NetworkLink *link);
-    virtual void networkLinkDestructedCallback(NetworkLink *link);
-    virtual void networkLinkStateChangedCallback(NetworkLink *link, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2);
+    virtual void networkLinkCreatedCallback(Link *link);
+    virtual void networkLinkDestructedCallback(Link *link);
+    virtual void networkLinkStateChangedCallback(Link *link, e_surf_resource_state_t arg1, e_surf_resource_state_t arg2);
     virtual void networkActionStateChangedCallback(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur);
     virtual void networkCommunicateCallback(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate);
 public:
@@ -38,7 +38,7 @@ class SwigDirector_CpuModel : public CpuModel, public Swig::Director {
 
 public:
     void swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global);
-    SwigDirector_CpuModel(JNIEnv *jenv, char const *name);
+    SwigDirector_CpuModel(JNIEnv *jenv);
     virtual double shareResources(double now);
     virtual double shareResourcesLazy(double now);
     virtual double shareResourcesFull(double now);
index 660d85b..7e0c774 100644 (file)
@@ -99,7 +99,7 @@ GETDIRECTOR(CpuAction)
 %typemap(freearg) char* name {
 }
 
-/* Handle xbt_dynar_t of NetworkLink */
+/* Handle xbt_dynar_t of Link */
 JAVA_ARRAYSOFCLASSES(Action);
 %apply Action[] {ActionArrayPtr};
 %typemap(jstype) ActionArrayPtr "Action[]"
@@ -121,7 +121,7 @@ JAVA_ARRAYSOFCLASSES(Action);
   jlong *elts = jenv->GetLongArrayElements($result, NULL);
   l = 0;
   for(ActionList::iterator it($1->begin()), itend($1->end()); it != itend ; ++it) {
-    elts[l++] = (jlong)static_cast<ActionPtr>(&*it);
+    elts[l++] = (jlong)static_cast<Action*>(&*it);
   }
   jenv->ReleaseLongArrayElements($result, elts, 0);
 }
@@ -137,19 +137,19 @@ public:
 }
 };
 
-/* Handle xbt_dynar_t of NetworkLink */
-JAVA_ARRAYSOFCLASSES(NetworkLink);
-%apply NetworkLink[] {NetworkLinkDynar};
-%typemap(jstype) NetworkLinkDynar "NetworkLink[]"
-%typemap(javain) NetworkLinkDynar "NetworkLink.cArrayUnwrap($javainput)"
-%typemap(javaout) NetworkLinkDynar {
-     return NetworkLink.cArrayWrap($jnicall, $owner);
+/* Handle xbt_dynar_t of Link */
+JAVA_ARRAYSOFCLASSES(Link);
+%apply Link[] {LinkDynar};
+%typemap(jstype) LinkDynar "Link[]"
+%typemap(javain) LinkDynar "Link.cArrayUnwrap($javainput)"
+%typemap(javaout) LinkDynar {
+     return Link.cArrayWrap($jnicall, $owner);
 }
-%typemap(out) NetworkLinkDynar {
+%typemap(out) LinkDynar {
   long l = xbt_dynar_length($1);
   $result = jenv->NewLongArray(l);
   unsigned i;
-  NetworkLink *link;
+  Link *link;
   jlong *elts = jenv->GetLongArrayElements($result, NULL);
   xbt_dynar_foreach($1, i, link) {
     elts[i] = (jlong)link;
@@ -236,8 +236,8 @@ struct tmgr_trace_event {
 %nodefaultctor Model;
 class Model {
 public:
-  Model(const char *name);
-  const char *getName();
+  Model();
+  
   virtual double shareResources(double now);
   virtual double shareResourcesLazy(double now);
   virtual double shareResourcesFull(double now);
@@ -254,7 +254,7 @@ public:
 %feature("director") CpuModel;
 class CpuModel : public Model {
 public:
-  CpuModel(const char *name);
+  CpuModel();
   virtual ~CpuModel();
   virtual Cpu *createCpu(const char *name, DoubleDynar power_peak,
                               int pstate, double power_scale,
@@ -298,10 +298,10 @@ public:
   void setState(e_surf_resource_state_t state);
 };
 
-class NetworkLink : public Resource {
+class Link : public Resource {
 public:
-  NetworkLink();
-  ~NetworkLink();
+  Link();
+  ~Link();
   double getBandwidth();
   void updateBandwidth(double value, double date=surf_get_clock());
   double getLatency();
index fef1748..b7f62f8 100644 (file)
@@ -35,17 +35,15 @@ void setCpuModel(CpuModel *cpuModel){
 }
 
 void setCpu(char *name, Cpu *cpu) {
-  xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
+       sg_host_surfcpu_set(sg_host_by_name(name), cpu);
 }
 
-NetworkLinkDynar getRoute(char *srcName, char *dstName) {
-  RoutingEdge *src = (RoutingEdge*)xbt_lib_get_or_null(host_lib, srcName, ROUTING_HOST_LEVEL);
-  RoutingEdge *dst = (RoutingEdge*)xbt_lib_get_or_null(host_lib, dstName, ROUTING_HOST_LEVEL);
-  if (src==NULL)
-    xbt_die("TOTO");
-  if (dst==NULL)
-    xbt_die("TOTO");
-  xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdgePtr), NULL);
+LinkDynar getRoute(char *srcName, char *dstName) {
+  RoutingEdge *src = sg_host_edge(sg_host_by_name(srcName));
+  RoutingEdge *dst = sg_host_edge(sg_host_by_name(dstName));
+  xbt_assert(src,"Cannot get the route from a NULL source");
+  xbt_assert(dst,"Cannot get the route to a NULL destination");
+  xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdge*), NULL);
   routing_platf->getRouteAndLatency(src, dst, &route, NULL);
   return route;
 }
@@ -67,15 +65,15 @@ void Plugin::activateCpuActionStateChangedCallback(){
 }
 
 
-void Plugin::activateNetworkLinkCreatedCallback(){
+void Plugin::activateLinkCreatedCallback(){
   surf_callback_connect(networkLinkCreatedCallbacks, boost::bind(&Plugin::networkLinkCreatedCallback, this, _1));
 }
 
-void Plugin::activateNetworkLinkDestructedCallback(){
+void Plugin::activateLinkDestructedCallback(){
   surf_callback_connect(networkLinkDestructedCallbacks, boost::bind(&Plugin::networkLinkDestructedCallback, this, _1));
 }
 
-void Plugin::activateNetworkLinkStateChangedCallback(){
+void Plugin::activateLinkStateChangedCallback(){
   surf_callback_connect(networkLinkStateChangedCallbacks, boost::bind(&Plugin::networkLinkStateChangedCallback, this, _1, _2, _3));
 }
 
index 4211ce1..eaea508 100644 (file)
@@ -10,7 +10,7 @@
 #include "src/surf/network_interface.hpp"
 #include "src/surf/maxmin_private.hpp"
 
-typedef xbt_dynar_t NetworkLinkDynar;
+typedef xbt_dynar_t LinkDynar;
 typedef ActionList *ActionArrayPtr;
 
 double getClock();
@@ -22,7 +22,7 @@ void setCpuModel(CpuModel *cpuModel);
 
 void setCpu(char *name, Cpu *cpu);
 
-NetworkLinkDynar getRoute(char *srcName, char *dstName);
+LinkDynar getRoute(char *srcName, char *dstName);
 
 class Plugin {
 public:
@@ -43,14 +43,14 @@ public:
  virtual void cpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t, e_surf_action_state_t) {}
 
 
- void activateNetworkLinkCreatedCallback();
- virtual void networkLinkCreatedCallback(NetworkLink *link) {}
+ void activateLinkCreatedCallback();
+ virtual void networkLinkCreatedCallback(Link *link) {}
 
- void activateNetworkLinkDestructedCallback();
- virtual void networkLinkDestructedCallback(NetworkLink *link) {}
+ void activateLinkDestructedCallback();
+ virtual void networkLinkDestructedCallback(Link *link) {}
 
- void activateNetworkLinkStateChangedCallback();
- virtual void networkLinkStateChangedCallback(NetworkLink *link, e_surf_resource_state_t, e_surf_resource_state_t) {}
+ void activateLinkStateChangedCallback();
+ virtual void networkLinkStateChangedCallback(Link *link, e_surf_resource_state_t, e_surf_resource_state_t) {}
 
  void activateNetworkActionStateChangedCallback();
  virtual void networkActionStateChangedCallback(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur) {}
index 24eb9a9..02a6c89 100644 (file)
   public";
 
 
-%typemap(javaimports) NetworkLink "
+%typemap(javaimports) Link "
 /**
  * A generic resource for the network component
  */"
 
-  %javamethodmodifiers NetworkLink::getBandwidth() "
+  %javamethodmodifiers Link::getBandwidth() "
   /**
     * @return The bandwidth of the link
     */
   public";
 
-%javamethodmodifiers NetworkLink::updateBandwidth(double value, double date=surf_get_clock()) "
+%javamethodmodifiers Link::updateBandwidth(double value, double date=surf_get_clock()) "
   /**
     * @param value The new bandwidth
     */
   public";
 
-  %javamethodmodifiers NetworkLink::getLatency() "
+  %javamethodmodifiers Link::getLatency() "
   /**
     * @return The latency of the link
     */
   public";
 
-%javamethodmodifiers NetworkLink::updateLatency(double value, double date=surf_get_clock()) "
+%javamethodmodifiers Link::updateLatency(double value, double date=surf_get_clock()) "
   /**
     * @param value The new latency
     */
 %typemap(javaimports) NetworkAction "
 /**
   * An network action created by network model
-  * @see NetworkLink
+  * @see Link
   */"
 
 %javamethodmodifiers NetworkAction::getLatency() "
index 21c697c..4d65ac6 100644 (file)
@@ -50,7 +50,7 @@ static int l_host_get_by_name(lua_State * L)
 {
   const char *name = luaL_checkstring(L, 1);
   XBT_DEBUG("Getting Host from name...");
-  msg_host_t msg_host = MSG_get_host_by_name(name);
+  msg_host_t msg_host = MSG_host_by_name(name);
   if (!msg_host) {
     luaL_error(L, "null Host : MSG_get_host_by_name failed");
   }
@@ -183,8 +183,8 @@ static int l_host_sleep(lua_State *L)
  */
 static int l_host_destroy(lua_State *L)
 {
-  msg_host_t ht = sglua_check_host(L, 1);
-  __MSG_host_priv_free(MSG_host_priv(ht));
+  //msg_host_t ht = sglua_check_host(L, 1);
+  //FIXME: not working..__MSG_host_priv_free(MSG_host_priv(ht));
   return 0;
 }
 
index a985f6b..56f429f 100644 (file)
@@ -63,8 +63,10 @@ int console_close(lua_State *L) {
   xbt_lib_foreach(host_lib, cursor, name, data) {
     if(data[SURF_HOST_LEVEL]){
       XBT_DEBUG("\tSee surf host %s",name);
-      SIMIX_host_create(name, NULL);
-      __MSG_host_create((smx_host_t)data[SIMIX_HOST_LEVEL]);
+      SIMIX_host_create(name);
+      // THIS IS BRAINDEAD. There is no sg_host_t in that level, but a smx_host_priv. So commenting out for now.
+      // Lua is broken anyway. Christian will fix it
+      // __MSG_host_create((sg_host_t)data[SIMIX_HOST_LEVEL]);
     }
   }
 
@@ -367,8 +369,7 @@ int console_set_function(lua_State *L) {
   args = xbt_str_split_str( lua_tostring(L,-1) , ",");
   lua_pop(L, 1);
 
-  // FIXME: hackish to go under MSG that way
-  msg_host_t host = xbt_lib_get_or_null(host_lib,host_id,MSG_HOST_LEVEL);
+  msg_host_t host = MSG_host_by_name(host_id);
   if (!host) {
     XBT_ERROR("no host '%s' found",host_id);
     return -1;
@@ -407,8 +408,7 @@ int console_host_set_property(lua_State *L) {
   prop_value = lua_tostring(L,-1);
   lua_pop(L, 1);
 
-  // FIXME: hackish to go under MSG that way
-  msg_host_t host = xbt_lib_get_or_null(host_lib,name,MSG_HOST_LEVEL);
+  msg_host_t host = MSG_host_by_name(name);
   if (!host) {
     XBT_ERROR("no host '%s' found",name);
     return -1;
index 32dc7ad..c081bcb 100644 (file)
@@ -56,7 +56,6 @@ class ResourceLmm;
 class Host;
 class HostCLM03;
 class NetworkCm02Link;
-class Cpu;
 class Action;
 class ActionLmm;
 class StorageActionLmm;
@@ -75,7 +74,6 @@ typedef struct ResourceLmm ResourceLmm;
 typedef struct HostCLM03 HostCLM03;
 typedef struct Host Host;
 typedef struct NetworkCm02Link NetworkCm02Link;
-typedef struct Cpu Cpu;
 typedef struct Action Action;
 typedef struct ActionLmm ActionLmm;
 typedef struct StorageActionLmm StorageActionLmm;
@@ -101,9 +99,6 @@ typedef StorageModel *surf_storage_model_t;
 typedef xbt_dictelm_t surf_resource_t;
 typedef Resource *surf_cpp_resource_t;
 typedef Host *surf_host_t;
-typedef HostCLM03 *surf_host_CLM03_t;
-typedef NetworkCm02Link *surf_network_link_t;
-typedef Cpu *surf_cpu_t;
 
 /** @ingroup SURF_c_bindings
  *  \brief Action structure
@@ -163,8 +158,7 @@ typedef enum {
   SURF_ACTION_FAILED,           /**< Task Failure */
   SURF_ACTION_DONE,             /**< Completed    */
   SURF_ACTION_TO_FREE,          /**< Action to free in next cleanup */
-  SURF_ACTION_NOT_IN_THE_SYSTEM
-                                /**< Not in the system anymore. Why did you ask ? */
+  SURF_ACTION_NOT_IN_THE_SYSTEM /**< Not in the system anymore. Why did you ask ? */
 } e_surf_action_state_t;
 
 /** @ingroup SURF_vm_interface
@@ -188,41 +182,25 @@ typedef enum {
 
 XBT_PUBLIC_DATA(routing_platf_t) routing_platf;
 
-static inline surf_cpu_t surf_cpu_resource_priv(const void *host) {
-  return (surf_cpu_t)xbt_lib_get_level((xbt_dictelm_t)host, SURF_CPU_LEVEL);
-}
 static inline surf_host_t surf_host_resource_priv(const void *host){
   return (surf_host_t) xbt_lib_get_level((xbt_dictelm_t)host, SURF_HOST_LEVEL);
 }
-static inline void *surf_routing_resource_priv(const void *host){
-  return (void*)xbt_lib_get_level((xbt_dictelm_t)host, ROUTING_HOST_LEVEL);
-}
 static inline void *surf_storage_resource_priv(const void *storage){
   return (void*)xbt_lib_get_level((xbt_dictelm_t)storage, SURF_STORAGE_LEVEL);
 }
 
-static inline void *surf_cpu_resource_by_name(const char *name) {
-  return xbt_lib_get_elm_or_null(host_lib, name);
-}
-static inline void *surf_host_resource_by_name(const char *name){
-  return xbt_lib_get_elm_or_null(host_lib, name);
-}
 static inline void *surf_storage_resource_by_name(const char *name){
   return xbt_lib_get_elm_or_null(storage_lib, name);
 }
 
-
-XBT_PUBLIC(char *) surf_routing_edge_name(sg_routing_edge_t edge);
 XBT_PUBLIC(void *) surf_as_cluster_get_backbone(AS_t as);
 XBT_PUBLIC(void) surf_as_cluster_set_backbone(AS_t as, void* backbone);
 
 /** @{ @ingroup SURF_c_bindings */
 
-/**
- * @brief Get the name of a surf model
+/** @brief Get the name of a surf model (dont rely on exact value)
  *
- * @param model A model
- * @return The name of the model
+ * This is implemented using typeid(), so it may change with the compiler
  */
 XBT_PUBLIC(const char *) surf_model_name(surf_model_t model);
 
@@ -280,45 +258,18 @@ XBT_PUBLIC(int) surf_model_running_action_set_size(surf_model_t model);
  */
 XBT_PUBLIC(surf_action_t) surf_host_model_execute_parallel_task(surf_host_model_t model,
                                                    int host_nb,
-                                            void **host_list,
+                                                                                       sg_host_t *host_list,
                                             double *flops_amount,
                                             double *bytes_amount,
                                             double rate);
 
-/**
- * @brief Create a communication between two hosts
- *
- * @param model The model which handle the communication
- * @param src The source host
- * @param dst The destination host
- * @param size The amount of data (in bytes) needed to transfer
- * @param rate [description]
- * @return The action corresponding to the communication
- */
-XBT_PUBLIC(surf_action_t) surf_host_model_communicate(surf_host_model_t model, surf_resource_t src, surf_resource_t dst, double size, double rate);
-
-/**
- * @brief Get the route between two hosts
- * @details [long description]
- *
- * @param model The model which handle the routes
- * @param src The source host
- * @param dst The destination host
- * @return The list of [TODO] from the source to the host
- */
+/** @brief Get the route (dynar of sg_link_t) between two hosts */
 XBT_PUBLIC(xbt_dynar_t) surf_host_model_get_route(surf_host_model_t model, surf_resource_t src, surf_resource_t dst);
 
-/**
- * @brief Create a new VM on the specified host
- *
- * @param name The name of the VM
- * @param host_PM The host on which the VM is created
- */
+/** @brief Create a new VM on the specified host */
 XBT_PUBLIC(void) surf_vm_model_create(const char *name, surf_resource_t host_PM);
 
-/**
- * @brief Create a communication between two routing edges [TODO]
- * @details [long description]
+/** @brief Create a communication between two hosts
  *
  * @param model The model which handle the communication
  * @param src The source host
@@ -327,7 +278,7 @@ XBT_PUBLIC(void) surf_vm_model_create(const char *name, surf_resource_t host_PM)
  * @param rate [description]
  * @return The action corresponding to the communication
  */
-XBT_PUBLIC(surf_action_t) surf_network_model_communicate(surf_network_model_t model, sg_routing_edge_t src, sg_routing_edge_t dst, double size, double rate);
+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, â€¦)
@@ -340,24 +291,14 @@ static inline const char * surf_cpu_name(surf_cpu_t cpu) {
        return surf_resource_name((surf_cpp_resource_t)cpu);
 }
 
-/**
- * @brief Get the properties of a surf resource (cpu, host, network, â€¦)
- *
- * @param resource The surf resource
- * @return The properties of the surf resource
- */
+/** @brief Get the properties of a surf resource (cpu, host, network, â€¦) */
 XBT_PUBLIC(xbt_dict_t) surf_resource_get_properties(surf_cpp_resource_t resource);
 static XBT_INLINE xbt_dict_t surf_host_get_properties(surf_host_t host) {
        return surf_resource_get_properties((surf_cpp_resource_t)host);
 }
 
 
-/**
- * @brief Get the state of a surf resource (cpu, host, network, â€¦)
- *
- * @param resource The surf resource
- * @return The state of the surf resource
- */
+/** @brief Get the state of a surf resource (cpu, host, network, â€¦) */
 XBT_PUBLIC(e_surf_resource_state_t) surf_resource_get_state(surf_cpp_resource_t resource);
 
 static XBT_INLINE e_surf_resource_state_t surf_host_get_state(surf_host_t host) {
@@ -365,12 +306,7 @@ static XBT_INLINE e_surf_resource_state_t surf_host_get_state(surf_host_t host)
 }
 
 
-/**
- * @brief Set the state of a surf resource (cpu, host, network, â€¦)
- *
- * @param resource The surf resource
- * @param state The new state of the surf resource
- */
+/** @brief Set the state of a surf resource (cpu, host, network, â€¦) */
 XBT_PUBLIC(void) surf_resource_set_state(surf_cpp_resource_t resource, e_surf_resource_state_t state);
 static inline void surf_host_set_state(surf_host_t host, e_surf_resource_state_t state) {
        surf_resource_set_state((surf_cpp_resource_t)host, state);
@@ -392,72 +328,27 @@ XBT_PUBLIC(double) surf_host_get_speed(surf_resource_t resource, double load);
  * @param resource The surf host
  * @return [description]
  */
-XBT_PUBLIC(double) surf_host_get_available_speed(surf_resource_t resource);
+XBT_PUBLIC(double) surf_host_get_available_speed(surf_resource_t host);
 
-/**
- * @brief Get the number of cores of the cpu associated to a host
- *
- * @param resource The surf host
- * @return The number of cores
- */
-XBT_PUBLIC(int) surf_host_get_core(surf_resource_t resource);
+/** @brief Get the number of cores of the cpu associated to a host */
+XBT_PUBLIC(int) surf_host_get_core(surf_resource_t host);
 
-/**
- * @brief Execute some quantity of computation
- *
- * @param resource The surf host
- * @param size The value of the processing amount (in flop) needed to process
- *
- * @return The surf action corresponding to the processing
- */
-XBT_PUBLIC(surf_action_t) surf_host_execute(surf_resource_t resource, double size);
+/** @brief Create a computation action on the given host */
+XBT_PUBLIC(surf_action_t) surf_host_execute(surf_resource_t host, double size);
 
-/**
- * @brief Make the host sleep
- *
- * @param resource The surf host
- * @param duration The number of seconds to sleep
- * @return The surf action corresponding to the sleep
- */
-XBT_PUBLIC(surf_action_t) surf_host_sleep(surf_resource_t resource, double duration);
+/** @brief Create a sleep action on the given host */
+XBT_PUBLIC(surf_action_t) surf_host_sleep(surf_resource_t host, double duration);
 
-/**
- * @brief Open a file on an host
- *
- * @param host The surf host
- * @param fullpath The path to the file
- * @return The surf action corresponding to the openning
- */
+/** @brief Create a file opening action on the given host */
 XBT_PUBLIC(surf_action_t) surf_host_open(surf_resource_t host, const char* fullpath);
 
-/**
- * @brief Close a file descriptor on an host
- *
- * @param host The surf host
- * @param fd The file descriptor
- *
- * @return The surf action corresponding to the closing
- */
+/** @brief Create a file closing action on the given host */
 XBT_PUBLIC(surf_action_t) surf_host_close(surf_resource_t host, surf_file_t fd);
 
-/**
- * @brief Read a file
- *
- * @param host The surf host
- * @param fd The file descriptor to read
- * @param size The size in bytes to read
- * @return The surf action corresponding to the reading
- */
+/** @brief Create a file reading action on the given host */
 XBT_PUBLIC(surf_action_t) surf_host_read(surf_resource_t host, surf_file_t fd, sg_size_t size);
 
-/**
- * @brief Write a file
- *
- * @param host The surf host
- * @param fd The file descriptor to write
- * @param size The size in bytes to write
- * @return The surf action corresponding to the writing
- */
+/** @brief Create a file writing action on the given host  */
 XBT_PUBLIC(surf_action_t) surf_host_write(surf_resource_t host, surf_file_t fd, sg_size_t size);
 
 /**
@@ -493,31 +384,18 @@ XBT_PUBLIC(sg_size_t) surf_host_get_free_size(surf_resource_t resource, const ch
  */
 XBT_PUBLIC(sg_size_t) surf_host_get_used_size(surf_resource_t resource, const char* name);
 
-/**
- * @brief Get the VMs hosted on the host
- *
- * @param resource The surf host
- * @return The list of VMs on the host
- */
+/** @brief Get the list of VMs hosted on the host */
 XBT_PUBLIC(xbt_dynar_t) surf_host_get_vms(surf_resource_t resource);
 
-/**
- * @brief [brief description]
- * @details [long description]
- *
- * @param resource [description]
- * @param params [description]
+/** @brief Retrieve the params of that VM
+ * @details You can use fields ramsize and overcommit on a PM, too.
  */
-XBT_PUBLIC(void) surf_host_get_params(surf_resource_t resource, ws_params_t params);
+XBT_PUBLIC(void) surf_host_get_params(surf_resource_t resource, vm_params_t params);
 
-/**
- * @brief [brief description]
- * @details [long description]
- *
- * @param resource [description]
- * @param params [description]
+/** @brief Sets the params of that VM/PM
+ * @details You can use fields ramsize and overcommit on a PM, too.
  */
-XBT_PUBLIC(void) surf_host_set_params(surf_resource_t resource, ws_params_t params);
+XBT_PUBLIC(void) surf_host_set_params(surf_resource_t resource, vm_params_t params);
 
 /**
  * @brief Destroy a VM
@@ -526,18 +404,10 @@ XBT_PUBLIC(void) surf_host_set_params(surf_resource_t resource, ws_params_t para
  */
 XBT_PUBLIC(void) surf_vm_destroy(surf_resource_t resource);
 
-/**
- * @brief Suspend a VM
- *
- * @param resource The surf vm
- */
+/** @brief Suspend a VM */
 XBT_PUBLIC(void) surf_vm_suspend(surf_resource_t resource);
 
-/**
- * @brief Resume a VM
- *
- * @param resource The surf vm
- */
+/** @brief Resume a VM */
 XBT_PUBLIC(void) surf_vm_resume(surf_resource_t resource);
 
 /**
@@ -724,31 +594,6 @@ XBT_PUBLIC(int) surf_host_file_seek(surf_resource_t host,
                                            surf_file_t fd, sg_offset_t offset,
                                            int origin);
 
-/**
- * @brief [brief description]
- * @details [long description]
- *
- * @param link [description]
- * @return [description]
- */
-XBT_PUBLIC(int) surf_network_link_is_shared(surf_cpp_resource_t link);
-
-/**
- * @brief Get the bandwidth of a link in bytes per second
- *
- * @param link The surf link
- * @return The bandwidth in bytes per second
- */
-XBT_PUBLIC(double) surf_network_link_get_bandwidth(surf_cpp_resource_t link);
-
-/**
- * @brief Get the latency of a link in seconds
- *
- * @param link The surf link
- * @return The latency in seconds
- */
-XBT_PUBLIC(double) surf_network_link_get_latency(surf_cpp_resource_t link);
-
 /**
  * @brief Get the content of a storage
  *
index 752649e..76f92be 100644 (file)
@@ -55,11 +55,12 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe
   new->name = xbt_strdup (name); // name of the container
   new->id = xbt_strdup (id_str); // id (or alias) of the container
   new->father = father;
+  sg_host_t sg_host = sg_host_by_name(name);
 
   //Search for network_element_t
   switch (kind){
     case INSTR_HOST:
-      new->net_elm = xbt_lib_get_or_null(host_lib,name,ROUTING_HOST_LEVEL);
+      new->net_elm = sg_host_edge(sg_host);
       if(!new->net_elm) xbt_die("Element '%s' not found",name);
       break;
     case INSTR_ROUTER:
index f48a80c..c80d9dd 100644 (file)
 #include "mc_client.h"
 #include "ModelChecker.hpp"
 
+/** \file mc_client_api.cpp
+ *
+ *  This is the implementation of the API used by the user simulated program to
+ *  communicate with the MC (declared in modelchecker.h).
+ */
+
 extern "C" {
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client_api, mc,
@@ -55,13 +61,42 @@ void MC_cut(void)
 
 void MC_ignore(void* addr, size_t size)
 {
-  if (mc_mode == MC_MODE_CLIENT) {
-    s_mc_ignore_memory_message_t message;
-    message.type = MC_MESSAGE_IGNORE_MEMORY;
-    message.addr = (std::uintptr_t) addr;
-    message.size = size;
-    MC_client_send_message(&message, sizeof(message));
-  }
+  xbt_assert(mc_mode != MC_MODE_SERVER);
+  if (mc_mode != MC_MODE_CLIENT)
+    return;
+
+  s_mc_ignore_memory_message_t message;
+  message.type = MC_MESSAGE_IGNORE_MEMORY;
+  message.addr = (std::uintptr_t) addr;
+  message.size = size;
+  MC_client_send_message(&message, sizeof(message));
+}
+
+void MC_automaton_new_propositional_symbol(const char *id, int(*fct)(void))
+{
+  xbt_assert(mc_mode != MC_MODE_SERVER);
+  if (mc_mode != MC_MODE_CLIENT)
+    return;
+
+  xbt_die("Support for client-side function proposition is not implemented: "
+    "use MC_automaton_new_propositional_symbol_pointer instead."
+  );
+}
+
+void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value)
+{
+  xbt_assert(mc_mode != MC_MODE_SERVER);
+  if (mc_mode != MC_MODE_CLIENT)
+    return;
+
+  s_mc_register_symbol_message_t message;
+  message.type = MC_MESSAGE_REGISTER_SYMBOL;
+  if (strlen(name) + 1 > sizeof(message.name))
+    xbt_die("Symbol is too long");
+  strncpy(message.name, name, sizeof(message.name));
+  message.callback = nullptr;
+  message.data = value;
+  MC_client_send_message(&message, sizeof(message));
 }
 
 }
index 1df6abe..610ffac 100644 (file)
@@ -517,49 +517,6 @@ void MC_automaton_load(const char *file)
   xbt_automaton_load(_mc_property_automaton, file);
 }
 
-static void register_symbol(xbt_automaton_propositional_symbol_t symbol)
-{
-  if (mc_mode != MC_MODE_CLIENT)
-    return;
-  s_mc_register_symbol_message_t message;
-  message.type = MC_MESSAGE_REGISTER_SYMBOL;
-  const char* name = xbt_automaton_propositional_symbol_get_name(symbol);
-  if (strlen(name) + 1 > sizeof(message.name))
-    xbt_die("Symbol is too long");
-  strncpy(message.name, name, sizeof(message.name));
-  message.callback = xbt_automaton_propositional_symbol_get_callback(symbol);
-  message.data = xbt_automaton_propositional_symbol_get_data(symbol);
-  MC_client_send_message(&message, sizeof(message));
-}
-
-void MC_automaton_new_propositional_symbol(const char *id, int(*fct)(void))
-{
-  if (_mc_property_automaton == NULL)
-    _mc_property_automaton = xbt_automaton_new();
-
-  xbt_automaton_propositional_symbol_t symbol = xbt_automaton_propositional_symbol_new(_mc_property_automaton, id, fct);
-  register_symbol(symbol);
-}
-
-void MC_automaton_new_propositional_symbol_pointer(const char *id, int* value)
-{
-  if (_mc_property_automaton == NULL)
-    _mc_property_automaton = xbt_automaton_new();
-  xbt_automaton_propositional_symbol_t symbol = xbt_automaton_propositional_symbol_new_pointer(_mc_property_automaton, id, value);
-  register_symbol(symbol);
-}
-
-void MC_automaton_new_propositional_symbol_callback(const char* id,
-  xbt_automaton_propositional_symbol_callback_type callback,
-  void* data, xbt_automaton_propositional_symbol_free_function_type free_function)
-{
-  if (_mc_property_automaton == NULL)
-    _mc_property_automaton = xbt_automaton_new();
-  xbt_automaton_propositional_symbol_t symbol = xbt_automaton_propositional_symbol_new_callback(
-    _mc_property_automaton, id, callback, data, free_function);
-  register_symbol(symbol);
-}
-
 // TODO, fix cross-process access (this function is not used)
 void MC_dump_stacks(FILE* file)
 {
index b882504..b869b19 100644 (file)
@@ -14,6 +14,8 @@
 #include <sys/signalfd.h>
 
 #include <xbt/log.h>
+#include <xbt/automaton.h>
+#include <xbt/automaton.hpp>
 
 #include "ModelChecker.hpp"
 #include "mc_protocol.h"
@@ -22,6 +24,7 @@
 #include "mc_ignore.h"
 #include "mcer_ignore.h"
 #include "mc_exit.h"
+#include "mc/mc_liveness.h"
 
 using simgrid::mc::remote;
 
@@ -35,20 +38,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_server, mc, "MC server logic");
 
 mc_server_t mc_server;
 
-struct mc_symbol_pointer_callback
-{
-  simgrid::mc::Process* process;
-  void* value;
-};
-
-static int mc_symbol_pointer_callback_evaluate(void* p)
-{
-  struct mc_symbol_pointer_callback* callback = (struct mc_symbol_pointer_callback*) p;
-  int value;
-  callback->process->read_bytes(&value, sizeof(value), remote(callback->value));
-  return value;
-}
-
 s_mc_server::s_mc_server(pid_t pid, int socket)
 {
   this->pid = pid;
@@ -223,15 +212,20 @@ bool s_mc_server::handle_events()
             xbt_die("Broken message");
           memcpy(&message, buffer, sizeof(message));
           if (message.callback)
-            xbt_die("Support for callbacks/functions symbols not implemented in client/server mode.");
+            xbt_die("Support for client-side function proposition is not implemented.");
           XBT_DEBUG("Received symbol: %s", message.name);
 
-          struct mc_symbol_pointer_callback* callback = xbt_new(struct mc_symbol_pointer_callback, 1);
-          callback->process = &mc_model_checker->process();
-          callback->value   = message.data;
+          if (_mc_property_automaton == NULL)
+            _mc_property_automaton = xbt_automaton_new();
+
+          simgrid::mc::Process* process = &mc_model_checker->process();
+          simgrid::mc::remote_ptr<int> address
+            = simgrid::mc::remote((int*) message.data);
+          simgrid::xbt::add_proposition(_mc_property_automaton,
+            message.name,
+            [process, address]() { return process->read(address); }
+            );
 
-          MC_automaton_new_propositional_symbol_callback(message.name,
-            mc_symbol_pointer_callback_evaluate, callback, free);
           break;
         }
 
index fef3604..8a042aa 100644 (file)
@@ -44,8 +44,7 @@ void MSG_post_create_environment(void) {
 
   /* Initialize MSG hosts */
   xbt_lib_foreach(host_lib, cursor, name, data) {
-    if(data[SIMIX_HOST_LEVEL])
-      __MSG_host_create(xbt_dict_cursor_get_elm(cursor));
+       __MSG_host_create(xbt_dict_cursor_get_elm(cursor));
   }
 
   /* Initialize MSG storages */
index bfb859b..4a39e27 100644 (file)
@@ -70,7 +70,6 @@ void MSG_init_nocheck(int *argc, char **argv) {
   }
 
   XBT_DEBUG("ADD MSG LEVELS");
-  MSG_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __MSG_host_priv_free);
   MSG_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, (void_f_pvoid_t) __MSG_storage_destroy);
   MSG_FILE_LEVEL = xbt_lib_add_level(file_lib, (void_f_pvoid_t) __MSG_file_destroy);
   if(sg_cfg_get_boolean("clean_atexit")) atexit(MSG_exit);
index 11218c9..92e7815 100644 (file)
@@ -73,7 +73,7 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task)
       simdata->isused = (void*)1;
 
     if (simdata->host_nb > 0) {
-      simdata->compute = simcall_host_parallel_execute(task->name,
+      simdata->compute = simcall_process_parallel_execute(task->name,
                                                        simdata->host_nb,
                                                        simdata->host_list,
                                                        simdata->flops_parallel_amount,
@@ -84,8 +84,7 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task)
       unsigned long affinity_mask = (unsigned long) xbt_dict_get_or_null_ext(simdata->affinity_mask_db, (char *) p_simdata->m_host, sizeof(msg_host_t));
       XBT_DEBUG("execute %s@%s with affinity(0x%04lx)", MSG_task_get_name(task), MSG_host_get_name(p_simdata->m_host), affinity_mask);
 
-      simdata->compute = simcall_host_execute(task->name,
-                                              p_simdata->m_host,
+      simdata->compute = simcall_process_execute(task->name,
                                               simdata->flops_amount,
                                               simdata->priority,
                                               simdata->bound,
@@ -95,7 +94,7 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task)
     }
     simcall_set_category(simdata->compute, task->category);
     p_simdata->waiting_action = simdata->compute;
-    comp_state = simcall_host_execution_wait(simdata->compute);
+    comp_state = simcall_process_execution_wait(simdata->compute);
 
     p_simdata->waiting_action = NULL;
 
index 7da0e29..cf97815 100644 (file)
@@ -26,9 +26,8 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg);
  */
 
 /********************************* Host **************************************/
-msg_host_t __MSG_host_create(smx_host_t host)
+msg_host_t __MSG_host_create(sg_host_t host) // FIXME: don't return our parameter
 {
-  const char *name = SIMIX_host_get_name(host);
   msg_host_priv_t priv = xbt_new0(s_msg_host_priv_t, 1);
 
 #ifdef MSG_USE_DEPRECATED
@@ -55,12 +54,11 @@ msg_host_t __MSG_host_create(smx_host_t host)
 
   priv->affinity_mask_db = xbt_dict_new_homogeneous(NULL);
 
-  xbt_lib_set(host_lib, name, MSG_HOST_LEVEL, priv);
+  sg_host_msg_set(host,priv);
   
-  return xbt_lib_get_elm_or_null(host_lib, name);
+  return host;
 }
 
-
 /** \ingroup m_host_management
  * \brief Finds a msg_host_t using its name.
  *
@@ -68,7 +66,7 @@ msg_host_t __MSG_host_create(smx_host_t host)
  * \param name the name of an host.
  * \return the corresponding host
  */
-msg_host_t MSG_get_host_by_name(const char *name)
+msg_host_t MSG_host_by_name(const char *name)
 {
   return (msg_host_t) xbt_lib_get_elm_or_null(host_lib,name);
 }
@@ -147,6 +145,9 @@ void MSG_host_off(msg_host_t host)
  */
 void __MSG_host_priv_free(msg_host_priv_t priv)
 {
+
+  if (priv == NULL)
+         return;
   unsigned int size = xbt_dict_size(priv->dp_objs);
   if (size > 0)
     XBT_WARN("dp_objs: %u pending task?", size);
@@ -163,15 +164,13 @@ void __MSG_host_priv_free(msg_host_priv_t priv)
 /*
  * \brief Destroys a host (internal call only)
  */
-void __MSG_host_destroy(msg_host_t host)
+void __MSG_host_destroy(msg_host_t host) //FIXME: killme?
 {
-  const char *name = MSG_host_get_name(host);
   /* TODO:
    * What happens if VMs still remain on this host?
    * Revisit here after the surf layer gets stable.
    **/
-
-  xbt_lib_unset(host_lib, name, MSG_HOST_LEVEL, 1);
+  sg_host_msg_destroy(host);
 }
 
 /** \ingroup m_host_management
@@ -210,18 +209,7 @@ msg_host_t *MSG_get_host_table(void)
  * \remark The host order in the returned array is generally different from the host creation/declaration order in the XML platform (we use a hash table internally)
  */
 xbt_dynar_t MSG_hosts_as_dynar(void) {
-  xbt_lib_cursor_t cursor;
-  char *key;
-  void **data;
-  xbt_dynar_t res = xbt_dynar_new(sizeof(msg_host_t),NULL);
-
-  xbt_lib_foreach(host_lib, cursor, key, data) {
-    if(routing_get_network_element_type(key) == SURF_NETWORK_ELEMENT_HOST) {
-      xbt_dictelm_t elm = xbt_dict_cursor_get_elm(cursor);
-      xbt_dynar_push(res, &elm);
-    }
-  }
-  return res;
+  return sg_hosts_as_dynar();
 }
 
 /** \ingroup m_host_management
@@ -346,7 +334,7 @@ int MSG_host_is_off(msg_host_t host)
  * \param host a host
  * \param params a prameter object
  */
-void MSG_host_set_params(msg_host_t host, ws_params_t params)
+void MSG_host_set_params(msg_host_t host, vm_params_t params)
 {
   simcall_host_set_params(host, params);
 }
@@ -357,7 +345,7 @@ void MSG_host_set_params(msg_host_t host, ws_params_t params)
  * \param host a host
  * \param params a prameter object
  */
-void MSG_host_get_params(msg_host_t host, ws_params_t params)
+void MSG_host_get_params(msg_host_t host, vm_params_t params)
 {
   simcall_host_get_params(host, params);
 }
@@ -440,12 +428,6 @@ double MSG_host_get_wattmin_at(msg_host_t host, int pstate){
 double MSG_host_get_wattmax_at(msg_host_t host, int pstate){
        return simcall_host_get_wattmax_at(host, pstate);
 }
-/** \ingroup m_host_management
- * \brief Set the parameters of a given host
- *
- * \param host a host
- * \param params a prameter object
- */
 
 /** \ingroup m_host_management
  * \brief Return the list of mount point names on an host.
index efee6ce..583673f 100644 (file)
@@ -100,7 +100,7 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size)
   /* Find the host where the file is physically located and read it */
   msg_storage_t storage_src =(msg_storage_t) xbt_lib_get_elm_or_null(storage_lib, file_priv->storageId);
   msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src);
-  msg_host_t attached_host = MSG_get_host_by_name(storage_priv_src->hostname);
+  msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname);
   read_size = simcall_file_read(file_priv->simdata->smx_file, size, attached_host);
 
   if(strcmp(storage_priv_src->hostname, MSG_host_get_name(MSG_host_self()))){
@@ -145,7 +145,7 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size)
   /* Find the host where the file is physically located (remote or local)*/
   msg_storage_t storage_src =(msg_storage_t) xbt_lib_get_elm_or_null(storage_lib, file_priv->storageId);
   msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src);
-  msg_host_t attached_host = MSG_get_host_by_name(storage_priv_src->hostname);
+  msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname);
 
   if(strcmp(storage_priv_src->hostname, MSG_host_get_name(MSG_host_self()))){
     /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
@@ -237,7 +237,7 @@ msg_error_t MSG_file_unlink(msg_file_t fd)
       (msg_storage_t) xbt_lib_get_elm_or_null(storage_lib,
                                               file_priv->storageId);
   msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src);
-  msg_host_t attached_host = MSG_get_host_by_name(storage_priv_src->hostname);
+  msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname);
   int res = simcall_file_unlink(file_priv->simdata->smx_file, attached_host);
   return res;
 }
@@ -323,7 +323,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
   /* Find the host where the file is physically located and read it */
   msg_storage_t storage_src =(msg_storage_t) xbt_lib_get_elm_or_null(storage_lib, file_priv->storageId);
   msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src);
-  msg_host_t attached_host = MSG_get_host_by_name(storage_priv_src->hostname);
+  msg_host_t attached_host = MSG_host_by_name(storage_priv_src->hostname);
   MSG_file_seek(file, 0, SEEK_SET);
   read_size = simcall_file_read(file_priv->simdata->smx_file, file_priv->size, attached_host);
 
@@ -353,7 +353,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
     /* Mount point found, retrieve the host the storage is attached to */
     msg_storage_priv_t storage_dest_priv = MSG_storage_priv(storage_dest);
     host_name_dest = (char*)storage_dest_priv->hostname;
-    host_dest = MSG_get_host_by_name(host_name_dest);
+    host_dest = MSG_host_by_name(host_name_dest);
 
   }else{
     XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, SIMIX_host_get_name(host));
index bd007ac..a8c25c2 100644 (file)
@@ -56,7 +56,7 @@ typedef struct simdata_task {
   void *isused;  /* Indicates whether the task is used in SIMIX currently */
   int host_nb;                  /* ==0 if sequential task; parallel task if not */
   /*******  Parallel Tasks Only !!!! *******/
-  smx_host_t *host_list;
+  sg_host_t *host_list;
   double *flops_parallel_amount;
   double *bytes_parallel_amount;
 } s_simdata_task_t;
@@ -154,14 +154,15 @@ XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
 #  define MSG_RETURN(val) return(val)
 #endif
 
-msg_host_t __MSG_host_create(smx_host_t host);
+msg_host_t __MSG_host_create(sg_host_t host);
 msg_storage_t __MSG_storage_create(smx_storage_t storage);
 void __MSG_host_destroy(msg_host_t host);
+void __MSG_host_priv_free(msg_host_priv_t priv);
 void __MSG_storage_destroy(msg_storage_priv_t host);
 void __MSG_file_destroy(msg_file_priv_t host);
 
 void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc);
-void MSG_process_create_from_SIMIX(smx_process_t *process, const char *name,
+smx_process_t MSG_process_create_from_SIMIX(const char *name,
                                    xbt_main_func_t code, void *data,
                                    const char *hostname, double kill_time,
                                    int argc, char **argv,
@@ -171,10 +172,6 @@ void MSG_comm_copy_data_from_SIMIX(smx_synchro_t comm, void* buff, size_t buff_s
 
 void MSG_post_create_environment(void);
 
-static inline void *msg_host_resource_priv(const void *host) {
-  return xbt_lib_get_level((void *)host, MSG_HOST_LEVEL);
-}
-
 void MSG_host_add_task(msg_host_t host, msg_task_t task);
 void MSG_host_del_task(msg_host_t host, msg_task_t task);
 
index 44d3838..0589483 100644 (file)
@@ -53,14 +53,14 @@ void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc)
 }
 
 /* This function creates a MSG process. It has the prototype enforced by SIMIX_function_register_process_create */
-void MSG_process_create_from_SIMIX(smx_process_t* process, const char *name,
+smx_process_t MSG_process_create_from_SIMIX(const char *name,
                                    xbt_main_func_t code, void *data,
                                    const char *hostname, double kill_time,
                                    int argc, char **argv,
                                    xbt_dict_t properties, int auto_restart,
                                    smx_process_t parent_process)
 {
-  msg_host_t host = MSG_get_host_by_name(hostname);
+  msg_host_t host = MSG_host_by_name(hostname);
   msg_process_t p = MSG_process_create_with_environment(name, code, data,
                                                       host, argc, argv,
                                                       properties);
@@ -68,7 +68,7 @@ void MSG_process_create_from_SIMIX(smx_process_t* process, const char *name,
     MSG_process_set_kill_time(p,kill_time);
     MSG_process_auto_restart_set(p,auto_restart);
   }
-  *((msg_process_t*) process) = p;
+  return p;
 }
 
 /** \ingroup m_process_management
@@ -166,7 +166,7 @@ msg_process_t MSG_process_create_with_environment(const char *name,
 
   /* Let's create the process: SIMIX may decide to start it right now,
    * even before returning the flow control to us */
simcall_process_create(&process, name, code, simdata, sg_host_name(host), -1,
process = simcall_process_create(name, code, simdata, sg_host_name(host), -1,
                            argc, argv, properties,0);
 
   TRACE_msg_process_create(name, SIMIX_process_get_PID(process), host);
index c6055c5..56b3d09 100644 (file)
@@ -107,7 +107,7 @@ MSG_parallel_task_create(const char *name, int host_nb,
 
   /* Simulator Data specific to parallel tasks */
   simdata->host_nb = host_nb;
-  simdata->host_list = xbt_new0(smx_host_t, host_nb);
+  simdata->host_list = xbt_new0(sg_host_t, host_nb);
   simdata->flops_parallel_amount = flops_amount;
   simdata->bytes_parallel_amount = bytes_amount;
 
@@ -273,7 +273,7 @@ msg_error_t MSG_task_destroy(msg_task_t task)
 
   action = task->simdata->compute;
   if (action)
-    simcall_host_execution_destroy(action);
+    simcall_process_execution_destroy(action);
 
   /* parallel tasks only */
   xbt_free(task->simdata->host_list);
@@ -298,7 +298,7 @@ msg_error_t MSG_task_cancel(msg_task_t task)
   xbt_assert((task != NULL), "Cannot cancel a NULL task");
 
   if (task->simdata->compute) {
-    simcall_host_execution_cancel(task->simdata->compute);
+    simcall_process_execution_cancel(task->simdata->compute);
   }
   else if (task->simdata->comm) {
     simdata_task_t simdata = task->simdata;
@@ -319,7 +319,7 @@ msg_error_t MSG_task_cancel(msg_task_t task)
 double MSG_task_get_flops_amount(msg_task_t task) {
 
        if (task->simdata->compute) {
-               return simcall_host_execution_get_remains(task->simdata->compute);
+               return simcall_process_execution_get_remains(task->simdata->compute);
        } else {
                return task->simdata->flops_amount;
        }
@@ -410,7 +410,7 @@ void MSG_task_set_priority(msg_task_t task, double priority)
 
   task->simdata->priority = 1 / priority;
   if (task->simdata->compute)
-    simcall_host_execution_set_priority(task->simdata->compute,
+    simcall_process_execution_set_priority(task->simdata->compute,
                                       task->simdata->priority);
 }
 
@@ -431,7 +431,7 @@ void MSG_task_set_bound(msg_task_t task, double bound)
 
   task->simdata->bound = bound;
   if (task->simdata->compute)
-    simcall_host_execution_set_bound(task->simdata->compute,
+    simcall_process_execution_set_bound(task->simdata->compute,
                                       task->simdata->bound);
 }
 
@@ -517,6 +517,6 @@ void MSG_task_set_affinity(msg_task_t task, msg_host_t host, unsigned long mask)
     }
 
     XBT_INFO("set affinity(0x%04lx@%s) for %s", mask, MSG_host_get_name(host), MSG_task_get_name(task));
-    simcall_host_execution_set_affinity(task->simdata->compute, host, mask);
+    simcall_process_execution_set_affinity(task->simdata->compute, host, mask);
   }
 }
index ac42d90..6da50ee 100644 (file)
@@ -16,6 +16,7 @@
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "simgrid/platf.h"
+#include "simgrid/host.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_vm, msg,
                                 "Cloud-oriented parts of the MSG API");
@@ -75,7 +76,7 @@ void MSG_vm_set_property_value(msg_vm_t vm, const char *name, void *value, void_
 
 msg_vm_t MSG_vm_get_by_name(const char *name)
 {
-  return MSG_get_host_by_name(name);
+  return MSG_host_by_name(name);
 }
 
 /** \ingroup m_vm_management
@@ -118,7 +119,7 @@ int MSG_vm_is_running(msg_vm_t vm)
  */
 int MSG_vm_is_migrating(msg_vm_t vm)
 {
-  msg_host_priv_t priv = msg_host_resource_priv(vm);
+  msg_host_priv_t priv = sg_host_msg(vm);
   return priv->is_migrating;
 }
 
@@ -177,7 +178,7 @@ msg_vm_t MSG_vm_create(msg_host_t ind_pm, const char *name,
   double update_speed = ((double)dp_intensity/100) * mig_netspeed;
 
   msg_vm_t vm = MSG_vm_create_core(ind_pm, name);
-  s_ws_params_t params;
+  s_vm_params_t params;
   memset(&params, 0, sizeof(params));
   params.ramsize = (sg_size_t)ramsize * 1024 * 1024;
   //params.overcommit = 0;
@@ -205,7 +206,7 @@ msg_vm_t MSG_vm_create_core(msg_host_t ind_pm, const char *name)
   /* make sure the VM of the same name does not exit */
   {
     xbt_dictelm_t ind_host_tmp = xbt_lib_get_elm_or_null(host_lib, name);
-    if (ind_host_tmp && xbt_lib_get_level(ind_host_tmp, SIMIX_HOST_LEVEL) != NULL) {
+    if (ind_host_tmp && sg_host_simix(ind_host_tmp) != NULL) {
       XBT_ERROR("host %s already exits", name);
       return NULL;
     }
@@ -353,7 +354,7 @@ static int migration_rx_fun(int argc, char *argv[])
   // The structure has been created in the do_migration function and should only be freed in the same place ;)
   struct migration_session *ms = MSG_process_get_data(MSG_process_self());
 
-  s_ws_params_t params;
+  s_vm_params_t params;
   simcall_host_get_params(ms->vm, &params);
 
   int need_exit = 0;
@@ -390,7 +391,7 @@ static int migration_rx_fun(int argc, char *argv[])
    msg_vm_t vm = ms->vm;
    msg_host_t src_pm = ms->src_pm;
    msg_host_t dst_pm = ms-> dst_pm;
-   msg_host_priv_t priv = msg_host_resource_priv(vm);
+   msg_host_priv_t priv = sg_host_msg(vm);
 
 // // TODO: we have an issue, if the DST node is turning off during the three next calls, then the VM is in an inconsistent state
 // // I should check with Takahiro in order to make this portion of code atomic
@@ -416,7 +417,7 @@ static int migration_rx_fun(int argc, char *argv[])
   {
 
    // Now the VM is running on the new host (the migration is completed) (even if the SRC crash)
-   msg_host_priv_t priv = msg_host_resource_priv(vm);
+   msg_host_priv_t priv = sg_host_msg(vm);
    priv->is_migrating = 0;
    XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", ms->vm->key, ms->src_pm->key, ms->dst_pm->key);
    TRACE_msg_vm_change_host(ms->vm, ms->src_pm, ms->dst_pm);
@@ -449,7 +450,7 @@ static int migration_rx_fun(int argc, char *argv[])
 
 static void reset_dirty_pages(msg_vm_t vm)
 {
-  msg_host_priv_t priv = msg_host_resource_priv(vm);
+  msg_host_priv_t priv = sg_host_msg(vm);
 
   char *key = NULL;
   xbt_dict_cursor_t cursor = NULL;
@@ -465,7 +466,7 @@ static void reset_dirty_pages(msg_vm_t vm)
 
 static void start_dirty_page_tracking(msg_vm_t vm)
 {
-  msg_host_priv_t priv = msg_host_resource_priv(vm);
+  msg_host_priv_t priv = sg_host_msg(vm);
   priv->dp_enabled = 1;
 
   reset_dirty_pages(vm);
@@ -473,7 +474,7 @@ static void start_dirty_page_tracking(msg_vm_t vm)
 
 static void stop_dirty_page_tracking(msg_vm_t vm)
 {
-  msg_host_priv_t priv = msg_host_resource_priv(vm);
+  msg_host_priv_t priv = sg_host_msg(vm);
   priv->dp_enabled = 0;
 }
 
@@ -509,7 +510,7 @@ static double get_computed(char *key, msg_vm_t vm, dirty_page_t dp, double remai
 
 static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug, int stage2_round_for_fancy_debug)
 {
-  msg_host_priv_t priv = msg_host_resource_priv(vm);
+  msg_host_priv_t priv = sg_host_msg(vm);
   double total = 0;
 
   char *key = NULL;
@@ -546,7 +547,7 @@ static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug
 // msg_process_t MSG_process_create(const char *name, xbt_main_func_t code, void *data, msg_host_t host)
 void MSG_host_add_task(msg_host_t host, msg_task_t task)
 {
-  msg_host_priv_t priv = msg_host_resource_priv(host);
+  msg_host_priv_t priv = sg_host_msg(host);
   double remaining = MSG_task_get_flops_amount(task);
   char *key = bprintf("%s-%p", task->name, task);
 
@@ -568,7 +569,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task)
 
 void MSG_host_del_task(msg_host_t host, msg_task_t task)
 {
-  msg_host_priv_t priv = msg_host_resource_priv(host);
+  msg_host_priv_t priv = sg_host_msg(host);
 
   char *key = bprintf("%s-%p", task->name, task);
 
@@ -698,7 +699,7 @@ static int migration_tx_fun(int argc, char *argv[])
   // Note that the ms structure has been allocated in do_migration and hence should be freed in the same function ;)
   struct migration_session *ms = MSG_process_get_data(MSG_process_self());
 
-  s_ws_params_t params;
+  s_vm_params_t params;
   simcall_host_get_params(ms->vm, &params);
   const sg_size_t ramsize   = params.ramsize;
   const sg_size_t devsize   = params.devsize;
@@ -978,7 +979,7 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t new_pm)
   if (MSG_vm_is_migrating(vm))
     THROWF(vm_error, 0, "VM(%s) is already migrating", sg_host_name(vm));
 
-  msg_host_priv_t priv = msg_host_resource_priv(vm);
+  msg_host_priv_t priv = sg_host_msg(vm);
   priv->is_migrating = 1;
 
   {
@@ -1126,7 +1127,7 @@ void MSG_vm_set_bound(msg_vm_t vm, double bound)
  */
 void MSG_vm_set_affinity(msg_vm_t vm, msg_host_t pm, unsigned long mask)
 {
-  msg_host_priv_t priv = msg_host_resource_priv(vm);
+  msg_host_priv_t priv = sg_host_msg(vm);
 
   if (mask == 0)
     xbt_dict_remove_ext(priv->affinity_mask_db, (char *) pm, sizeof(pm));
index 67e9e7b..03dc4a4 100644 (file)
@@ -16,6 +16,8 @@
 #include "xbt/mallocator.h"
 #include <stdbool.h>
 
+SG_BEGIN_DECL()
+
 /* Global variables */
 
 typedef struct SD_global {
@@ -47,13 +49,6 @@ typedef struct SD_global {
 
 extern SD_global_t sd_global;
 
-/* Link */
-typedef struct SD_link {
-  void *surf_link;              /* surf object */
-  void *data;                   /* user data */
-  e_SD_link_sharing_policy_t sharing_policy;
-} s_SD_link_t;
-
 /* Workstation */
 typedef s_xbt_dictelm_t s_SD_workstation_t;
 typedef struct SD_workstation {
@@ -64,10 +59,6 @@ typedef struct SD_workstation {
   SD_task_t current_task;       /* only used in sequential mode */
 } s_SD_workstation_priv_t, *SD_workstation_priv_t;
 
-static inline SD_workstation_priv_t SD_workstation_priv(SD_workstation_t host){
-  return xbt_lib_get_level(host, SD_HOST_LEVEL);
-}
-
 /* Storage */
 typedef s_xbt_dictelm_t s_SD_storage_t;
 typedef struct SD_storage {
@@ -76,7 +67,7 @@ typedef struct SD_storage {
 } s_SD_storage_priv_t, *SD_storage_priv_t;
 
 static inline SD_storage_priv_t SD_storage_priv(SD_storage_t storage){
-  return xbt_lib_get_level(storage, SD_STORAGE_LEVEL);
+  return (SD_storage_priv_t)xbt_lib_get_level(storage, SD_STORAGE_LEVEL);
 }
 
 /* Task */
@@ -130,9 +121,6 @@ typedef struct SD_dependency {
 XBT_PUBLIC(xbt_swag_t) SD_simulate_swag(double how_long); /* could be public, but you need to see the internals of the SD_task_t to use it */
 
 
-SD_link_t __SD_link_create(void *surf_link, void *data);
-#define __SD_link_destroy xbt_free_f
-
 SD_workstation_t __SD_workstation_create(void *surf_workstation,
                                          void *data);
 void __SD_workstation_destroy(void *workstation);
@@ -219,5 +207,6 @@ void TRACE_sd_task_execute_start(SD_task_t task);
 void TRACE_sd_task_execute_end(SD_task_t task);
 void TRACE_sd_task_destroy(SD_task_t task);
 
+SG_END_DECL()
 
 #endif
index b8c3c81..b41c85a 100644 (file)
@@ -87,8 +87,6 @@ void SD_init(int *argc, char **argv)
 #endif
 
   XBT_DEBUG("ADD SD LEVELS");
-  SD_HOST_LEVEL = xbt_lib_add_level(host_lib,__SD_workstation_destroy);
-  SD_LINK_LEVEL = xbt_lib_add_level(link_lib,__SD_link_destroy);
   SD_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,__SD_storage_destroy);
 
   if (_sg_cfg_exit_asap) {
@@ -128,6 +126,7 @@ void SD_application_reinit(void)
   s_SD_task_t task;
 
   SD_task_t done_task, next_done_task;
+  xbt_die("This function is not working since the C++ links and others. Please report the problem if you really need that function.");
 
    XBT_DEBUG("Recreating the swags...");
   xbt_swag_free(sd_global->not_scheduled_task_set);
@@ -203,7 +202,6 @@ void SD_create_environment(const char *platform_file)
   xbt_lib_cursor_t cursor = NULL;
   char *name = NULL;
   void **surf_workstation = NULL;
-  void **surf_link = NULL;
   void **surf_storage = NULL;
 
   parse_platform_file(platform_file);
@@ -214,11 +212,6 @@ void SD_create_environment(const char *platform_file)
       __SD_workstation_create(surf_workstation[SURF_HOST_LEVEL], NULL);
   }
 
-  xbt_lib_foreach(link_lib, cursor, name, surf_link) {
-  if(surf_link[SURF_LINK_LEVEL])
-    __SD_link_create(surf_link[SURF_LINK_LEVEL], NULL);
-  }
-
   xbt_lib_foreach(storage_lib, cursor, name, surf_storage) {
   if(surf_storage[SURF_STORAGE_LEVEL])
     __SD_storage_create(surf_storage[SURF_STORAGE_LEVEL], NULL);
index 7f5da90..fe748a1 100644 (file)
@@ -9,29 +9,7 @@
 #include "xbt/dict.h"
 #include "xbt/sysdep.h"
 #include "surf/surf.h"
-
-
-/* Creates a link and registers it in SD.
- */
-SD_link_t __SD_link_create(void *surf_link, void *data)
-{
-
-  SD_link_t link;
-  const char *name;
-
-  link = xbt_new(s_SD_link_t, 1);
-  link->surf_link = surf_link;
-  link->data = data;            /* user data */
-  if (surf_network_link_is_shared(surf_link))
-    link->sharing_policy = SD_LINK_SHARED;
-  else
-    link->sharing_policy = SD_LINK_FATPIPE;
-
-  name = SD_link_get_name(link);
-  xbt_lib_set(link_lib,name,SD_LINK_LEVEL,link);
-
-  return link;
-}
+#include "simgrid/link.h"
 
 /**
  * \brief Returns the link list
@@ -43,103 +21,12 @@ SD_link_t __SD_link_create(void *surf_link, void *data)
  */
 const SD_link_t *SD_link_get_list(void)
 {
+  if (sd_global->link_list == NULL)    /* this is the first time the function is called */
+    sd_global->link_list = sg_link_list();
 
-  xbt_lib_cursor_t cursor;
-  char *key;
-  void **data;
-  int i;
-
-  if (sd_global->link_list == NULL) {   /* this is the first time the function is called */
-    sd_global->link_list = xbt_new(SD_link_t, xbt_lib_length(link_lib));
-
-    i = 0;
-    xbt_lib_foreach(link_lib, cursor, key, data) {
-        sd_global->link_list[i++] = (SD_link_t) data[SD_LINK_LEVEL];
-    }
-  }
   return sd_global->link_list;
 }
 
-/**
- * \brief Returns the number of links
- *
- * \return the number of existing links
- * \see SD_link_get_list()
- */
-int SD_link_get_number(void)
-{
-  return xbt_lib_length(link_lib);
-}
 
-/**
- * \brief Returns the user data of a link
- *
- * \param link a link
- * \return the user data associated with this link (can be \c NULL)
- * \see SD_link_set_data()
- */
-void *SD_link_get_data(SD_link_t link)
-{
-  return link->data;
-}
 
-/**
- * \brief Sets the user data of a link
- *
- * The new data can be \c NULL. The old data should have been freed first
- * if it was not \c NULL.
- *
- * \param link a link
- * \param data the new data you want to associate with this link
- * \see SD_link_get_data()
- */
-void SD_link_set_data(SD_link_t link, void *data)
-{
-  link->data = data;
-}
-
-/**
- * \brief Returns the name of a link
- *
- * \param link a link
- * \return the name of this link (cannot be \c NULL)
- */
-const char *SD_link_get_name(SD_link_t link)
-{
-  return surf_resource_name(link->surf_link);
-}
-
-/**
- * \brief Returns the current bandwidth of a link
- *
- * \param link a link
- * \return the current bandwidth of this link, in bytes per second
- */
-double SD_link_get_current_bandwidth(SD_link_t link)
-{
-  return surf_network_link_get_bandwidth(link->surf_link);
-}
 
-/**
- * \brief Returns the current latency of a link
- *
- * \param link a link
- * \return the current latency of this link, in seconds
- */
-double SD_link_get_current_latency(SD_link_t link)
-{
-  return surf_network_link_get_latency(link->surf_link);
-}
-
-/**
- * \brief Returns the sharing policy of this workstation.
- *
- * \param link a link
- * \return the sharing policyfor the flows going through this link:
- * SD_LINK_SHARED or SD_LINK_FATPIPE
- *
- */
-e_SD_link_sharing_policy_t SD_link_get_sharing_policy(SD_link_t link)
-{
-  return link->sharing_policy;
-}
index aa31087..01b1ee6 100644 (file)
@@ -1090,7 +1090,7 @@ void __SD_task_really_run(SD_task_t task)
 {
 
   int i;
-  void **surf_hosts;
+  sg_host_t *hosts;
 
   xbt_assert(__SD_task_is_runnable_or_in_fifo(task),
               "Task '%s' is not runnable or in a fifo! Task state: %d",
@@ -1106,7 +1106,7 @@ void __SD_task_really_run(SD_task_t task)
   for (i = 0; i < host_nb; i++) {
     if (SD_workstation_get_access_mode(task->workstation_list[i]) ==
         SD_WORKSTATION_SEQUENTIAL_ACCESS) {
-      SD_workstation_priv(task->workstation_list[i])->current_task = task;
+       sg_host_sd(task->workstation_list[i])->current_task = task;
       xbt_assert(__SD_workstation_is_busy(task->workstation_list[i]),
                   "The workstation should be busy now");
     }
@@ -1117,12 +1117,11 @@ void __SD_task_really_run(SD_task_t task)
 
   /* start the task */
 
-  /* we have to create a Surf workstation array instead of the SimDag
-   * workstation array */
-  surf_hosts = xbt_new(void *, host_nb);
+  /* Copy the elements of the task into the action */
+  hosts = xbt_new(sg_host_t, host_nb);
 
   for (i = 0; i < host_nb; i++)
-    surf_hosts[i] =  surf_host_resource_priv(task->workstation_list[i]);
+    hosts[i] =  task->workstation_list[i];
 
   double *flops_amount = xbt_new0(double, host_nb);
   double *bytes_amount = xbt_new0(double, host_nb * host_nb);
@@ -1137,7 +1136,7 @@ void __SD_task_really_run(SD_task_t task)
 
   task->surf_action = surf_host_model_execute_parallel_task((surf_host_model_t)surf_host_model,
                                                                     host_nb,
-                                                                    surf_hosts,
+                                                                    hosts,
                                                                     flops_amount,
                                                                     bytes_amount,
                                                                     task->rate);
@@ -1185,11 +1184,11 @@ int __SD_task_try_to_run(SD_task_t task)
   if (!can_start) {             /* if the task cannot start and is not in the FIFOs yet */
     for (i = 0; i < task->workstation_nb; i++) {
       workstation = task->workstation_list[i];
-      if (SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
+      if (sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
         XBT_DEBUG("Pushing task '%s' in the FIFO of workstation '%s'",
                SD_task_get_name(task),
                SD_workstation_get_name(workstation));
-        xbt_fifo_push(SD_workstation_priv(workstation)->task_fifo, task);
+        xbt_fifo_push(sg_host_sd(workstation)->task_fifo, task);
       }
     }
     __SD_task_set_state(task, SD_IN_FIFO);
@@ -1239,23 +1238,23 @@ void __SD_task_just_done(SD_task_t task)
   for (i = 0; i < task->workstation_nb; i++) {
     workstation = task->workstation_list[i];
     XBT_DEBUG("Workstation '%s': access_mode = %d",
-              SD_workstation_get_name(workstation), (int)SD_workstation_priv(workstation)->access_mode);
-    if (SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
-      xbt_assert(SD_workstation_priv(workstation)->task_fifo != NULL,
+              SD_workstation_get_name(workstation), (int)sg_host_sd(workstation)->access_mode);
+    if (sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
+      xbt_assert(sg_host_sd(workstation)->task_fifo != NULL,
                   "Workstation '%s' has sequential access but no FIFO!",
                   SD_workstation_get_name(workstation));
-      xbt_assert(SD_workstation_priv(workstation)->current_task =
+      xbt_assert(sg_host_sd(workstation)->current_task =
                   task, "Workstation '%s': current task should be '%s'",
                   SD_workstation_get_name(workstation),
                   SD_task_get_name(task));
 
       /* the task is over so we can release the workstation */
-      SD_workstation_priv(workstation)->current_task = NULL;
+      sg_host_sd(workstation)->current_task = NULL;
 
       XBT_DEBUG("Getting candidate in FIFO");
       candidate =
           xbt_fifo_get_item_content(xbt_fifo_get_first_item
-                                    (SD_workstation_priv(workstation)->task_fifo));
+                                    (sg_host_sd(workstation)->task_fifo));
 
       if (candidate != NULL) {
         XBT_DEBUG("Candidate: '%s'", SD_task_get_name(candidate));
@@ -1309,10 +1308,10 @@ void __SD_task_just_done(SD_task_t task)
 
       /* I can start on this workstation if the workstation is shared
          or if I am the first task in the FIFO */
-      can_start = SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SHARED_ACCESS
+      can_start = sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SHARED_ACCESS
           || candidate ==
           xbt_fifo_get_item_content(xbt_fifo_get_first_item
-                                    (SD_workstation_priv(workstation)->task_fifo));
+                                    (sg_host_sd(workstation)->task_fifo));
     }
 
     XBT_DEBUG("Candidate '%s' can start: %d", SD_task_get_name(candidate),
@@ -1324,8 +1323,8 @@ void __SD_task_just_done(SD_task_t task)
         workstation = candidate->workstation_list[j];
 
         /* update the FIFO */
-        if (SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
-          candidate = xbt_fifo_shift(SD_workstation_priv(workstation)->task_fifo);   /* the return value is stored just for debugging */
+        if (sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
+          candidate = xbt_fifo_shift(sg_host_sd(workstation)->task_fifo);   /* the return value is stored just for debugging */
           XBT_DEBUG("Head of the FIFO: '%s'",
                  (candidate !=
                   NULL) ? SD_task_get_name(candidate) : "NULL");
index bfe57d9..e7062c2 100644 (file)
@@ -31,8 +31,9 @@ SD_workstation_t __SD_workstation_create(void *surf_workstation,
   workstation->current_task = NULL;
 
   name = surf_resource_name(surf_workstation);
-  xbt_lib_set(host_lib,name,SD_HOST_LEVEL,workstation);
-  return xbt_lib_get_elm_or_null(host_lib,name);
+  sg_host_t sg_host = sg_host_by_name(name);
+  sg_host_sd_set(sg_host,workstation);
+  return sg_host;
 }
 
 /* Creates a storage and registers it in SD.
@@ -83,26 +84,12 @@ SD_workstation_t SD_workstation_get_by_name(const char *name)
  * \remark The workstation order in the returned array is generally different from the workstation creation/declaration order in the XML platform (we use a hash table internally).
  * \see SD_workstation_get_number()
  */
-const SD_workstation_t *SD_workstation_get_list(void)
-{
-
-  xbt_lib_cursor_t cursor;
-  char *key;
-  void **data;
-  int i;
-
+const SD_workstation_t *SD_workstation_get_list(void) {
   xbt_assert(SD_workstation_get_number() > 0, "There is no workstation!");
 
-  if (sd_global->workstation_list == NULL) {    /* this is the first time the function is called */
-    sd_global->workstation_list =
-      xbt_new(SD_workstation_t, xbt_lib_length(host_lib));
+  if (sd_global->workstation_list == NULL)     /* this is the first time the function is called */
+    sd_global->workstation_list = xbt_dynar_to_array(sg_hosts_as_dynar());
 
-    i = 0;
-    xbt_lib_foreach(host_lib, cursor, key, data) {
-      if(data[SD_HOST_LEVEL])
-        sd_global->workstation_list[i++] = xbt_dict_cursor_get_elm(cursor);
-    }
-  }
   return sd_global->workstation_list;
 }
 
@@ -126,7 +113,7 @@ int SD_workstation_get_number(void)
  */
 void *SD_workstation_get_data(SD_workstation_t workstation)
 {
-  return SD_workstation_priv(workstation)->data;
+  return sg_host_sd(workstation)->data;
 }
 
 /**
@@ -141,7 +128,7 @@ void *SD_workstation_get_data(SD_workstation_t workstation)
  */
 void SD_workstation_set_data(SD_workstation_t workstation, void *data)
 {
-  SD_workstation_priv(workstation)->data = data;
+       sg_host_sd(workstation)->data = data;
 }
 
 /**
@@ -192,7 +179,7 @@ void SD_workstation_dump(SD_workstation_t ws)
   XBT_INFO("Displaying workstation %s", SD_workstation_get_name(ws));
   XBT_INFO("  - power: %.0f", SD_workstation_get_power(ws));
   XBT_INFO("  - available power: %.2f", SD_workstation_get_available_power(ws));
-  switch (SD_workstation_priv(ws)->access_mode){
+  switch (sg_host_sd(ws)->access_mode){
   case SD_WORKSTATION_SHARED_ACCESS:
       XBT_INFO("  - access mode: Space shared");
       break;
@@ -234,7 +221,6 @@ const SD_link_t *SD_route_get_list(SD_workstation_t src,
   void *surf_src;
   void *surf_dst;
   xbt_dynar_t surf_route;
-  const char *link_name;
   void *surf_link;
   unsigned int cpt;
 
@@ -250,9 +236,7 @@ const SD_link_t *SD_route_get_list(SD_workstation_t src,
                                                        surf_src, surf_dst);
 
   xbt_dynar_foreach(surf_route, cpt, surf_link) {
-    link_name = surf_resource_name(surf_link);
-    sd_global->recyclable_route[cpt] =
-        xbt_lib_get_or_null(link_lib, link_name, SD_LINK_LEVEL);
+    sd_global->recyclable_route[cpt] = surf_link;
   }
   return sd_global->recyclable_route;
 }
@@ -438,7 +422,7 @@ double SD_route_get_communication_time(SD_workstation_t src,
 e_SD_workstation_access_mode_t
 SD_workstation_get_access_mode(SD_workstation_t workstation)
 {
-  return SD_workstation_priv(workstation)->access_mode;
+  return sg_host_sd(workstation)->access_mode;
 }
 
 /**
@@ -464,17 +448,17 @@ void SD_workstation_set_access_mode(SD_workstation_t workstation,
              access_mode != SD_WORKSTATION_SHARED_ACCESS,
              "Trying to set an invalid access mode");
 
-  if (access_mode == SD_workstation_priv(workstation)->access_mode) {
+  if (access_mode == sg_host_sd(workstation)->access_mode) {
     return;                     // nothing is changed
   }
 
-  SD_workstation_priv(workstation)->access_mode = access_mode;
+  sg_host_sd(workstation)->access_mode = access_mode;
 
   if (access_mode == SD_WORKSTATION_SHARED_ACCESS) {
-    xbt_fifo_free(SD_workstation_priv(workstation)->task_fifo);
-    SD_workstation_priv(workstation)->task_fifo = NULL;
+    xbt_fifo_free(sg_host_sd(workstation)->task_fifo);
+    sg_host_sd(workstation)->task_fifo = NULL;
   } else {
-    SD_workstation_priv(workstation)->task_fifo = xbt_fifo_new();
+         sg_host_sd(workstation)->task_fifo = xbt_fifo_new();
   }
 }
 
@@ -528,17 +512,17 @@ int __SD_workstation_is_busy(SD_workstation_t workstation)
   XBT_DEBUG
       ("Workstation '%s' access mode: '%s', current task: %s, fifo size: %d",
        SD_workstation_get_name(workstation),
-       (SD_workstation_priv(workstation)->access_mode ==
+       (sg_host_sd(workstation)->access_mode ==
         SD_WORKSTATION_SHARED_ACCESS) ? "SHARED" : "FIFO",
-       (SD_workstation_priv(workstation)->current_task ?
-        SD_task_get_name(SD_workstation_priv(workstation)->current_task)
+       (sg_host_sd(workstation)->current_task ?
+        SD_task_get_name(sg_host_sd(workstation)->current_task)
         : "none"),
-       (SD_workstation_priv(workstation)->task_fifo ? xbt_fifo_size(SD_workstation_priv(workstation)->task_fifo) :
+       (sg_host_sd(workstation)->task_fifo ? xbt_fifo_size(sg_host_sd(workstation)->task_fifo) :
         0));
 
-  return SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS &&
-      (SD_workstation_priv(workstation)->current_task != NULL
-       || xbt_fifo_size(SD_workstation_priv(workstation)->task_fifo) > 0);
+  return sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS &&
+      (sg_host_sd(workstation)->current_task != NULL
+       || xbt_fifo_size(sg_host_sd(workstation)->task_fifo) > 0);
 }
 
 /* Destroys a workstation.
@@ -546,6 +530,8 @@ int __SD_workstation_is_busy(SD_workstation_t workstation)
 void __SD_workstation_destroy(void *workstation)
 {
 
+  if (workstation==NULL)
+         return;
   SD_workstation_priv_t w;
 
   /* workstation->surf_workstation is freed by surf_exit and workstation->data is freed by the user */
@@ -564,11 +550,11 @@ void __SD_workstation_destroy(void *workstation)
  * \param workstation a workstation */
 SD_task_t SD_workstation_get_current_task(SD_workstation_t workstation)
 {
-  xbt_assert(SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS,
+  xbt_assert(sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS,
               "Access mode must be set to SD_WORKSTATION_SEQUENTIAL_ACCESS"
               " to use this function");
 
-  return (SD_workstation_priv(workstation)->current_task);
+  return (sg_host_sd(workstation)->current_task);
 }
 
 /**
diff --git a/src/simgrid/host.cpp b/src/simgrid/host.cpp
new file mode 100644 (file)
index 0000000..63655a9
--- /dev/null
@@ -0,0 +1,135 @@
+/* Copyright (c) 2013-2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "xbt/dict.h"
+#include "simgrid/host.h"
+#include "surf/surf_routing.h" // SIMIX_HOST_LEVEL and friends FIXME: make private here
+#include "surf/surf.h" // routing_get_network_element_type FIXME:killme
+
+sg_host_t sg_host_by_name(const char *name){
+  return xbt_lib_get_elm_or_null(host_lib, name);
+}
+
+sg_host_t sg_host_by_name_or_create(const char *name) {
+       sg_host_t res = xbt_lib_get_elm_or_null(host_lib, name);
+       if (!res) {
+               xbt_lib_set(host_lib,name,0,NULL); // Should only create the bucklet with no data added
+               res = xbt_lib_get_elm_or_null(host_lib, name);
+       }
+       return res;
+}
+xbt_dynar_t sg_hosts_as_dynar(void) {
+       xbt_lib_cursor_t cursor;
+       char *key;
+       void **data;
+       xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t),NULL);
+
+       xbt_lib_foreach(host_lib, cursor, key, data) {
+               if(routing_get_network_element_type(key) == SURF_NETWORK_ELEMENT_HOST) {
+                       xbt_dictelm_t elm = xbt_dict_cursor_get_elm(cursor);
+                       xbt_dynar_push(res, &elm);
+               }
+       }
+       return res;
+}
+
+// ========= Layering madness ==============
+
+int MSG_HOST_LEVEL;
+int SD_HOST_LEVEL;
+int SIMIX_HOST_LEVEL;
+int ROUTING_HOST_LEVEL;
+int SURF_CPU_LEVEL;
+
+
+#include "msg/msg_private.h" // MSG_host_priv_free. FIXME: killme
+#include "simdag/private.h" // __SD_workstation_destroy. FIXME: killme
+#include "simix/smx_host_private.h" // SIMIX_host_destroy. FIXME: killme
+#include "surf/cpu_interface.hpp"
+#include "surf/surf_routing.hpp"
+
+static XBT_INLINE void surf_cpu_free(void *r) {
+  delete static_cast<Cpu*>(r);
+}
+static XBT_INLINE void routing_asr_host_free(void *p) {
+  delete static_cast<RoutingEdge*>(p);
+}
+
+
+void sg_host_init() { // FIXME: only add the needed levels
+  MSG_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __MSG_host_priv_free);
+  SD_HOST_LEVEL = xbt_lib_add_level(host_lib,__SD_workstation_destroy);
+
+  SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,SIMIX_host_destroy);
+  SURF_CPU_LEVEL = xbt_lib_add_level(host_lib,surf_cpu_free);
+  ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,routing_asr_host_free);
+}
+
+// ========== MSG Layer ==============
+msg_host_priv_t sg_host_msg(sg_host_t host) {
+       return (msg_host_priv_t) xbt_lib_get_level(host, MSG_HOST_LEVEL);
+}
+void sg_host_msg_set(sg_host_t host, msg_host_priv_t smx_host) {
+         xbt_lib_set(host_lib,host->key,MSG_HOST_LEVEL,smx_host);
+}
+void sg_host_msg_destroy(sg_host_t host) {
+         xbt_lib_unset(host_lib,host->key,MSG_HOST_LEVEL,1);
+}
+// ========== SimDag Layer ==============
+SD_workstation_priv_t sg_host_sd(sg_host_t host) {
+       return (SD_workstation_priv_t) xbt_lib_get_level(host, SD_HOST_LEVEL);
+}
+void sg_host_sd_set(sg_host_t host, SD_workstation_priv_t smx_host) {
+         xbt_lib_set(host_lib,host->key,SD_HOST_LEVEL,smx_host);
+}
+void sg_host_sd_destroy(sg_host_t host) {
+         xbt_lib_unset(host_lib,host->key,SD_HOST_LEVEL,1);
+}
+
+// ========== Simix layer =============
+smx_host_priv_t sg_host_simix(sg_host_t host){
+  return (smx_host_priv_t) xbt_lib_get_level(host, SIMIX_HOST_LEVEL);
+}
+void sg_host_simix_set(sg_host_t host, smx_host_priv_t smx_host) {
+       xbt_lib_set(host_lib,host->key,SIMIX_HOST_LEVEL,smx_host);
+}
+void sg_host_simix_destroy(sg_host_t host) {
+       xbt_lib_unset(host_lib,host->key,SIMIX_HOST_LEVEL,1);
+}
+
+// ========== SURF CPU ============
+surf_cpu_t sg_host_surfcpu(sg_host_t host) {
+       return (surf_cpu_t) xbt_lib_get_level(host, SURF_CPU_LEVEL);
+}
+void sg_host_surfcpu_set(sg_host_t host, surf_cpu_t cpu) {
+       xbt_lib_set(host_lib, host->key, SURF_CPU_LEVEL, cpu);
+}
+void sg_host_surfcpu_destroy(sg_host_t host) {
+       xbt_lib_unset(host_lib,host->key,SURF_CPU_LEVEL,1);
+}
+// ========== RoutingEdge ============
+RoutingEdge *sg_host_edge(sg_host_t host) {
+       return (RoutingEdge*) xbt_lib_get_level(host, ROUTING_HOST_LEVEL);
+}
+void sg_host_edge_set(sg_host_t host, RoutingEdge *edge) {
+       xbt_lib_set(host_lib, host->key, ROUTING_HOST_LEVEL, edge);
+}
+void sg_host_edge_destroy(sg_host_t host, int do_callback) {
+       xbt_lib_unset(host_lib,host->key,ROUTING_HOST_LEVEL,do_callback);
+}
+
+
+
+/*
+host::host() {
+       // TODO Auto-generated constructor stub
+
+}
+
+host::~host() {
+       // TODO Auto-generated destructor stub
+}*/
+
index 8ab8535..6bfc5c7 100644 (file)
@@ -461,14 +461,16 @@ static void _sg_cfg_cb_contexts_parallel_mode(const char *name, int pos)
 static void _sg_cfg_cb__surf_network_coordinates(const char *name,
                                                  int pos)
 {
+  static int already_set = 0;
   int val = xbt_cfg_get_boolean(_sg_cfg_set, name);
   if (val) {
-    if (!COORD_HOST_LEVEL) {
+    if (!already_set) {
       COORD_HOST_LEVEL = xbt_lib_add_level(host_lib,xbt_dynar_free_voidp);
       COORD_ASR_LEVEL  = xbt_lib_add_level(as_router_lib,xbt_dynar_free_voidp);
     }
+    already_set = 1;
   } else
-    if (COORD_HOST_LEVEL)
+    if (already_set)
       xbt_die("Setting of whether to use coordinate cannot be disabled once set.");
 }
 
index 0e63140..9dbb56f 100644 (file)
@@ -21,18 +21,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
 
 #include "popping_bodies.c"
 
-/**
- * \ingroup simix_host_management
- * \brief Returns a host given its name.
- *
- * \param name The name of the host to get
- * \return The corresponding host
- */
-smx_host_t simcall_host_get_by_name(const char *name)
-{
-  return simcall_BODY_host_get_by_name(name);
-}
-
 /**
  * \ingroup simix_host_management
  * \brief Returns the name of a host.
@@ -40,7 +28,7 @@ smx_host_t simcall_host_get_by_name(const char *name)
  * \param host A SIMIX host
  * \return The name of this host
  */
-const char* simcall_host_get_name(smx_host_t host)
+const char* simcall_host_get_name(sg_host_t host)
 {
   return simcall_BODY_host_get_name(host);
 }
@@ -51,7 +39,7 @@ const char* simcall_host_get_name(smx_host_t host)
  *
  * \param host A SIMIX host
  */
-void simcall_host_on(smx_host_t host)
+void simcall_host_on(sg_host_t host)
 {
   simcall_BODY_host_on(host);
 }
@@ -62,7 +50,7 @@ void simcall_host_on(smx_host_t host)
  *
  * \param host A SIMIX host
  */
-void simcall_host_off(smx_host_t host)
+void simcall_host_off(sg_host_t host)
 {
   simcall_BODY_host_off(host);
 }
@@ -74,7 +62,7 @@ void simcall_host_off(smx_host_t host)
  * \param host A host
  * \return The properties of this host
  */
-xbt_dict_t simcall_host_get_properties(smx_host_t host)
+xbt_dict_t simcall_host_get_properties(sg_host_t host)
 {
   return simcall_BODY_host_get_properties(host);
 }
@@ -100,7 +88,7 @@ xbt_dict_t simcall_asr_get_properties(const char *name)
  * \param host A SIMIX host
  * \return The speed of this host (in Mflop/s)
  */
-double simcall_host_get_speed(smx_host_t host)
+double simcall_host_get_speed(sg_host_t host)
 {
   return simcall_BODY_host_get_speed(host);
 }
@@ -112,7 +100,7 @@ double simcall_host_get_speed(smx_host_t host)
  * \param host A SIMIX host
  * \return The number of core
  */
-int simcall_host_get_core(smx_host_t host)
+int simcall_host_get_core(sg_host_t host)
 {
   return simcall_BODY_host_get_core(host);
 }
@@ -124,7 +112,7 @@ int simcall_host_get_core(smx_host_t host)
  * \param host A SIMIX host
  * \return the swag of attached processes
  */
-xbt_swag_t simcall_host_get_process_list(smx_host_t host)
+xbt_swag_t simcall_host_get_process_list(sg_host_t host)
 {
   return simcall_BODY_host_get_process_list(host);
 }
@@ -136,7 +124,7 @@ xbt_swag_t simcall_host_get_process_list(smx_host_t host)
  *
  * \return Speed currently available (in Mflop/s)
  */
-double simcall_host_get_available_speed(smx_host_t host)
+double simcall_host_get_available_speed(sg_host_t host)
 {
   return simcall_BODY_host_get_available_speed(host);
 }
@@ -149,7 +137,7 @@ double simcall_host_get_available_speed(smx_host_t host)
  * \param host A SIMIX host
  * \return 1 if the host is available, 0 otherwise
  */
-int simcall_host_get_state(smx_host_t host)
+int simcall_host_get_state(sg_host_t host)
 {
   return simcall_BODY_host_get_state(host);
 }
@@ -161,7 +149,7 @@ int simcall_host_get_state(smx_host_t host)
  * \param host A SIMIX host
  * \return the current power peak value (double)
  */
-double simcall_host_get_current_power_peak(smx_host_t host)
+double simcall_host_get_current_power_peak(sg_host_t host)
 {
   return simcall_BODY_host_get_current_power_peak(host);
 }
@@ -174,7 +162,7 @@ double simcall_host_get_current_power_peak(smx_host_t host)
  * \param pstate_index pstate to test
  * \return the current power peak value (double) for pstate_index
  */
-double simcall_host_get_power_peak_at(smx_host_t host, int pstate_index)
+double simcall_host_get_power_peak_at(sg_host_t host, int pstate_index)
 {
   return simcall_BODY_host_get_power_peak_at(host, pstate_index);
 }
@@ -186,7 +174,7 @@ double simcall_host_get_power_peak_at(smx_host_t host, int pstate_index)
  * \param host A SIMIX host
  * \return the number of power states
  */
-int simcall_host_get_nb_pstates(smx_host_t host)
+int simcall_host_get_nb_pstates(sg_host_t host)
 {
   return simcall_BODY_host_get_nb_pstates(host);
 }
@@ -198,7 +186,7 @@ int simcall_host_get_nb_pstates(smx_host_t host)
  * \param host A SIMIX host
  * \param pstate_index The pstate to which the CPU power will be set
  */
-void simcall_host_set_pstate(smx_host_t host, int pstate_index)
+void simcall_host_set_pstate(sg_host_t host, int pstate_index)
 {
        simcall_BODY_host_set_pstate(host, pstate_index);
 }
@@ -208,7 +196,7 @@ void simcall_host_set_pstate(smx_host_t host, int pstate_index)
  *
  * \param host A SIMIX host
  */
-int simcall_host_get_pstate(smx_host_t host)
+int simcall_host_get_pstate(sg_host_t host)
 {
        return simcall_BODY_host_get_pstate(host);
 }
@@ -220,7 +208,7 @@ int simcall_host_get_pstate(smx_host_t host)
  * \param host A SIMIX host
  * \return the energy consumed by the host (double)
  */
-double simcall_host_get_consumed_energy(smx_host_t host)
+double simcall_host_get_consumed_energy(sg_host_t host)
 {
   return simcall_BODY_host_get_consumed_energy(host);
 }
@@ -240,7 +228,7 @@ double simcall_host_get_wattmax_at(msg_host_t host, int pstate){
 
 
 /**
- * \ingroup simix_host_management
+ * \ingroup simix_process_management
  * \brief Creates a synchro that executes some computation of an host.
  *
  * This function creates a SURF action and allocates the data necessary
@@ -254,7 +242,7 @@ double simcall_host_get_wattmax_at(msg_host_t host, int pstate){
  * \param affinity_mask
  * \return A new SIMIX execution synchronization
  */
-smx_synchro_t simcall_host_execute(const char *name, smx_host_t host,
+smx_synchro_t simcall_process_execute(const char *name,
                                     double flops_amount,
                                     double priority, double bound, unsigned long affinity_mask)
 {
@@ -262,11 +250,11 @@ smx_synchro_t simcall_host_execute(const char *name, smx_host_t host,
   xbt_assert(isfinite(flops_amount), "flops_amount is not finite!");
   xbt_assert(isfinite(priority), "priority is not finite!");
 
-  return simcall_BODY_host_execute(name, host, flops_amount, priority, bound, affinity_mask);
+  return simcall_BODY_process_execute(name, flops_amount, priority, bound, affinity_mask);
 }
 
 /**
- * \ingroup simix_host_management
+ * \ingroup simix_process_management
  * \brief Creates a synchro that may involve parallel computation on
  * several hosts and communication between them.
  *
@@ -280,9 +268,9 @@ smx_synchro_t simcall_host_execute(const char *name, smx_host_t host,
  * \param rate the SURF action rate
  * \return A new SIMIX execution synchronization
  */
-smx_synchro_t simcall_host_parallel_execute(const char *name,
+smx_synchro_t simcall_process_parallel_execute(const char *name,
                                          int host_nb,
-                                         smx_host_t *host_list,
+                                         sg_host_t *host_list,
                                          double *flops_amount,
                                          double *bytes_amount,
                                          double amount,
@@ -301,7 +289,7 @@ smx_synchro_t simcall_host_parallel_execute(const char *name,
   xbt_assert(isfinite(amount), "amount is not finite!");
   xbt_assert(isfinite(rate), "rate is not finite!");
 
-  return simcall_BODY_host_parallel_execute(name, host_nb, host_list,
+  return simcall_BODY_process_parallel_execute(name, host_nb, host_list,
                                             flops_amount,
                                             bytes_amount,
                                             amount, rate);
@@ -309,84 +297,84 @@ smx_synchro_t simcall_host_parallel_execute(const char *name,
 }
 
 /**
- * \ingroup simix_host_management
+ * \ingroup simix_process_management
  * \brief Destroys an execution synchro.
  *
  * Destroys a synchro, freeing its memory. This function cannot be called if there are a conditional waiting for it.
  * \param execution The execution synchro to destroy
  */
-void simcall_host_execution_destroy(smx_synchro_t execution)
+void simcall_process_execution_destroy(smx_synchro_t execution)
 {
-  simcall_BODY_host_execution_destroy(execution);
+  simcall_BODY_process_execution_destroy(execution);
 }
 
 /**
- * \ingroup simix_host_management
+ * \ingroup simix_process_management
  * \brief Cancels an execution synchro.
  *
  * This functions stops the execution. It calls a surf function.
  * \param execution The execution synchro to cancel
  */
-void simcall_host_execution_cancel(smx_synchro_t execution)
+void simcall_process_execution_cancel(smx_synchro_t execution)
 {
-  simcall_BODY_host_execution_cancel(execution);
+  simcall_BODY_process_execution_cancel(execution);
 }
 
 /**
- * \ingroup simix_host_management
+ * \ingroup simix_process_management
  * \brief Returns how much of an execution synchro remains to be done.
  *
  * \param execution The execution synchro
  * \return The remaining amount
  */
-double simcall_host_execution_get_remains(smx_synchro_t execution)
+double simcall_process_execution_get_remains(smx_synchro_t execution)
 {
-  return simcall_BODY_host_execution_get_remains(execution);
+  return simcall_BODY_process_execution_get_remains(execution);
 }
 
 /**
- * \ingroup simix_host_management
+ * \ingroup simix_process_management
  * \brief Returns the state of an execution synchro.
  *
  * \param execution The execution synchro
  * \return The state
  */
-e_smx_state_t simcall_host_execution_get_state(smx_synchro_t execution)
+e_smx_state_t simcall_process_execution_get_state(smx_synchro_t execution)
 {
-  return simcall_BODY_host_execution_get_state(execution);
+  return simcall_BODY_process_execution_get_state(execution);
 }
 
 /**
- * \ingroup simix_host_management
+ * \ingroup simix_process_management
  * \brief Changes the priority of an execution synchro.
  *
  * This functions changes the priority only. It calls a surf function.
  * \param execution The execution synchro
  * \param priority The new priority
  */
-void simcall_host_execution_set_priority(smx_synchro_t execution, double priority)
+void simcall_process_execution_set_priority(smx_synchro_t execution, double priority)
 {
   /* checking for infinite values */
   xbt_assert(isfinite(priority), "priority is not finite!");
 
-  simcall_BODY_host_execution_set_priority(execution, priority);
+  simcall_BODY_process_execution_set_priority(execution, priority);
 }
 
 /**
- * \ingroup simix_host_management
+ * \ingroup simix_process_management
  * \brief Changes the capping (the maximum CPU utilization) of an execution synchro.
  *
  * This functions changes the capping only. It calls a surf function.
  * \param execution The execution synchro
  * \param bound The new bound
  */
-void simcall_host_execution_set_bound(smx_synchro_t execution, double bound)
+void simcall_process_execution_set_bound(smx_synchro_t execution, double bound)
 {
-  simcall_BODY_host_execution_set_bound(execution, bound);
+  simcall_BODY_process_execution_set_bound(execution, bound);
 }
 
 /**
- * \ingroup simix_host_management
+ * \ingroup simix_process_management
  * \brief Changes the CPU affinity of an execution synchro.
  *
  * This functions changes the CPU affinity of an execution synchro. See taskset(1) on Linux.
@@ -394,9 +382,9 @@ void simcall_host_execution_set_bound(smx_synchro_t execution, double bound)
  * \param host Host
  * \param mask Affinity mask
  */
-void simcall_host_execution_set_affinity(smx_synchro_t execution, smx_host_t host, unsigned long mask)
+void simcall_process_execution_set_affinity(smx_synchro_t execution, sg_host_t host, unsigned long mask)
 {
-  simcall_BODY_host_execution_set_affinity(execution, host, mask);
+  simcall_BODY_process_execution_set_affinity(execution, host, mask);
 }
 
 /**
@@ -405,9 +393,9 @@ void simcall_host_execution_set_affinity(smx_synchro_t execution, smx_host_t hos
  *
  * \param execution The execution synchro
  */
-e_smx_state_t simcall_host_execution_wait(smx_synchro_t execution)
+e_smx_state_t simcall_process_execution_wait(smx_synchro_t execution)
 {
-  return simcall_BODY_host_execution_wait(execution);
+  return simcall_BODY_process_execution_wait(execution);
 }
 
 
@@ -420,7 +408,7 @@ e_smx_state_t simcall_host_execution_wait(smx_synchro_t execution)
  *
  * \return The host object of the VM
  */
-void* simcall_vm_create(const char *name, smx_host_t phys_host){
+void* simcall_vm_create(const char *name, sg_host_t phys_host){
   return simcall_BODY_vm_create(name, phys_host);
 }
 
@@ -430,7 +418,7 @@ void* simcall_vm_create(const char *name, smx_host_t phys_host){
  *
  * \param vm VM
  */
-void simcall_vm_start(smx_host_t vm)
+void simcall_vm_start(sg_host_t vm)
 {
   simcall_BODY_vm_start(vm);
 }
@@ -442,7 +430,7 @@ void simcall_vm_start(smx_host_t vm)
  * \param vm VM
  * \return The state of the VM
  */
-int simcall_vm_get_state(smx_host_t vm)
+int simcall_vm_get_state(sg_host_t vm)
 {
   return simcall_BODY_vm_get_state(vm);
 }
@@ -454,27 +442,27 @@ int simcall_vm_get_state(smx_host_t vm)
  * \param vm VM
  * \return The name of the physical host
  */
-void *simcall_vm_get_pm(smx_host_t vm)
+void *simcall_vm_get_pm(sg_host_t vm)
 {
   return simcall_BODY_vm_get_pm(vm);
 }
 
-void simcall_vm_set_bound(smx_host_t vm, double bound)
+void simcall_vm_set_bound(sg_host_t vm, double bound)
 {
   simcall_BODY_vm_set_bound(vm, bound);
 }
 
-void simcall_vm_set_affinity(smx_host_t vm, smx_host_t pm, unsigned long mask)
+void simcall_vm_set_affinity(sg_host_t vm, sg_host_t pm, unsigned long mask)
 {
   simcall_BODY_vm_set_affinity(vm, pm, mask);
 }
 
-void simcall_host_get_params(smx_host_t vm, ws_params_t params)
+void simcall_host_get_params(sg_host_t vm, vm_params_t params)
 {
   simcall_BODY_host_get_params(vm, params);
 }
 
-void simcall_host_set_params(smx_host_t vm, ws_params_t params)
+void simcall_host_set_params(sg_host_t vm, vm_params_t params)
 {
   simcall_BODY_host_set_params(vm, params);
 }
@@ -486,7 +474,7 @@ void simcall_host_set_params(smx_host_t vm, ws_params_t params)
  * \param vm VM
  * \param host Destination physical host
  */
-void simcall_vm_migrate(smx_host_t vm, smx_host_t host)
+void simcall_vm_migrate(sg_host_t vm, sg_host_t host)
 {
   simcall_BODY_vm_migrate(vm, host);
 }
@@ -497,7 +485,7 @@ void simcall_vm_migrate(smx_host_t vm, smx_host_t host)
  *
  * \param vm VM
  */
-void simcall_vm_suspend(smx_host_t vm)
+void simcall_vm_suspend(sg_host_t vm)
 {
   simcall_BODY_vm_suspend(vm);
 }
@@ -508,7 +496,7 @@ void simcall_vm_suspend(smx_host_t vm)
  *
  * \param vm VM
  */
-void simcall_vm_resume(smx_host_t vm)
+void simcall_vm_resume(sg_host_t vm)
 {
   simcall_BODY_vm_resume(vm);
 }
@@ -519,7 +507,7 @@ void simcall_vm_resume(smx_host_t vm)
  *
  * \param vm VM
  */
-void simcall_vm_save(smx_host_t vm)
+void simcall_vm_save(sg_host_t vm)
 {
   simcall_BODY_vm_save(vm);
 }
@@ -530,7 +518,7 @@ void simcall_vm_save(smx_host_t vm)
  *
  * \param vm VM
  */
-void simcall_vm_restore(smx_host_t vm)
+void simcall_vm_restore(sg_host_t vm)
 {
   simcall_BODY_vm_restore(vm);
 }
@@ -541,7 +529,7 @@ void simcall_vm_restore(smx_host_t vm)
  *
  * \param vm VM
  */
-void simcall_vm_shutdown(smx_host_t vm)
+void simcall_vm_shutdown(sg_host_t vm)
 {
   simcall_BODY_vm_shutdown(vm);
 }
@@ -552,7 +540,7 @@ void simcall_vm_shutdown(smx_host_t vm)
  *
  * \param vm VM
  */
-void simcall_vm_destroy(smx_host_t vm)
+void simcall_vm_destroy(sg_host_t vm)
 {
   simcall_BODY_vm_destroy(vm);
 }
@@ -571,7 +559,7 @@ void simcall_vm_destroy(smx_host_t vm)
  * \param src_pm  Source physical host
  * \param dst_pmt Destination physical host
  */
-void simcall_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm)
+void simcall_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm)
 {
   simcall_BODY_vm_migratefrom_resumeto(vm, src_pm, dst_pm);
 }
@@ -594,7 +582,7 @@ void simcall_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_
  * \param properties the properties of the process
  * \param auto_restart either it is autorestarting or not.
  */
-void simcall_process_create(smx_process_t *process, const char *name,
+smx_process_t simcall_process_create(const char *name,
                               xbt_main_func_t code,
                               void *data,
                               const char *hostname,
@@ -603,7 +591,7 @@ void simcall_process_create(smx_process_t *process, const char *name,
                               xbt_dict_t properties,
                               int auto_restart)
 {
-  simcall_BODY_process_create(process, name, code, data, hostname,
+  return (smx_process_t) simcall_BODY_process_create(name, code, data, hostname,
                               kill_time, argc, argv, properties,
                               auto_restart);
 }
@@ -649,7 +637,7 @@ void simcall_process_cleanup(smx_process_t process)
  * \param process the process to migrate
  * \param dest name of the new host
  */
-void simcall_process_change_host(smx_process_t process, smx_host_t dest)
+void simcall_process_change_host(smx_process_t process, sg_host_t dest)
 {
   simcall_BODY_process_change_host(process, dest);
 }
@@ -770,8 +758,6 @@ void simcall_process_set_data(smx_process_t process, void *data)
 /**
  * \ingroup simix_process_management
  * \brief Set the kill time of a process.
- * \param process a process
- * \param kill_time a double
  */
 void simcall_process_set_kill_time(smx_process_t process, double kill_time)
 {
@@ -779,22 +765,29 @@ void simcall_process_set_kill_time(smx_process_t process, double kill_time)
   if (kill_time > SIMIX_get_clock()) {
     if (simix_global->kill_process_function) {
       XBT_DEBUG("Set kill time %f for process %s(%s)",kill_time, process->name,
-          sg_host_name(process->smx_host));
+          sg_host_name(process->host));
       process->kill_timer = SIMIX_timer_set(kill_time, simix_global->kill_process_function, process);
     }
   }
 }
+/**
+ * \ingroup simix_process_management
+ * \brief Get the kill time of a process (or 0 if unset).
+ */
+double simcall_process_get_kill_time(smx_process_t process) {
+       return SIMIX_timer_get_date(process->kill_timer);
+}
 
 /**
  * \ingroup simix_process_management
  * \brief Return the location on which an agent is running.
  *
- * This functions returns the smx_host_t corresponding to the location on which
+ * This functions returns the sg_host_t corresponding to the location on which
  * \a process is running.
  * \param process SIMIX process
  * \return SIMIX host
  */
-smx_host_t simcall_process_get_host(smx_process_t process)
+sg_host_t simcall_process_get_host(smx_process_t process)
 {
   return simcall_BODY_process_get_host(process);
 }
@@ -929,7 +922,7 @@ smx_rdv_t simcall_rdv_get_by_name(const char *name)
  *  \param host The host to be counted
  *  \return The number of comm synchros pending in the rdv
  */
-int simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host)
+int simcall_rdv_comm_count_by_host(smx_rdv_t rdv, sg_host_t host)
 {
   return simcall_BODY_rdv_comm_count_by_host(rdv, host);
 }
@@ -1350,7 +1343,7 @@ int simcall_sem_get_capacity(smx_sem_t sem)
  * \ingroup simix_file_management
  *
  */
-sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, smx_host_t host)
+sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   return simcall_BODY_file_read(fd, size, host);
 }
@@ -1359,7 +1352,7 @@ sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, smx_host_t host)
  * \ingroup simix_file_management
  *
  */
-sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, smx_host_t host)
+sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   return simcall_BODY_file_write(fd, size, host);
 }
@@ -1368,7 +1361,7 @@ sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, smx_host_t host)
  * \ingroup simix_file_management
  * \brief
  */
-smx_file_t simcall_file_open(const char* fullpath, smx_host_t host)
+smx_file_t simcall_file_open(const char* fullpath, sg_host_t host)
 {
   return simcall_BODY_file_open(fullpath, host);
 }
@@ -1377,7 +1370,7 @@ smx_file_t simcall_file_open(const char* fullpath, smx_host_t host)
  * \ingroup simix_file_management
  *
  */
-int simcall_file_close(smx_file_t fd, smx_host_t host)
+int simcall_file_close(smx_file_t fd, sg_host_t host)
 {
   return simcall_BODY_file_close(fd, host);
 }
@@ -1386,7 +1379,7 @@ int simcall_file_close(smx_file_t fd, smx_host_t host)
  * \ingroup simix_file_management
  *
  */
-int simcall_file_unlink(smx_file_t fd, smx_host_t host)
+int simcall_file_unlink(smx_file_t fd, sg_host_t host)
 {
   return simcall_BODY_file_unlink(fd, host);
 }
@@ -1460,7 +1453,7 @@ sg_size_t simcall_storage_get_used_size (smx_storage_t storage){
  * \param host A SIMIX host
  * \return a dict containing all storages mounted on the host
  */
-xbt_dict_t simcall_host_get_mounted_storage_list(smx_host_t host)
+xbt_dict_t simcall_host_get_mounted_storage_list(sg_host_t host)
 {
   return simcall_BODY_host_get_mounted_storage_list(host);
 }
@@ -1471,7 +1464,7 @@ xbt_dict_t simcall_host_get_mounted_storage_list(smx_host_t host)
  * \param host A SIMIX host
  * \return a dict containing all storages attached to the host
  */
-xbt_dynar_t simcall_host_get_attached_storage_list(smx_host_t host)
+xbt_dynar_t simcall_host_get_attached_storage_list(sg_host_t host)
 {
   return simcall_BODY_host_get_attached_storage_list(host);
 }
index e16c91f..b2aaa30 100644 (file)
  */
 
 
-static inline const char* simcall_host_get_by_name__get__name(smx_simcall_t simcall) {
-  return  simcall->args[0].cc;
-}
-static inline void simcall_host_get_by_name__set__name(smx_simcall_t simcall, const char* arg) {
-    simcall->args[0].cc = arg;
-}
-static inline smx_host_t simcall_host_get_by_name__get__result(smx_simcall_t simcall){
-    return (smx_host_t) simcall->result.dp;
-}
-static inline void simcall_host_get_by_name__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
-}
-
-static inline smx_host_t simcall_host_get_name__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_name__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_name__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -40,22 +27,22 @@ static inline void simcall_host_get_name__set__result(smx_simcall_t simcall, con
     simcall->result.cc = result;
 }
 
-static inline smx_host_t simcall_host_on__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_on__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_on__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_host_off__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_off__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_off__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_host_get_properties__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_properties__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_properties__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -67,8 +54,8 @@ static inline void simcall_host_get_properties__set__result(smx_simcall_t simcal
     simcall->result.dp = result;
 }
 
-static inline smx_host_t simcall_host_get_core__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_core__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_core__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -80,8 +67,8 @@ static inline void simcall_host_get_core__set__result(smx_simcall_t simcall, int
     simcall->result.i = result;
 }
 
-static inline smx_host_t simcall_host_get_process_list__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_process_list__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_process_list__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -93,8 +80,8 @@ static inline void simcall_host_get_process_list__set__result(smx_simcall_t simc
     simcall->result.dp = result;
 }
 
-static inline smx_host_t simcall_host_get_speed__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_speed__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_speed__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -106,8 +93,8 @@ static inline void simcall_host_get_speed__set__result(smx_simcall_t simcall, do
     simcall->result.d = result;
 }
 
-static inline smx_host_t simcall_host_get_available_speed__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_available_speed__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_available_speed__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -119,8 +106,8 @@ static inline void simcall_host_get_available_speed__set__result(smx_simcall_t s
     simcall->result.d = result;
 }
 
-static inline smx_host_t simcall_host_get_state__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_state__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_state__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -132,8 +119,8 @@ static inline void simcall_host_get_state__set__result(smx_simcall_t simcall, in
     simcall->result.i = result;
 }
 
-static inline smx_host_t simcall_host_get_current_power_peak__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_current_power_peak__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_current_power_peak__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -145,8 +132,8 @@ static inline void simcall_host_get_current_power_peak__set__result(smx_simcall_
     simcall->result.d = result;
 }
 
-static inline smx_host_t simcall_host_get_power_peak_at__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_power_peak_at__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_power_peak_at__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -164,8 +151,8 @@ static inline void simcall_host_get_power_peak_at__set__result(smx_simcall_t sim
     simcall->result.d = result;
 }
 
-static inline smx_host_t simcall_host_get_nb_pstates__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_nb_pstates__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_nb_pstates__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -177,8 +164,8 @@ static inline void simcall_host_get_nb_pstates__set__result(smx_simcall_t simcal
     simcall->result.i = result;
 }
 
-static inline smx_host_t simcall_host_get_wattmin_at__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_wattmin_at__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_wattmin_at__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -196,8 +183,8 @@ static inline void simcall_host_get_wattmin_at__set__result(smx_simcall_t simcal
     simcall->result.d = result;
 }
 
-static inline smx_host_t simcall_host_get_wattmax_at__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_wattmax_at__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_wattmax_at__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -215,8 +202,8 @@ static inline void simcall_host_get_wattmax_at__set__result(smx_simcall_t simcal
     simcall->result.d = result;
 }
 
-static inline smx_host_t simcall_host_set_pstate__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_set_pstate__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_set_pstate__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -228,8 +215,8 @@ static inline void simcall_host_set_pstate__set__pstate_index(smx_simcall_t simc
     simcall->args[1].i = arg;
 }
 
-static inline smx_host_t simcall_host_get_pstate__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_pstate__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_pstate__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -241,8 +228,8 @@ static inline void simcall_host_get_pstate__set__result(smx_simcall_t simcall, i
     simcall->result.i = result;
 }
 
-static inline smx_host_t simcall_host_get_consumed_energy__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_consumed_energy__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_consumed_energy__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -254,198 +241,8 @@ static inline void simcall_host_get_consumed_energy__set__result(smx_simcall_t s
     simcall->result.d = result;
 }
 
-static inline const char* simcall_host_execute__get__name(smx_simcall_t simcall) {
-  return  simcall->args[0].cc;
-}
-static inline void simcall_host_execute__set__name(smx_simcall_t simcall, const char* arg) {
-    simcall->args[0].cc = arg;
-}
-static inline smx_host_t simcall_host_execute__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
-}
-static inline void simcall_host_execute__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
-}
-static inline double simcall_host_execute__get__flops_amount(smx_simcall_t simcall) {
-  return  simcall->args[2].d;
-}
-static inline void simcall_host_execute__set__flops_amount(smx_simcall_t simcall, double arg) {
-    simcall->args[2].d = arg;
-}
-static inline double simcall_host_execute__get__priority(smx_simcall_t simcall) {
-  return  simcall->args[3].d;
-}
-static inline void simcall_host_execute__set__priority(smx_simcall_t simcall, double arg) {
-    simcall->args[3].d = arg;
-}
-static inline double simcall_host_execute__get__bound(smx_simcall_t simcall) {
-  return  simcall->args[4].d;
-}
-static inline void simcall_host_execute__set__bound(smx_simcall_t simcall, double arg) {
-    simcall->args[4].d = arg;
-}
-static inline unsigned long simcall_host_execute__get__affinity_mask(smx_simcall_t simcall) {
-  return  simcall->args[5].ul;
-}
-static inline void simcall_host_execute__set__affinity_mask(smx_simcall_t simcall, unsigned long arg) {
-    simcall->args[5].ul = arg;
-}
-static inline smx_synchro_t simcall_host_execute__get__result(smx_simcall_t simcall){
-    return (smx_synchro_t) simcall->result.dp;
-}
-static inline void simcall_host_execute__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
-}
-
-static inline const char* simcall_host_parallel_execute__get__name(smx_simcall_t simcall) {
-  return  simcall->args[0].cc;
-}
-static inline void simcall_host_parallel_execute__set__name(smx_simcall_t simcall, const char* arg) {
-    simcall->args[0].cc = arg;
-}
-static inline int simcall_host_parallel_execute__get__host_nb(smx_simcall_t simcall) {
-  return  simcall->args[1].i;
-}
-static inline void simcall_host_parallel_execute__set__host_nb(smx_simcall_t simcall, int arg) {
-    simcall->args[1].i = arg;
-}
-static inline smx_host_t* simcall_host_parallel_execute__get__host_list(smx_simcall_t simcall) {
-  return (smx_host_t*) simcall->args[2].dp;
-}
-static inline void simcall_host_parallel_execute__set__host_list(smx_simcall_t simcall, void* arg) {
-    simcall->args[2].dp = arg;
-}
-static inline double* simcall_host_parallel_execute__get__flops_amount(smx_simcall_t simcall) {
-  return (double*) simcall->args[3].dp;
-}
-static inline void simcall_host_parallel_execute__set__flops_amount(smx_simcall_t simcall, void* arg) {
-    simcall->args[3].dp = arg;
-}
-static inline double* simcall_host_parallel_execute__get__bytes_amount(smx_simcall_t simcall) {
-  return (double*) simcall->args[4].dp;
-}
-static inline void simcall_host_parallel_execute__set__bytes_amount(smx_simcall_t simcall, void* arg) {
-    simcall->args[4].dp = arg;
-}
-static inline double simcall_host_parallel_execute__get__amount(smx_simcall_t simcall) {
-  return  simcall->args[5].d;
-}
-static inline void simcall_host_parallel_execute__set__amount(smx_simcall_t simcall, double arg) {
-    simcall->args[5].d = arg;
-}
-static inline double simcall_host_parallel_execute__get__rate(smx_simcall_t simcall) {
-  return  simcall->args[6].d;
-}
-static inline void simcall_host_parallel_execute__set__rate(smx_simcall_t simcall, double arg) {
-    simcall->args[6].d = arg;
-}
-static inline smx_synchro_t simcall_host_parallel_execute__get__result(smx_simcall_t simcall){
-    return (smx_synchro_t) simcall->result.dp;
-}
-static inline void simcall_host_parallel_execute__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
-}
-
-static inline smx_synchro_t simcall_host_execution_destroy__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_host_execution_destroy__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-
-static inline smx_synchro_t simcall_host_execution_cancel__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_host_execution_cancel__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-
-static inline smx_synchro_t simcall_host_execution_get_remains__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_host_execution_get_remains__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline double simcall_host_execution_get_remains__get__result(smx_simcall_t simcall){
-    return  simcall->result.d;
-}
-static inline void simcall_host_execution_get_remains__set__result(smx_simcall_t simcall, double result){
-    simcall->result.d = result;
-}
-
-static inline smx_synchro_t simcall_host_execution_get_state__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_host_execution_get_state__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline e_smx_state_t simcall_host_execution_get_state__get__result(smx_simcall_t simcall){
-    return (e_smx_state_t) simcall->result.i;
-}
-static inline void simcall_host_execution_get_state__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
-}
-
-static inline smx_synchro_t simcall_host_execution_set_priority__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_host_execution_set_priority__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline double simcall_host_execution_set_priority__get__priority(smx_simcall_t simcall) {
-  return  simcall->args[1].d;
-}
-static inline void simcall_host_execution_set_priority__set__priority(smx_simcall_t simcall, double arg) {
-    simcall->args[1].d = arg;
-}
-
-static inline smx_synchro_t simcall_host_execution_set_bound__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_host_execution_set_bound__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline double simcall_host_execution_set_bound__get__bound(smx_simcall_t simcall) {
-  return  simcall->args[1].d;
-}
-static inline void simcall_host_execution_set_bound__set__bound(smx_simcall_t simcall, double arg) {
-    simcall->args[1].d = arg;
-}
-
-static inline smx_synchro_t simcall_host_execution_set_affinity__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_host_execution_set_affinity__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline smx_host_t simcall_host_execution_set_affinity__get__ws(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
-}
-static inline void simcall_host_execution_set_affinity__set__ws(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
-}
-static inline unsigned long simcall_host_execution_set_affinity__get__mask(smx_simcall_t simcall) {
-  return  simcall->args[2].ul;
-}
-static inline void simcall_host_execution_set_affinity__set__mask(smx_simcall_t simcall, unsigned long arg) {
-    simcall->args[2].ul = arg;
-}
-
-static inline smx_synchro_t simcall_host_execution_wait__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_host_execution_wait__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline int simcall_host_execution_wait__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
-}
-static inline void simcall_host_execution_wait__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
-}
-
-static inline smx_host_t simcall_host_get_mounted_storage_list__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_mounted_storage_list__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_mounted_storage_list__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -457,8 +254,8 @@ static inline void simcall_host_get_mounted_storage_list__set__result(smx_simcal
     simcall->result.dp = result;
 }
 
-static inline smx_host_t simcall_host_get_attached_storage_list__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_attached_storage_list__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_attached_storage_list__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -470,27 +267,27 @@ static inline void simcall_host_get_attached_storage_list__set__result(smx_simca
     simcall->result.dp = result;
 }
 
-static inline smx_host_t simcall_host_get_params__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_get_params__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_get_params__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline ws_params_t simcall_host_get_params__get__params(smx_simcall_t simcall) {
-  return (ws_params_t) simcall->args[1].dp;
+static inline vm_params_t simcall_host_get_params__get__params(smx_simcall_t simcall) {
+  return (vm_params_t) simcall->args[1].dp;
 }
 static inline void simcall_host_get_params__set__params(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
 }
 
-static inline smx_host_t simcall_host_set_params__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_host_set_params__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_host_set_params__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline ws_params_t simcall_host_set_params__get__params(smx_simcall_t simcall) {
-  return (ws_params_t) simcall->args[1].dp;
+static inline vm_params_t simcall_host_set_params__get__params(smx_simcall_t simcall) {
+  return (vm_params_t) simcall->args[1].dp;
 }
 static inline void simcall_host_set_params__set__params(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
@@ -502,28 +299,28 @@ static inline const char* simcall_vm_create__get__name(smx_simcall_t simcall) {
 static inline void simcall_vm_create__set__name(smx_simcall_t simcall, const char* arg) {
     simcall->args[0].cc = arg;
 }
-static inline smx_host_t simcall_vm_create__get__ind_pm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
+static inline sg_host_t simcall_vm_create__get__ind_pm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
 }
 static inline void simcall_vm_create__set__ind_pm(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
 }
-static inline smx_host_t simcall_vm_create__get__result(smx_simcall_t simcall){
-    return (smx_host_t) simcall->result.dp;
+static inline sg_host_t simcall_vm_create__get__result(smx_simcall_t simcall){
+    return (sg_host_t) simcall->result.dp;
 }
 static inline void simcall_vm_create__set__result(smx_simcall_t simcall, void* result){
     simcall->result.dp = result;
 }
 
-static inline smx_host_t simcall_vm_start__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_start__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_start__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_vm_get_state__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_get_state__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_get_state__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -535,21 +332,21 @@ static inline void simcall_vm_get_state__set__result(smx_simcall_t simcall, int
     simcall->result.i = result;
 }
 
-static inline smx_host_t simcall_vm_migrate__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_migrate__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_migrate__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline smx_host_t simcall_vm_migrate__get__ind_dst_pm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
+static inline sg_host_t simcall_vm_migrate__get__ind_dst_pm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
 }
 static inline void simcall_vm_migrate__set__ind_dst_pm(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
 }
 
-static inline smx_host_t simcall_vm_get_pm__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_get_pm__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_get_pm__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -561,8 +358,8 @@ static inline void simcall_vm_get_pm__set__result(smx_simcall_t simcall, void* r
     simcall->result.dp = result;
 }
 
-static inline smx_host_t simcall_vm_set_bound__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_set_bound__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_set_bound__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
@@ -574,14 +371,14 @@ static inline void simcall_vm_set_bound__set__bound(smx_simcall_t simcall, doubl
     simcall->args[1].d = arg;
 }
 
-static inline smx_host_t simcall_vm_set_affinity__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_set_affinity__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_set_affinity__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline smx_host_t simcall_vm_set_affinity__get__ind_pm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
+static inline sg_host_t simcall_vm_set_affinity__get__ind_pm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
 }
 static inline void simcall_vm_set_affinity__set__ind_pm(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
@@ -593,126 +390,126 @@ static inline void simcall_vm_set_affinity__set__mask(smx_simcall_t simcall, uns
     simcall->args[2].ul = arg;
 }
 
-static inline smx_host_t simcall_vm_destroy__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_destroy__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_destroy__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_vm_suspend__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_suspend__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_suspend__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_vm_resume__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_resume__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_resume__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_vm_shutdown__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_shutdown__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_shutdown__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_vm_save__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_save__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_save__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_vm_restore__get__ind_vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_restore__get__ind_vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_restore__set__ind_vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
 
-static inline smx_host_t simcall_vm_migratefrom_resumeto__get__vm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[0].dp;
+static inline sg_host_t simcall_vm_migratefrom_resumeto__get__vm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[0].dp;
 }
 static inline void simcall_vm_migratefrom_resumeto__set__vm(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline smx_host_t simcall_vm_migratefrom_resumeto__get__src_pm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
+static inline sg_host_t simcall_vm_migratefrom_resumeto__get__src_pm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
 }
 static inline void simcall_vm_migratefrom_resumeto__set__src_pm(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
 }
-static inline smx_host_t simcall_vm_migratefrom_resumeto__get__dst_pm(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[2].dp;
+static inline sg_host_t simcall_vm_migratefrom_resumeto__get__dst_pm(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[2].dp;
 }
 static inline void simcall_vm_migratefrom_resumeto__set__dst_pm(smx_simcall_t simcall, void* arg) {
     simcall->args[2].dp = arg;
 }
 
-static inline smx_process_t* simcall_process_create__get__process(smx_simcall_t simcall) {
-  return (smx_process_t*) simcall->args[0].dp;
-}
-static inline void simcall_process_create__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
 static inline const char* simcall_process_create__get__name(smx_simcall_t simcall) {
-  return  simcall->args[1].cc;
+  return  simcall->args[0].cc;
 }
 static inline void simcall_process_create__set__name(smx_simcall_t simcall, const char* arg) {
-    simcall->args[1].cc = arg;
+    simcall->args[0].cc = arg;
 }
 static inline xbt_main_func_t simcall_process_create__get__code(smx_simcall_t simcall) {
-  return (xbt_main_func_t) simcall->args[2].fp;
+  return (xbt_main_func_t) simcall->args[1].fp;
 }
 static inline void simcall_process_create__set__code(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[2].fp = arg;
+    simcall->args[1].fp = arg;
 }
 static inline void* simcall_process_create__get__data(smx_simcall_t simcall) {
-  return  simcall->args[3].dp;
+  return  simcall->args[2].dp;
 }
 static inline void simcall_process_create__set__data(smx_simcall_t simcall, void* arg) {
-    simcall->args[3].dp = arg;
+    simcall->args[2].dp = arg;
 }
 static inline const char* simcall_process_create__get__hostname(smx_simcall_t simcall) {
-  return  simcall->args[4].cc;
+  return  simcall->args[3].cc;
 }
 static inline void simcall_process_create__set__hostname(smx_simcall_t simcall, const char* arg) {
-    simcall->args[4].cc = arg;
+    simcall->args[3].cc = arg;
 }
 static inline double simcall_process_create__get__kill_time(smx_simcall_t simcall) {
-  return  simcall->args[5].d;
+  return  simcall->args[4].d;
 }
 static inline void simcall_process_create__set__kill_time(smx_simcall_t simcall, double arg) {
-    simcall->args[5].d = arg;
+    simcall->args[4].d = arg;
 }
 static inline int simcall_process_create__get__argc(smx_simcall_t simcall) {
-  return  simcall->args[6].i;
+  return  simcall->args[5].i;
 }
 static inline void simcall_process_create__set__argc(smx_simcall_t simcall, int arg) {
-    simcall->args[6].i = arg;
+    simcall->args[5].i = arg;
 }
 static inline char** simcall_process_create__get__argv(smx_simcall_t simcall) {
-  return (char**) simcall->args[7].dp;
+  return (char**) simcall->args[6].dp;
 }
 static inline void simcall_process_create__set__argv(smx_simcall_t simcall, void* arg) {
-    simcall->args[7].dp = arg;
+    simcall->args[6].dp = arg;
 }
 static inline xbt_dict_t simcall_process_create__get__properties(smx_simcall_t simcall) {
-  return (xbt_dict_t) simcall->args[8].dp;
+  return (xbt_dict_t) simcall->args[7].dp;
 }
 static inline void simcall_process_create__set__properties(smx_simcall_t simcall, void* arg) {
-    simcall->args[8].dp = arg;
+    simcall->args[7].dp = arg;
 }
 static inline int simcall_process_create__get__auto_restart(smx_simcall_t simcall) {
-  return  simcall->args[9].i;
+  return  simcall->args[8].i;
 }
 static inline void simcall_process_create__set__auto_restart(smx_simcall_t simcall, int arg) {
-    simcall->args[9].i = arg;
+    simcall->args[8].i = arg;
+}
+static inline void* simcall_process_create__get__result(smx_simcall_t simcall){
+    return  simcall->result.dp;
+}
+static inline void simcall_process_create__set__result(smx_simcall_t simcall, void* result){
+    simcall->result.dp = result;
 }
 
 static inline smx_process_t simcall_process_kill__get__process(smx_simcall_t simcall) {
@@ -742,8 +539,8 @@ static inline smx_process_t simcall_process_change_host__get__process(smx_simcal
 static inline void simcall_process_change_host__set__process(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline smx_host_t simcall_process_change_host__get__dest(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
+static inline sg_host_t simcall_process_change_host__get__dest(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
 }
 static inline void simcall_process_change_host__set__dest(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
@@ -828,8 +625,8 @@ static inline smx_process_t simcall_process_get_host__get__process(smx_simcall_t
 static inline void simcall_process_get_host__set__process(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline smx_host_t simcall_process_get_host__get__result(smx_simcall_t simcall){
-    return (smx_host_t) simcall->result.dp;
+static inline sg_host_t simcall_process_get_host__get__result(smx_simcall_t simcall){
+    return (sg_host_t) simcall->result.dp;
 }
 static inline void simcall_process_get_host__set__result(smx_simcall_t simcall, void* result){
     simcall->result.dp = result;
@@ -906,6 +703,190 @@ static inline void simcall_process_sleep__set__result(smx_simcall_t simcall, int
     simcall->result.i = result;
 }
 
+static inline const char* simcall_process_execute__get__name(smx_simcall_t simcall) {
+  return  simcall->args[0].cc;
+}
+static inline void simcall_process_execute__set__name(smx_simcall_t simcall, const char* arg) {
+    simcall->args[0].cc = arg;
+}
+static inline double simcall_process_execute__get__flops_amount(smx_simcall_t simcall) {
+  return  simcall->args[1].d;
+}
+static inline void simcall_process_execute__set__flops_amount(smx_simcall_t simcall, double arg) {
+    simcall->args[1].d = arg;
+}
+static inline double simcall_process_execute__get__priority(smx_simcall_t simcall) {
+  return  simcall->args[2].d;
+}
+static inline void simcall_process_execute__set__priority(smx_simcall_t simcall, double arg) {
+    simcall->args[2].d = arg;
+}
+static inline double simcall_process_execute__get__bound(smx_simcall_t simcall) {
+  return  simcall->args[3].d;
+}
+static inline void simcall_process_execute__set__bound(smx_simcall_t simcall, double arg) {
+    simcall->args[3].d = arg;
+}
+static inline unsigned long simcall_process_execute__get__affinity_mask(smx_simcall_t simcall) {
+  return  simcall->args[4].ul;
+}
+static inline void simcall_process_execute__set__affinity_mask(smx_simcall_t simcall, unsigned long arg) {
+    simcall->args[4].ul = arg;
+}
+static inline smx_synchro_t simcall_process_execute__get__result(smx_simcall_t simcall){
+    return (smx_synchro_t) simcall->result.dp;
+}
+static inline void simcall_process_execute__set__result(smx_simcall_t simcall, void* result){
+    simcall->result.dp = result;
+}
+
+static inline const char* simcall_process_parallel_execute__get__name(smx_simcall_t simcall) {
+  return  simcall->args[0].cc;
+}
+static inline void simcall_process_parallel_execute__set__name(smx_simcall_t simcall, const char* arg) {
+    simcall->args[0].cc = arg;
+}
+static inline int simcall_process_parallel_execute__get__host_nb(smx_simcall_t simcall) {
+  return  simcall->args[1].i;
+}
+static inline void simcall_process_parallel_execute__set__host_nb(smx_simcall_t simcall, int arg) {
+    simcall->args[1].i = arg;
+}
+static inline sg_host_t* simcall_process_parallel_execute__get__host_list(smx_simcall_t simcall) {
+  return (sg_host_t*) simcall->args[2].dp;
+}
+static inline void simcall_process_parallel_execute__set__host_list(smx_simcall_t simcall, void* arg) {
+    simcall->args[2].dp = arg;
+}
+static inline double* simcall_process_parallel_execute__get__flops_amount(smx_simcall_t simcall) {
+  return (double*) simcall->args[3].dp;
+}
+static inline void simcall_process_parallel_execute__set__flops_amount(smx_simcall_t simcall, void* arg) {
+    simcall->args[3].dp = arg;
+}
+static inline double* simcall_process_parallel_execute__get__bytes_amount(smx_simcall_t simcall) {
+  return (double*) simcall->args[4].dp;
+}
+static inline void simcall_process_parallel_execute__set__bytes_amount(smx_simcall_t simcall, void* arg) {
+    simcall->args[4].dp = arg;
+}
+static inline double simcall_process_parallel_execute__get__amount(smx_simcall_t simcall) {
+  return  simcall->args[5].d;
+}
+static inline void simcall_process_parallel_execute__set__amount(smx_simcall_t simcall, double arg) {
+    simcall->args[5].d = arg;
+}
+static inline double simcall_process_parallel_execute__get__rate(smx_simcall_t simcall) {
+  return  simcall->args[6].d;
+}
+static inline void simcall_process_parallel_execute__set__rate(smx_simcall_t simcall, double arg) {
+    simcall->args[6].d = arg;
+}
+static inline smx_synchro_t simcall_process_parallel_execute__get__result(smx_simcall_t simcall){
+    return (smx_synchro_t) simcall->result.dp;
+}
+static inline void simcall_process_parallel_execute__set__result(smx_simcall_t simcall, void* result){
+    simcall->result.dp = result;
+}
+
+static inline smx_synchro_t simcall_process_execution_destroy__get__execution(smx_simcall_t simcall) {
+  return (smx_synchro_t) simcall->args[0].dp;
+}
+static inline void simcall_process_execution_destroy__set__execution(smx_simcall_t simcall, void* arg) {
+    simcall->args[0].dp = arg;
+}
+
+static inline smx_synchro_t simcall_process_execution_cancel__get__execution(smx_simcall_t simcall) {
+  return (smx_synchro_t) simcall->args[0].dp;
+}
+static inline void simcall_process_execution_cancel__set__execution(smx_simcall_t simcall, void* arg) {
+    simcall->args[0].dp = arg;
+}
+
+static inline smx_synchro_t simcall_process_execution_get_remains__get__execution(smx_simcall_t simcall) {
+  return (smx_synchro_t) simcall->args[0].dp;
+}
+static inline void simcall_process_execution_get_remains__set__execution(smx_simcall_t simcall, void* arg) {
+    simcall->args[0].dp = arg;
+}
+static inline double simcall_process_execution_get_remains__get__result(smx_simcall_t simcall){
+    return  simcall->result.d;
+}
+static inline void simcall_process_execution_get_remains__set__result(smx_simcall_t simcall, double result){
+    simcall->result.d = result;
+}
+
+static inline smx_synchro_t simcall_process_execution_get_state__get__execution(smx_simcall_t simcall) {
+  return (smx_synchro_t) simcall->args[0].dp;
+}
+static inline void simcall_process_execution_get_state__set__execution(smx_simcall_t simcall, void* arg) {
+    simcall->args[0].dp = arg;
+}
+static inline e_smx_state_t simcall_process_execution_get_state__get__result(smx_simcall_t simcall){
+    return (e_smx_state_t) simcall->result.i;
+}
+static inline void simcall_process_execution_get_state__set__result(smx_simcall_t simcall, int result){
+    simcall->result.i = result;
+}
+
+static inline smx_synchro_t simcall_process_execution_set_priority__get__execution(smx_simcall_t simcall) {
+  return (smx_synchro_t) simcall->args[0].dp;
+}
+static inline void simcall_process_execution_set_priority__set__execution(smx_simcall_t simcall, void* arg) {
+    simcall->args[0].dp = arg;
+}
+static inline double simcall_process_execution_set_priority__get__priority(smx_simcall_t simcall) {
+  return  simcall->args[1].d;
+}
+static inline void simcall_process_execution_set_priority__set__priority(smx_simcall_t simcall, double arg) {
+    simcall->args[1].d = arg;
+}
+
+static inline smx_synchro_t simcall_process_execution_set_bound__get__execution(smx_simcall_t simcall) {
+  return (smx_synchro_t) simcall->args[0].dp;
+}
+static inline void simcall_process_execution_set_bound__set__execution(smx_simcall_t simcall, void* arg) {
+    simcall->args[0].dp = arg;
+}
+static inline double simcall_process_execution_set_bound__get__bound(smx_simcall_t simcall) {
+  return  simcall->args[1].d;
+}
+static inline void simcall_process_execution_set_bound__set__bound(smx_simcall_t simcall, double arg) {
+    simcall->args[1].d = arg;
+}
+
+static inline smx_synchro_t simcall_process_execution_set_affinity__get__execution(smx_simcall_t simcall) {
+  return (smx_synchro_t) simcall->args[0].dp;
+}
+static inline void simcall_process_execution_set_affinity__set__execution(smx_simcall_t simcall, void* arg) {
+    simcall->args[0].dp = arg;
+}
+static inline sg_host_t simcall_process_execution_set_affinity__get__ws(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
+}
+static inline void simcall_process_execution_set_affinity__set__ws(smx_simcall_t simcall, void* arg) {
+    simcall->args[1].dp = arg;
+}
+static inline unsigned long simcall_process_execution_set_affinity__get__mask(smx_simcall_t simcall) {
+  return  simcall->args[2].ul;
+}
+static inline void simcall_process_execution_set_affinity__set__mask(smx_simcall_t simcall, unsigned long arg) {
+    simcall->args[2].ul = arg;
+}
+
+static inline smx_synchro_t simcall_process_execution_wait__get__execution(smx_simcall_t simcall) {
+  return (smx_synchro_t) simcall->args[0].dp;
+}
+static inline void simcall_process_execution_wait__set__execution(smx_simcall_t simcall, void* arg) {
+    simcall->args[0].dp = arg;
+}
+static inline int simcall_process_execution_wait__get__result(smx_simcall_t simcall){
+    return  simcall->result.i;
+}
+static inline void simcall_process_execution_wait__set__result(smx_simcall_t simcall, int result){
+    simcall->result.i = result;
+}
+
 static inline smx_process_t simcall_process_on_exit__get__process(smx_simcall_t simcall) {
   return (smx_process_t) simcall->args[0].dp;
 }
@@ -977,8 +958,8 @@ static inline smx_rdv_t simcall_rdv_comm_count_by_host__get__rdv(smx_simcall_t s
 static inline void simcall_rdv_comm_count_by_host__set__rdv(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline smx_host_t simcall_rdv_comm_count_by_host__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
+static inline sg_host_t simcall_rdv_comm_count_by_host__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
 }
 static inline void simcall_rdv_comm_count_by_host__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
@@ -1627,8 +1608,8 @@ static inline sg_size_t simcall_file_read__get__size(smx_simcall_t simcall) {
 static inline void simcall_file_read__set__size(smx_simcall_t simcall, sg_size_t arg) {
     simcall->args[1].sgsz = arg;
 }
-static inline smx_host_t simcall_file_read__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[2].dp;
+static inline sg_host_t simcall_file_read__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[2].dp;
 }
 static inline void simcall_file_read__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[2].dp = arg;
@@ -1652,8 +1633,8 @@ static inline sg_size_t simcall_file_write__get__size(smx_simcall_t simcall) {
 static inline void simcall_file_write__set__size(smx_simcall_t simcall, sg_size_t arg) {
     simcall->args[1].sgsz = arg;
 }
-static inline smx_host_t simcall_file_write__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[2].dp;
+static inline sg_host_t simcall_file_write__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[2].dp;
 }
 static inline void simcall_file_write__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[2].dp = arg;
@@ -1671,8 +1652,8 @@ static inline const char* simcall_file_open__get__fullpath(smx_simcall_t simcall
 static inline void simcall_file_open__set__fullpath(smx_simcall_t simcall, const char* arg) {
     simcall->args[0].cc = arg;
 }
-static inline smx_host_t simcall_file_open__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
+static inline sg_host_t simcall_file_open__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
 }
 static inline void simcall_file_open__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
@@ -1690,8 +1671,8 @@ static inline smx_file_t simcall_file_close__get__fd(smx_simcall_t simcall) {
 static inline void simcall_file_close__set__fd(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline smx_host_t simcall_file_close__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
+static inline sg_host_t simcall_file_close__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
 }
 static inline void simcall_file_close__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
@@ -1709,8 +1690,8 @@ static inline smx_file_t simcall_file_unlink__get__fd(smx_simcall_t simcall) {
 static inline void simcall_file_unlink__set__fd(smx_simcall_t simcall, void* arg) {
     simcall->args[0].dp = arg;
 }
-static inline smx_host_t simcall_file_unlink__get__host(smx_simcall_t simcall) {
-  return (smx_host_t) simcall->args[1].dp;
+static inline sg_host_t simcall_file_unlink__get__host(smx_simcall_t simcall) {
+  return (sg_host_t) simcall->args[1].dp;
 }
 static inline void simcall_file_unlink__set__host(smx_simcall_t simcall, void* arg) {
     simcall->args[1].dp = arg;
@@ -1949,21 +1930,22 @@ static inline void simcall_mc_compare_snapshots__set__result(smx_simcall_t simca
 
 /* The prototype of all simcall handlers, automatically generated for you */
 
-void simcall_HANDLER_host_off(smx_simcall_t simcall, smx_host_t host);
-void simcall_HANDLER_host_execution_wait(smx_simcall_t simcall, smx_synchro_t execution);
-void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm);
-void simcall_HANDLER_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm);
-void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm);
-void simcall_HANDLER_vm_save(smx_simcall_t simcall, smx_host_t ind_vm);
-void simcall_HANDLER_vm_restore(smx_simcall_t simcall, smx_host_t ind_vm);
-void simcall_HANDLER_process_create(smx_simcall_t simcall, smx_process_t* process, const char* name, xbt_main_func_t code, void* data, const char* hostname, double kill_time, int argc, char** argv, xbt_dict_t properties, int auto_restart);
+void simcall_HANDLER_host_off(smx_simcall_t simcall, sg_host_t host);
+void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, sg_host_t ind_vm);
+void simcall_HANDLER_vm_resume(smx_simcall_t simcall, sg_host_t ind_vm);
+void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, sg_host_t ind_vm);
+void simcall_HANDLER_vm_save(smx_simcall_t simcall, sg_host_t ind_vm);
+void simcall_HANDLER_vm_restore(smx_simcall_t simcall, sg_host_t ind_vm);
+void* simcall_HANDLER_process_create(smx_simcall_t simcall, const char* name, xbt_main_func_t code, void* data, const char* hostname, double kill_time, int argc, char** argv, xbt_dict_t properties, int auto_restart);
 void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_process_t process);
 void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid);
-void simcall_HANDLER_process_change_host(smx_simcall_t simcall, smx_process_t process, smx_host_t dest);
+void simcall_HANDLER_process_change_host(smx_simcall_t simcall, smx_process_t process, sg_host_t dest);
 void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_process_t process);
 void simcall_HANDLER_process_resume(smx_simcall_t simcall, smx_process_t process);
 void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, double timeout);
 void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration);
+smx_synchro_t simcall_HANDLER_process_execute(smx_simcall_t simcall, const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask);
+void simcall_HANDLER_process_execution_wait(smx_simcall_t simcall, smx_synchro_t execution);
 smx_process_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_process_t process);
 smx_synchro_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv, int type, int src, int tag, simix_match_func_t match_fun, void* data);
 void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout);
@@ -1985,10 +1967,10 @@ int simcall_HANDLER_sem_would_block(smx_simcall_t simcall, smx_sem_t sem);
 void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
 void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
 int simcall_HANDLER_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem);
-void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host);
-void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host);
-void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, smx_host_t host);
-void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, smx_host_t host);
+void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host);
+void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host);
+void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, sg_host_t host);
+void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, sg_host_t host);
 sg_size_t simcall_HANDLER_file_get_size(smx_simcall_t simcall, smx_file_t fd);
 sg_size_t simcall_HANDLER_file_tell(smx_simcall_t simcall, smx_file_t fd);
 int simcall_HANDLER_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t offset, int origin);
index 6f0afee..b808841 100644 (file)
 #include "mc/mc_forward.h"
 #include "xbt/ex.h"
   
-inline static smx_host_t simcall_BODY_host_get_by_name(const char* name) {
-    smx_process_t self = SIMIX_process_self();
-
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_get_by_name(name);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_HOST_GET_BY_NAME;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].cc = (const char*) name;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return self->simcall.result.dp;
-  }
-  
-inline static const char* simcall_BODY_host_get_name(smx_host_t host) {
+inline static const char* simcall_BODY_host_get_name(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -59,7 +38,7 @@ inline static const char* simcall_BODY_host_get_name(smx_host_t host) {
     return self->simcall.result.cc;
   }
   
-inline static void simcall_BODY_host_on(smx_host_t host) {
+inline static void simcall_BODY_host_on(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -80,7 +59,7 @@ inline static void simcall_BODY_host_on(smx_host_t host) {
     
   }
   
-inline static void simcall_BODY_host_off(smx_host_t host) {
+inline static void simcall_BODY_host_off(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -101,7 +80,7 @@ inline static void simcall_BODY_host_off(smx_host_t host) {
     
   }
   
-inline static xbt_dict_t simcall_BODY_host_get_properties(smx_host_t host) {
+inline static xbt_dict_t simcall_BODY_host_get_properties(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -122,7 +101,7 @@ inline static xbt_dict_t simcall_BODY_host_get_properties(smx_host_t host) {
     return self->simcall.result.dp;
   }
   
-inline static int simcall_BODY_host_get_core(smx_host_t host) {
+inline static int simcall_BODY_host_get_core(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -143,7 +122,7 @@ inline static int simcall_BODY_host_get_core(smx_host_t host) {
     return self->simcall.result.i;
   }
   
-inline static xbt_swag_t simcall_BODY_host_get_process_list(smx_host_t host) {
+inline static xbt_swag_t simcall_BODY_host_get_process_list(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -164,7 +143,7 @@ inline static xbt_swag_t simcall_BODY_host_get_process_list(smx_host_t host) {
     return self->simcall.result.dp;
   }
   
-inline static double simcall_BODY_host_get_speed(smx_host_t host) {
+inline static double simcall_BODY_host_get_speed(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -185,7 +164,7 @@ inline static double simcall_BODY_host_get_speed(smx_host_t host) {
     return self->simcall.result.d;
   }
   
-inline static double simcall_BODY_host_get_available_speed(smx_host_t host) {
+inline static double simcall_BODY_host_get_available_speed(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -206,7 +185,7 @@ inline static double simcall_BODY_host_get_available_speed(smx_host_t host) {
     return self->simcall.result.d;
   }
   
-inline static int simcall_BODY_host_get_state(smx_host_t host) {
+inline static int simcall_BODY_host_get_state(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -227,7 +206,7 @@ inline static int simcall_BODY_host_get_state(smx_host_t host) {
     return self->simcall.result.i;
   }
   
-inline static double simcall_BODY_host_get_current_power_peak(smx_host_t host) {
+inline static double simcall_BODY_host_get_current_power_peak(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -248,7 +227,7 @@ inline static double simcall_BODY_host_get_current_power_peak(smx_host_t host) {
     return self->simcall.result.d;
   }
   
-inline static double simcall_BODY_host_get_power_peak_at(smx_host_t host, int pstate_index) {
+inline static double simcall_BODY_host_get_power_peak_at(sg_host_t host, int pstate_index) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -270,7 +249,7 @@ inline static double simcall_BODY_host_get_power_peak_at(smx_host_t host, int ps
     return self->simcall.result.d;
   }
   
-inline static int simcall_BODY_host_get_nb_pstates(smx_host_t host) {
+inline static int simcall_BODY_host_get_nb_pstates(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -291,7 +270,7 @@ inline static int simcall_BODY_host_get_nb_pstates(smx_host_t host) {
     return self->simcall.result.i;
   }
   
-inline static double simcall_BODY_host_get_wattmin_at(smx_host_t host, int pstate_index) {
+inline static double simcall_BODY_host_get_wattmin_at(sg_host_t host, int pstate_index) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -313,7 +292,7 @@ inline static double simcall_BODY_host_get_wattmin_at(smx_host_t host, int pstat
     return self->simcall.result.d;
   }
   
-inline static double simcall_BODY_host_get_wattmax_at(smx_host_t host, int pstate_index) {
+inline static double simcall_BODY_host_get_wattmax_at(sg_host_t host, int pstate_index) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -335,7 +314,7 @@ inline static double simcall_BODY_host_get_wattmax_at(smx_host_t host, int pstat
     return self->simcall.result.d;
   }
   
-inline static void simcall_BODY_host_set_pstate(smx_host_t host, int pstate_index) {
+inline static void simcall_BODY_host_set_pstate(sg_host_t host, int pstate_index) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -357,7 +336,7 @@ inline static void simcall_BODY_host_set_pstate(smx_host_t host, int pstate_inde
     
   }
   
-inline static int simcall_BODY_host_get_pstate(smx_host_t host) {
+inline static int simcall_BODY_host_get_pstate(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -378,7 +357,7 @@ inline static int simcall_BODY_host_get_pstate(smx_host_t host) {
     return self->simcall.result.i;
   }
   
-inline static double simcall_BODY_host_get_consumed_energy(smx_host_t host) {
+inline static double simcall_BODY_host_get_consumed_energy(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -399,22 +378,17 @@ inline static double simcall_BODY_host_get_consumed_energy(smx_host_t host) {
     return self->simcall.result.d;
   }
   
-inline static smx_synchro_t simcall_BODY_host_execute(const char* name, smx_host_t host, double flops_amount, double priority, double bound, unsigned long affinity_mask) {
+inline static xbt_dict_t simcall_BODY_host_get_mounted_storage_list(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_execute(name, host, flops_amount, priority, bound, affinity_mask);
+    if (0) SIMIX_host_get_mounted_storage_list(host);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_EXECUTE;
+    self->simcall.call = SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].cc = (const char*) name;
-    self->simcall.args[1].dp = (void*) host;
-    self->simcall.args[2].d = (double) flops_amount;
-    self->simcall.args[3].d = (double) priority;
-    self->simcall.args[4].d = (double) bound;
-    self->simcall.args[5].ul = (unsigned long) affinity_mask;
+    self->simcall.args[0].dp = (void*) host;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -425,23 +399,17 @@ inline static smx_synchro_t simcall_BODY_host_execute(const char* name, smx_host
     return self->simcall.result.dp;
   }
   
-inline static smx_synchro_t simcall_BODY_host_parallel_execute(const char* name, int host_nb, smx_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate) {
+inline static xbt_dynar_t simcall_BODY_host_get_attached_storage_list(sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_parallel_execute(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate);
+    if (0) SIMIX_host_get_attached_storage_list(host);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_PARALLEL_EXECUTE;
+    self->simcall.call = SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].cc = (const char*) name;
-    self->simcall.args[1].i = (int) host_nb;
-    self->simcall.args[2].dp = (void*) host_list;
-    self->simcall.args[3].dp = (void*) flops_amount;
-    self->simcall.args[4].dp = (void*) bytes_amount;
-    self->simcall.args[5].d = (double) amount;
-    self->simcall.args[6].d = (double) rate;
+    self->simcall.args[0].dp = (void*) host;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -452,17 +420,18 @@ inline static smx_synchro_t simcall_BODY_host_parallel_execute(const char* name,
     return self->simcall.result.dp;
   }
   
-inline static void simcall_BODY_host_execution_destroy(smx_synchro_t execution) {
+inline static void simcall_BODY_host_get_params(sg_host_t ind_vm, vm_params_t params) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_execution_destroy(execution);
+    if (0) SIMIX_host_get_params(ind_vm, params);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_EXECUTION_DESTROY;
+    self->simcall.call = SIMCALL_HOST_GET_PARAMS;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
+    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[1].dp = (void*) params;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -473,17 +442,18 @@ inline static void simcall_BODY_host_execution_destroy(smx_synchro_t execution)
     
   }
   
-inline static void simcall_BODY_host_execution_cancel(smx_synchro_t execution) {
+inline static void simcall_BODY_host_set_params(sg_host_t ind_vm, vm_params_t params) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_execution_cancel(execution);
+    if (0) SIMIX_host_set_params(ind_vm, params);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_EXECUTION_CANCEL;
+    self->simcall.call = SIMCALL_HOST_SET_PARAMS;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
+    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[1].dp = (void*) params;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -494,17 +464,18 @@ inline static void simcall_BODY_host_execution_cancel(smx_synchro_t execution) {
     
   }
   
-inline static double simcall_BODY_host_execution_get_remains(smx_synchro_t execution) {
+inline static sg_host_t simcall_BODY_vm_create(const char* name, sg_host_t ind_pm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_execution_get_remains(execution);
+    if (0) SIMIX_vm_create(name, ind_pm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_EXECUTION_GET_REMAINS;
+    self->simcall.call = SIMCALL_VM_CREATE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
+    self->simcall.args[0].cc = (const char*) name;
+    self->simcall.args[1].dp = (void*) ind_pm;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -512,20 +483,20 @@ inline static double simcall_BODY_host_execution_get_remains(smx_synchro_t execu
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.d;
+    return self->simcall.result.dp;
   }
   
-inline static e_smx_state_t simcall_BODY_host_execution_get_state(smx_synchro_t execution) {
+inline static void simcall_BODY_vm_start(sg_host_t ind_vm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_execution_get_state(execution);
+    if (0) SIMIX_vm_start(ind_vm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_EXECUTION_GET_STATE;
+    self->simcall.call = SIMCALL_VM_START;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
+    self->simcall.args[0].dp = (void*) ind_vm;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -533,21 +504,20 @@ inline static e_smx_state_t simcall_BODY_host_execution_get_state(smx_synchro_t
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.i;
+    
   }
   
-inline static void simcall_BODY_host_execution_set_priority(smx_synchro_t execution, double priority) {
+inline static int simcall_BODY_vm_get_state(sg_host_t ind_vm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_execution_set_priority(execution, priority);
+    if (0) SIMIX_vm_get_state(ind_vm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_EXECUTION_SET_PRIORITY;
+    self->simcall.call = SIMCALL_VM_GET_STATE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
-    self->simcall.args[1].d = (double) priority;
+    self->simcall.args[0].dp = (void*) ind_vm;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -555,21 +525,21 @@ inline static void simcall_BODY_host_execution_set_priority(smx_synchro_t execut
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.i;
   }
   
-inline static void simcall_BODY_host_execution_set_bound(smx_synchro_t execution, double bound) {
+inline static void simcall_BODY_vm_migrate(sg_host_t ind_vm, sg_host_t ind_dst_pm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_execution_set_bound(execution, bound);
+    if (0) SIMIX_vm_migrate(ind_vm, ind_dst_pm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_EXECUTION_SET_BOUND;
+    self->simcall.call = SIMCALL_VM_MIGRATE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
-    self->simcall.args[1].d = (double) bound;
+    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[1].dp = (void*) ind_dst_pm;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -580,19 +550,17 @@ inline static void simcall_BODY_host_execution_set_bound(smx_synchro_t execution
     
   }
   
-inline static void simcall_BODY_host_execution_set_affinity(smx_synchro_t execution, smx_host_t ws, unsigned long mask) {
+inline static void* simcall_BODY_vm_get_pm(sg_host_t ind_vm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_execution_set_affinity(execution, ws, mask);
+    if (0) SIMIX_vm_get_pm(ind_vm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_EXECUTION_SET_AFFINITY;
+    self->simcall.call = SIMCALL_VM_GET_PM;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
-    self->simcall.args[1].dp = (void*) ws;
-    self->simcall.args[2].ul = (unsigned long) mask;
+    self->simcall.args[0].dp = (void*) ind_vm;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -600,20 +568,21 @@ inline static void simcall_BODY_host_execution_set_affinity(smx_synchro_t execut
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.dp;
   }
   
-inline static int simcall_BODY_host_execution_wait(smx_synchro_t execution) {
+inline static void simcall_BODY_vm_set_bound(sg_host_t ind_vm, double bound) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_host_execution_wait(&self->simcall, execution);
+    if (0) SIMIX_vm_set_bound(ind_vm, bound);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_EXECUTION_WAIT;
+    self->simcall.call = SIMCALL_VM_SET_BOUND;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
+    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[1].d = (double) bound;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -621,20 +590,22 @@ inline static int simcall_BODY_host_execution_wait(smx_synchro_t execution) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.i;
+    
   }
   
-inline static xbt_dict_t simcall_BODY_host_get_mounted_storage_list(smx_host_t host) {
+inline static void simcall_BODY_vm_set_affinity(sg_host_t ind_vm, sg_host_t ind_pm, unsigned long mask) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_get_mounted_storage_list(host);
+    if (0) SIMIX_vm_set_affinity(ind_vm, ind_pm, mask);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST;
+    self->simcall.call = SIMCALL_VM_SET_AFFINITY;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) host;
+    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[1].dp = (void*) ind_pm;
+    self->simcall.args[2].ul = (unsigned long) mask;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -642,20 +613,20 @@ inline static xbt_dict_t simcall_BODY_host_get_mounted_storage_list(smx_host_t h
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.dp;
+    
   }
   
-inline static xbt_dynar_t simcall_BODY_host_get_attached_storage_list(smx_host_t host) {
+inline static void simcall_BODY_vm_destroy(sg_host_t ind_vm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_get_attached_storage_list(host);
+    if (0) SIMIX_vm_destroy(ind_vm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST;
+    self->simcall.call = SIMCALL_VM_DESTROY;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) host;
+    self->simcall.args[0].dp = (void*) ind_vm;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -663,21 +634,20 @@ inline static xbt_dynar_t simcall_BODY_host_get_attached_storage_list(smx_host_t
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.dp;
+    
   }
   
-inline static void simcall_BODY_host_get_params(smx_host_t ind_vm, ws_params_t params) {
+inline static void simcall_BODY_vm_suspend(sg_host_t ind_vm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_get_params(ind_vm, params);
+    if (0) simcall_HANDLER_vm_suspend(&self->simcall, ind_vm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_GET_PARAMS;
+    self->simcall.call = SIMCALL_VM_SUSPEND;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) ind_vm;
-    self->simcall.args[1].dp = (void*) params;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -688,18 +658,17 @@ inline static void simcall_BODY_host_get_params(smx_host_t ind_vm, ws_params_t p
     
   }
   
-inline static void simcall_BODY_host_set_params(smx_host_t ind_vm, ws_params_t params) {
+inline static void simcall_BODY_vm_resume(sg_host_t ind_vm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_host_set_params(ind_vm, params);
+    if (0) simcall_HANDLER_vm_resume(&self->simcall, ind_vm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_HOST_SET_PARAMS;
+    self->simcall.call = SIMCALL_VM_RESUME;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) ind_vm;
-    self->simcall.args[1].dp = (void*) params;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -710,18 +679,17 @@ inline static void simcall_BODY_host_set_params(smx_host_t ind_vm, ws_params_t p
     
   }
   
-inline static smx_host_t simcall_BODY_vm_create(const char* name, smx_host_t ind_pm) {
+inline static void simcall_BODY_vm_shutdown(sg_host_t ind_vm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_create(name, ind_pm);
+    if (0) simcall_HANDLER_vm_shutdown(&self->simcall, ind_vm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_CREATE;
+    self->simcall.call = SIMCALL_VM_SHUTDOWN;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].cc = (const char*) name;
-    self->simcall.args[1].dp = (void*) ind_pm;
+    self->simcall.args[0].dp = (void*) ind_vm;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -729,17 +697,17 @@ inline static smx_host_t simcall_BODY_vm_create(const char* name, smx_host_t ind
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.dp;
+    
   }
   
-inline static void simcall_BODY_vm_start(smx_host_t ind_vm) {
+inline static void simcall_BODY_vm_save(sg_host_t ind_vm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_start(ind_vm);
+    if (0) simcall_HANDLER_vm_save(&self->simcall, ind_vm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_START;
+    self->simcall.call = SIMCALL_VM_SAVE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) ind_vm;
@@ -753,14 +721,14 @@ inline static void simcall_BODY_vm_start(smx_host_t ind_vm) {
     
   }
   
-inline static int simcall_BODY_vm_get_state(smx_host_t ind_vm) {
+inline static void simcall_BODY_vm_restore(sg_host_t ind_vm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_get_state(ind_vm);
+    if (0) simcall_HANDLER_vm_restore(&self->simcall, ind_vm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_GET_STATE;
+    self->simcall.call = SIMCALL_VM_RESTORE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) ind_vm;
@@ -771,21 +739,22 @@ inline static int simcall_BODY_vm_get_state(smx_host_t ind_vm) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.i;
+    
   }
   
-inline static void simcall_BODY_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm) {
+inline static void simcall_BODY_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_migrate(ind_vm, ind_dst_pm);
+    if (0) SIMIX_vm_migratefrom_resumeto(vm, src_pm, dst_pm);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_MIGRATE;
+    self->simcall.call = SIMCALL_VM_MIGRATEFROM_RESUMETO;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
-    self->simcall.args[1].dp = (void*) ind_dst_pm;
+    self->simcall.args[0].dp = (void*) vm;
+    self->simcall.args[1].dp = (void*) src_pm;
+    self->simcall.args[2].dp = (void*) dst_pm;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -796,17 +765,25 @@ inline static void simcall_BODY_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst
     
   }
   
-inline static void* simcall_BODY_vm_get_pm(smx_host_t ind_vm) {
+inline static void* simcall_BODY_process_create(const char* name, xbt_main_func_t code, void* data, const char* hostname, double kill_time, int argc, char** argv, xbt_dict_t properties, int auto_restart) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_get_pm(ind_vm);
+    if (0) simcall_HANDLER_process_create(&self->simcall, name, code, data, hostname, kill_time, argc, argv, properties, auto_restart);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_GET_PM;
+    self->simcall.call = SIMCALL_PROCESS_CREATE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[0].cc = (const char*) name;
+    self->simcall.args[1].fp = (FPtr) code;
+    self->simcall.args[2].dp = (void*) data;
+    self->simcall.args[3].cc = (const char*) hostname;
+    self->simcall.args[4].d = (double) kill_time;
+    self->simcall.args[5].i = (int) argc;
+    self->simcall.args[6].dp = (void*) argv;
+    self->simcall.args[7].dp = (void*) properties;
+    self->simcall.args[8].i = (int) auto_restart;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -817,18 +794,17 @@ inline static void* simcall_BODY_vm_get_pm(smx_host_t ind_vm) {
     return self->simcall.result.dp;
   }
   
-inline static void simcall_BODY_vm_set_bound(smx_host_t ind_vm, double bound) {
+inline static void simcall_BODY_process_kill(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_set_bound(ind_vm, bound);
+    if (0) simcall_HANDLER_process_kill(&self->simcall, process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_SET_BOUND;
+    self->simcall.call = SIMCALL_PROCESS_KILL;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
-    self->simcall.args[1].d = (double) bound;
+    self->simcall.args[0].dp = (void*) process;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -839,19 +815,17 @@ inline static void simcall_BODY_vm_set_bound(smx_host_t ind_vm, double bound) {
     
   }
   
-inline static void simcall_BODY_vm_set_affinity(smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask) {
+inline static void simcall_BODY_process_killall(int reset_pid) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_set_affinity(ind_vm, ind_pm, mask);
+    if (0) simcall_HANDLER_process_killall(&self->simcall, reset_pid);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_SET_AFFINITY;
+    self->simcall.call = SIMCALL_PROCESS_KILLALL;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
-    self->simcall.args[1].dp = (void*) ind_pm;
-    self->simcall.args[2].ul = (unsigned long) mask;
+    self->simcall.args[0].i = (int) reset_pid;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -862,17 +836,17 @@ inline static void simcall_BODY_vm_set_affinity(smx_host_t ind_vm, smx_host_t in
     
   }
   
-inline static void simcall_BODY_vm_destroy(smx_host_t ind_vm) {
+inline static void simcall_BODY_process_cleanup(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_destroy(ind_vm);
+    if (0) SIMIX_process_cleanup(process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_DESTROY;
+    self->simcall.call = SIMCALL_PROCESS_CLEANUP;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[0].dp = (void*) process;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -883,17 +857,18 @@ inline static void simcall_BODY_vm_destroy(smx_host_t ind_vm) {
     
   }
   
-inline static void simcall_BODY_vm_suspend(smx_host_t ind_vm) {
+inline static void simcall_BODY_process_change_host(smx_process_t process, sg_host_t dest) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_suspend(&self->simcall, ind_vm);
+    if (0) simcall_HANDLER_process_change_host(&self->simcall, process, dest);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_SUSPEND;
+    self->simcall.call = SIMCALL_PROCESS_CHANGE_HOST;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[1].dp = (void*) dest;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -904,17 +879,17 @@ inline static void simcall_BODY_vm_suspend(smx_host_t ind_vm) {
     
   }
   
-inline static void simcall_BODY_vm_resume(smx_host_t ind_vm) {
+inline static void simcall_BODY_process_suspend(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_resume(&self->simcall, ind_vm);
+    if (0) simcall_HANDLER_process_suspend(&self->simcall, process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_RESUME;
+    self->simcall.call = SIMCALL_PROCESS_SUSPEND;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[0].dp = (void*) process;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -925,17 +900,17 @@ inline static void simcall_BODY_vm_resume(smx_host_t ind_vm) {
     
   }
   
-inline static void simcall_BODY_vm_shutdown(smx_host_t ind_vm) {
+inline static void simcall_BODY_process_resume(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_shutdown(&self->simcall, ind_vm);
+    if (0) simcall_HANDLER_process_resume(&self->simcall, process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_SHUTDOWN;
+    self->simcall.call = SIMCALL_PROCESS_RESUME;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[0].dp = (void*) process;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -946,17 +921,17 @@ inline static void simcall_BODY_vm_shutdown(smx_host_t ind_vm) {
     
   }
   
-inline static void simcall_BODY_vm_save(smx_host_t ind_vm) {
+inline static int simcall_BODY_process_count() {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_save(&self->simcall, ind_vm);
+    if (0) SIMIX_process_count();
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_SAVE;
+    self->simcall.call = SIMCALL_PROCESS_COUNT;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
+
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -964,20 +939,20 @@ inline static void simcall_BODY_vm_save(smx_host_t ind_vm) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.i;
   }
   
-inline static void simcall_BODY_vm_restore(smx_host_t ind_vm) {
+inline static int simcall_BODY_process_get_PID(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_restore(&self->simcall, ind_vm);
+    if (0) SIMIX_process_get_PID(process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_RESTORE;
+    self->simcall.call = SIMCALL_PROCESS_GET_PID;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
+    self->simcall.args[0].dp = (void*) process;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -985,22 +960,20 @@ inline static void simcall_BODY_vm_restore(smx_host_t ind_vm) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.i;
   }
   
-inline static void simcall_BODY_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm) {
+inline static int simcall_BODY_process_get_PPID(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_vm_migratefrom_resumeto(vm, src_pm, dst_pm);
+    if (0) SIMIX_process_get_PPID(process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_VM_MIGRATEFROM_RESUMETO;
+    self->simcall.call = SIMCALL_PROCESS_GET_PPID;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) vm;
-    self->simcall.args[1].dp = (void*) src_pm;
-    self->simcall.args[2].dp = (void*) dst_pm;
+    self->simcall.args[0].dp = (void*) process;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1008,29 +981,20 @@ inline static void simcall_BODY_vm_migratefrom_resumeto(smx_host_t vm, smx_host_
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.i;
   }
   
-inline static void simcall_BODY_process_create(smx_process_t* process, const char* name, xbt_main_func_t code, void* data, const char* hostname, double kill_time, int argc, char** argv, xbt_dict_t properties, int auto_restart) {
+inline static void* simcall_BODY_process_get_data(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_create(&self->simcall, process, name, code, data, hostname, kill_time, argc, argv, properties, auto_restart);
+    if (0) SIMIX_process_get_data(process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_CREATE;
+    self->simcall.call = SIMCALL_PROCESS_GET_DATA;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) process;
-    self->simcall.args[1].cc = (const char*) name;
-    self->simcall.args[2].fp = (FPtr) code;
-    self->simcall.args[3].dp = (void*) data;
-    self->simcall.args[4].cc = (const char*) hostname;
-    self->simcall.args[5].d = (double) kill_time;
-    self->simcall.args[6].i = (int) argc;
-    self->simcall.args[7].dp = (void*) argv;
-    self->simcall.args[8].dp = (void*) properties;
-    self->simcall.args[9].i = (int) auto_restart;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1038,20 +1002,21 @@ inline static void simcall_BODY_process_create(smx_process_t* process, const cha
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.dp;
   }
   
-inline static void simcall_BODY_process_kill(smx_process_t process) {
+inline static void simcall_BODY_process_set_data(smx_process_t process, void* data) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_kill(&self->simcall, process);
+    if (0) SIMIX_process_set_data(process, data);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_KILL;
+    self->simcall.call = SIMCALL_PROCESS_SET_DATA;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[1].dp = (void*) data;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1062,17 +1027,17 @@ inline static void simcall_BODY_process_kill(smx_process_t process) {
     
   }
   
-inline static void simcall_BODY_process_killall(int reset_pid) {
+inline static sg_host_t simcall_BODY_process_get_host(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_killall(&self->simcall, reset_pid);
+    if (0) SIMIX_process_get_host(process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_KILLALL;
+    self->simcall.call = SIMCALL_PROCESS_GET_HOST;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].i = (int) reset_pid;
+    self->simcall.args[0].dp = (void*) process;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1080,17 +1045,17 @@ inline static void simcall_BODY_process_killall(int reset_pid) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.dp;
   }
   
-inline static void simcall_BODY_process_cleanup(smx_process_t process) {
+inline static const char* simcall_BODY_process_get_name(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_cleanup(process);
+    if (0) SIMIX_process_get_name(process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_CLEANUP;
+    self->simcall.call = SIMCALL_PROCESS_GET_NAME;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) process;
@@ -1101,21 +1066,20 @@ inline static void simcall_BODY_process_cleanup(smx_process_t process) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.cc;
   }
   
-inline static void simcall_BODY_process_change_host(smx_process_t process, smx_host_t dest) {
+inline static int simcall_BODY_process_is_suspended(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_change_host(&self->simcall, process, dest);
+    if (0) SIMIX_process_is_suspended(process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_CHANGE_HOST;
+    self->simcall.call = SIMCALL_PROCESS_IS_SUSPENDED;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) process;
-    self->simcall.args[1].dp = (void*) dest;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1123,17 +1087,17 @@ inline static void simcall_BODY_process_change_host(smx_process_t process, smx_h
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.i;
   }
   
-inline static void simcall_BODY_process_suspend(smx_process_t process) {
+inline static xbt_dict_t simcall_BODY_process_get_properties(smx_process_t process) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_suspend(&self->simcall, process);
+    if (0) SIMIX_process_get_properties(process);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_SUSPEND;
+    self->simcall.call = SIMCALL_PROCESS_GET_PROPERTIES;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) process;
@@ -1144,20 +1108,21 @@ inline static void simcall_BODY_process_suspend(smx_process_t process) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.dp;
   }
   
-inline static void simcall_BODY_process_resume(smx_process_t process) {
+inline static int simcall_BODY_process_join(smx_process_t process, double timeout) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_resume(&self->simcall, process);
+    if (0) simcall_HANDLER_process_join(&self->simcall, process, timeout);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_RESUME;
+    self->simcall.call = SIMCALL_PROCESS_JOIN;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[1].d = (double) timeout;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1165,20 +1130,20 @@ inline static void simcall_BODY_process_resume(smx_process_t process) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    
+    return self->simcall.result.i;
   }
   
-inline static int simcall_BODY_process_count() {
+inline static int simcall_BODY_process_sleep(double duration) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_count();
+    if (0) simcall_HANDLER_process_sleep(&self->simcall, duration);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_COUNT;
+    self->simcall.call = SIMCALL_PROCESS_SLEEP;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-
+    self->simcall.args[0].d = (double) duration;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1189,17 +1154,21 @@ inline static int simcall_BODY_process_count() {
     return self->simcall.result.i;
   }
   
-inline static int simcall_BODY_process_get_PID(smx_process_t process) {
+inline static smx_synchro_t simcall_BODY_process_execute(const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_get_PID(process);
+    if (0) simcall_HANDLER_process_execute(&self->simcall, name, flops_amount, priority, bound, affinity_mask);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_GET_PID;
+    self->simcall.call = SIMCALL_PROCESS_EXECUTE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[0].cc = (const char*) name;
+    self->simcall.args[1].d = (double) flops_amount;
+    self->simcall.args[2].d = (double) priority;
+    self->simcall.args[3].d = (double) bound;
+    self->simcall.args[4].ul = (unsigned long) affinity_mask;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1207,20 +1176,26 @@ inline static int simcall_BODY_process_get_PID(smx_process_t process) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.i;
+    return self->simcall.result.dp;
   }
   
-inline static int simcall_BODY_process_get_PPID(smx_process_t process) {
+inline static smx_synchro_t simcall_BODY_process_parallel_execute(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_get_PPID(process);
+    if (0) SIMIX_process_parallel_execute(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_GET_PPID;
+    self->simcall.call = SIMCALL_PROCESS_PARALLEL_EXECUTE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[0].cc = (const char*) name;
+    self->simcall.args[1].i = (int) host_nb;
+    self->simcall.args[2].dp = (void*) host_list;
+    self->simcall.args[3].dp = (void*) flops_amount;
+    self->simcall.args[4].dp = (void*) bytes_amount;
+    self->simcall.args[5].d = (double) amount;
+    self->simcall.args[6].d = (double) rate;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1228,20 +1203,20 @@ inline static int simcall_BODY_process_get_PPID(smx_process_t process) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.i;
+    return self->simcall.result.dp;
   }
   
-inline static void* simcall_BODY_process_get_data(smx_process_t process) {
+inline static void simcall_BODY_process_execution_destroy(smx_synchro_t execution) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_get_data(process);
+    if (0) SIMIX_process_execution_destroy(execution);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_GET_DATA;
+    self->simcall.call = SIMCALL_PROCESS_EXECUTION_DESTROY;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[0].dp = (void*) execution;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1249,21 +1224,20 @@ inline static void* simcall_BODY_process_get_data(smx_process_t process) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.dp;
+    
   }
   
-inline static void simcall_BODY_process_set_data(smx_process_t process, void* data) {
+inline static void simcall_BODY_process_execution_cancel(smx_synchro_t execution) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_set_data(process, data);
+    if (0) SIMIX_process_execution_cancel(execution);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_SET_DATA;
+    self->simcall.call = SIMCALL_PROCESS_EXECUTION_CANCEL;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    self->simcall.args[1].dp = (void*) data;
+    self->simcall.args[0].dp = (void*) execution;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1274,17 +1248,17 @@ inline static void simcall_BODY_process_set_data(smx_process_t process, void* da
     
   }
   
-inline static smx_host_t simcall_BODY_process_get_host(smx_process_t process) {
+inline static double simcall_BODY_process_execution_get_remains(smx_synchro_t execution) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_get_host(process);
+    if (0) SIMIX_process_execution_get_remains(execution);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_GET_HOST;
+    self->simcall.call = SIMCALL_PROCESS_EXECUTION_GET_REMAINS;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[0].dp = (void*) execution;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1292,20 +1266,20 @@ inline static smx_host_t simcall_BODY_process_get_host(smx_process_t process) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.dp;
+    return self->simcall.result.d;
   }
   
-inline static const char* simcall_BODY_process_get_name(smx_process_t process) {
+inline static e_smx_state_t simcall_BODY_process_execution_get_state(smx_synchro_t execution) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_get_name(process);
+    if (0) SIMIX_process_execution_get_state(execution);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_GET_NAME;
+    self->simcall.call = SIMCALL_PROCESS_EXECUTION_GET_STATE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[0].dp = (void*) execution;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1313,20 +1287,21 @@ inline static const char* simcall_BODY_process_get_name(smx_process_t process) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.cc;
+    return self->simcall.result.i;
   }
   
-inline static int simcall_BODY_process_is_suspended(smx_process_t process) {
+inline static void simcall_BODY_process_execution_set_priority(smx_synchro_t execution, double priority) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_is_suspended(process);
+    if (0) SIMIX_process_execution_set_priority(execution, priority);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_IS_SUSPENDED;
+    self->simcall.call = SIMCALL_PROCESS_EXECUTION_SET_PRIORITY;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[0].dp = (void*) execution;
+    self->simcall.args[1].d = (double) priority;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1334,20 +1309,21 @@ inline static int simcall_BODY_process_is_suspended(smx_process_t process) {
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.i;
+    
   }
   
-inline static xbt_dict_t simcall_BODY_process_get_properties(smx_process_t process) {
+inline static void simcall_BODY_process_execution_set_bound(smx_synchro_t execution, double bound) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_process_get_properties(process);
+    if (0) SIMIX_process_execution_set_bound(execution, bound);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_GET_PROPERTIES;
+    self->simcall.call = SIMCALL_PROCESS_EXECUTION_SET_BOUND;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
+    self->simcall.args[0].dp = (void*) execution;
+    self->simcall.args[1].d = (double) bound;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1355,21 +1331,22 @@ inline static xbt_dict_t simcall_BODY_process_get_properties(smx_process_t proce
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.dp;
+    
   }
   
-inline static int simcall_BODY_process_join(smx_process_t process, double timeout) {
+inline static void simcall_BODY_process_execution_set_affinity(smx_synchro_t execution, sg_host_t ws, unsigned long mask) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_join(&self->simcall, process, timeout);
+    if (0) SIMIX_process_execution_set_affinity(execution, ws, mask);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_JOIN;
+    self->simcall.call = SIMCALL_PROCESS_EXECUTION_SET_AFFINITY;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    self->simcall.args[1].d = (double) timeout;
+    self->simcall.args[0].dp = (void*) execution;
+    self->simcall.args[1].dp = (void*) ws;
+    self->simcall.args[2].ul = (unsigned long) mask;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1377,20 +1354,20 @@ inline static int simcall_BODY_process_join(smx_process_t process, double timeou
     } else {
       SIMIX_simcall_handle(&self->simcall, 0);
     }    
-    return self->simcall.result.i;
+    
   }
   
-inline static int simcall_BODY_process_sleep(double duration) {
+inline static int simcall_BODY_process_execution_wait(smx_synchro_t execution) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_sleep(&self->simcall, duration);
+    if (0) simcall_HANDLER_process_execution_wait(&self->simcall, execution);
     /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
 
-    self->simcall.call = SIMCALL_PROCESS_SLEEP;
+    self->simcall.call = SIMCALL_PROCESS_EXECUTION_WAIT;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].d = (double) duration;
+    self->simcall.args[0].dp = (void*) execution;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
@@ -1509,7 +1486,7 @@ inline static void simcall_BODY_rdv_destroy(smx_rdv_t rdv) {
     
   }
   
-inline static unsigned int simcall_BODY_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host) {
+inline static unsigned int simcall_BODY_rdv_comm_count_by_host(smx_rdv_t rdv, sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -2351,7 +2328,7 @@ inline static int simcall_BODY_sem_get_capacity(smx_sem_t sem) {
     return self->simcall.result.i;
   }
   
-inline static sg_size_t simcall_BODY_file_read(smx_file_t fd, sg_size_t size, smx_host_t host) {
+inline static sg_size_t simcall_BODY_file_read(smx_file_t fd, sg_size_t size, sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -2374,7 +2351,7 @@ inline static sg_size_t simcall_BODY_file_read(smx_file_t fd, sg_size_t size, sm
     return self->simcall.result.sgsz;
   }
   
-inline static sg_size_t simcall_BODY_file_write(smx_file_t fd, sg_size_t size, smx_host_t host) {
+inline static sg_size_t simcall_BODY_file_write(smx_file_t fd, sg_size_t size, sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -2397,7 +2374,7 @@ inline static sg_size_t simcall_BODY_file_write(smx_file_t fd, sg_size_t size, s
     return self->simcall.result.sgsz;
   }
   
-inline static smx_file_t simcall_BODY_file_open(const char* fullpath, smx_host_t host) {
+inline static smx_file_t simcall_BODY_file_open(const char* fullpath, sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -2419,7 +2396,7 @@ inline static smx_file_t simcall_BODY_file_open(const char* fullpath, smx_host_t
     return self->simcall.result.dp;
   }
   
-inline static int simcall_BODY_file_close(smx_file_t fd, smx_host_t host) {
+inline static int simcall_BODY_file_close(smx_file_t fd, sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
@@ -2441,7 +2418,7 @@ inline static int simcall_BODY_file_close(smx_file_t fd, smx_host_t host) {
     return self->simcall.result.i;
   }
   
-inline static int simcall_BODY_file_unlink(smx_file_t fd, smx_host_t host) {
+inline static int simcall_BODY_file_unlink(smx_file_t fd, sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
     /* Go to that function to follow the code flow through the simcall barrier */
index a025c25..7396184 100644 (file)
@@ -18,7 +18,6 @@
  */
 typedef enum {
   SIMCALL_NONE,
-  SIMCALL_HOST_GET_BY_NAME,
   SIMCALL_HOST_GET_NAME,
   SIMCALL_HOST_ON,
   SIMCALL_HOST_OFF,
@@ -36,16 +35,6 @@ typedef enum {
   SIMCALL_HOST_SET_PSTATE,
   SIMCALL_HOST_GET_PSTATE,
   SIMCALL_HOST_GET_CONSUMED_ENERGY,
-  SIMCALL_HOST_EXECUTE,
-  SIMCALL_HOST_PARALLEL_EXECUTE,
-  SIMCALL_HOST_EXECUTION_DESTROY,
-  SIMCALL_HOST_EXECUTION_CANCEL,
-  SIMCALL_HOST_EXECUTION_GET_REMAINS,
-  SIMCALL_HOST_EXECUTION_GET_STATE,
-  SIMCALL_HOST_EXECUTION_SET_PRIORITY,
-  SIMCALL_HOST_EXECUTION_SET_BOUND,
-  SIMCALL_HOST_EXECUTION_SET_AFFINITY,
-  SIMCALL_HOST_EXECUTION_WAIT,
   SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST,
   SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST,
   SIMCALL_HOST_GET_PARAMS,
@@ -82,6 +71,16 @@ typedef enum {
   SIMCALL_PROCESS_GET_PROPERTIES,
   SIMCALL_PROCESS_JOIN,
   SIMCALL_PROCESS_SLEEP,
+  SIMCALL_PROCESS_EXECUTE,
+  SIMCALL_PROCESS_PARALLEL_EXECUTE,
+  SIMCALL_PROCESS_EXECUTION_DESTROY,
+  SIMCALL_PROCESS_EXECUTION_CANCEL,
+  SIMCALL_PROCESS_EXECUTION_GET_REMAINS,
+  SIMCALL_PROCESS_EXECUTION_GET_STATE,
+  SIMCALL_PROCESS_EXECUTION_SET_PRIORITY,
+  SIMCALL_PROCESS_EXECUTION_SET_BOUND,
+  SIMCALL_PROCESS_EXECUTION_SET_AFFINITY,
+  SIMCALL_PROCESS_EXECUTION_WAIT,
   SIMCALL_PROCESS_ON_EXIT,
   SIMCALL_PROCESS_AUTO_RESTART_SET,
   SIMCALL_PROCESS_RESTART,
index d7eb366..a2d70ab 100644 (file)
@@ -22,7 +22,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
 
 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
 const char* simcall_names[] = {
-  [SIMCALL_HOST_GET_BY_NAME] = "SIMCALL_HOST_GET_BY_NAME",
   [SIMCALL_HOST_GET_NAME] = "SIMCALL_HOST_GET_NAME",
   [SIMCALL_HOST_ON] = "SIMCALL_HOST_ON",
   [SIMCALL_HOST_OFF] = "SIMCALL_HOST_OFF",
@@ -40,16 +39,6 @@ const char* simcall_names[] = {
   [SIMCALL_HOST_SET_PSTATE] = "SIMCALL_HOST_SET_PSTATE",
   [SIMCALL_HOST_GET_PSTATE] = "SIMCALL_HOST_GET_PSTATE",
   [SIMCALL_HOST_GET_CONSUMED_ENERGY] = "SIMCALL_HOST_GET_CONSUMED_ENERGY",
-  [SIMCALL_HOST_EXECUTE] = "SIMCALL_HOST_EXECUTE",
-  [SIMCALL_HOST_PARALLEL_EXECUTE] = "SIMCALL_HOST_PARALLEL_EXECUTE",
-  [SIMCALL_HOST_EXECUTION_DESTROY] = "SIMCALL_HOST_EXECUTION_DESTROY",
-  [SIMCALL_HOST_EXECUTION_CANCEL] = "SIMCALL_HOST_EXECUTION_CANCEL",
-  [SIMCALL_HOST_EXECUTION_GET_REMAINS] = "SIMCALL_HOST_EXECUTION_GET_REMAINS",
-  [SIMCALL_HOST_EXECUTION_GET_STATE] = "SIMCALL_HOST_EXECUTION_GET_STATE",
-  [SIMCALL_HOST_EXECUTION_SET_PRIORITY] = "SIMCALL_HOST_EXECUTION_SET_PRIORITY",
-  [SIMCALL_HOST_EXECUTION_SET_BOUND] = "SIMCALL_HOST_EXECUTION_SET_BOUND",
-  [SIMCALL_HOST_EXECUTION_SET_AFFINITY] = "SIMCALL_HOST_EXECUTION_SET_AFFINITY",
-  [SIMCALL_HOST_EXECUTION_WAIT] = "SIMCALL_HOST_EXECUTION_WAIT",
   [SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST] = "SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST",
   [SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST] = "SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST",
   [SIMCALL_HOST_GET_PARAMS] = "SIMCALL_HOST_GET_PARAMS",
@@ -86,6 +75,16 @@ const char* simcall_names[] = {
   [SIMCALL_PROCESS_GET_PROPERTIES] = "SIMCALL_PROCESS_GET_PROPERTIES",
   [SIMCALL_PROCESS_JOIN] = "SIMCALL_PROCESS_JOIN",
   [SIMCALL_PROCESS_SLEEP] = "SIMCALL_PROCESS_SLEEP",
+  [SIMCALL_PROCESS_EXECUTE] = "SIMCALL_PROCESS_EXECUTE",
+  [SIMCALL_PROCESS_PARALLEL_EXECUTE] = "SIMCALL_PROCESS_PARALLEL_EXECUTE",
+  [SIMCALL_PROCESS_EXECUTION_DESTROY] = "SIMCALL_PROCESS_EXECUTION_DESTROY",
+  [SIMCALL_PROCESS_EXECUTION_CANCEL] = "SIMCALL_PROCESS_EXECUTION_CANCEL",
+  [SIMCALL_PROCESS_EXECUTION_GET_REMAINS] = "SIMCALL_PROCESS_EXECUTION_GET_REMAINS",
+  [SIMCALL_PROCESS_EXECUTION_GET_STATE] = "SIMCALL_PROCESS_EXECUTION_GET_STATE",
+  [SIMCALL_PROCESS_EXECUTION_SET_PRIORITY] = "SIMCALL_PROCESS_EXECUTION_SET_PRIORITY",
+  [SIMCALL_PROCESS_EXECUTION_SET_BOUND] = "SIMCALL_PROCESS_EXECUTION_SET_BOUND",
+  [SIMCALL_PROCESS_EXECUTION_SET_AFFINITY] = "SIMCALL_PROCESS_EXECUTION_SET_AFFINITY",
+  [SIMCALL_PROCESS_EXECUTION_WAIT] = "SIMCALL_PROCESS_EXECUTION_WAIT",
   [SIMCALL_PROCESS_ON_EXIT] = "SIMCALL_PROCESS_ON_EXIT",
   [SIMCALL_PROCESS_AUTO_RESTART_SET] = "SIMCALL_PROCESS_AUTO_RESTART_SET",
   [SIMCALL_PROCESS_RESTART] = "SIMCALL_PROCESS_RESTART",
@@ -168,237 +167,183 @@ void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {
   if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)
     return;
   switch (simcall->call) {
-case SIMCALL_HOST_GET_BY_NAME:
-      simcall->result.dp = SIMIX_host_get_by_name( simcall->args[0].cc);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
 case SIMCALL_HOST_GET_NAME:
-      simcall->result.cc = SIMIX_host_get_name((smx_host_t) simcall->args[0].dp);
+      simcall->result.cc = SIMIX_host_get_name((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_ON:
-       SIMIX_host_on((smx_host_t) simcall->args[0].dp);
+       SIMIX_host_on((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_OFF:
-       simcall_HANDLER_host_off(simcall , (smx_host_t) simcall->args[0].dp);
+       simcall_HANDLER_host_off(simcall , (sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_PROPERTIES:
-      simcall->result.dp = SIMIX_host_get_properties((smx_host_t) simcall->args[0].dp);
+      simcall->result.dp = SIMIX_host_get_properties((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_CORE:
-      simcall->result.i = SIMIX_host_get_core((smx_host_t) simcall->args[0].dp);
+      simcall->result.i = SIMIX_host_get_core((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_PROCESS_LIST:
-      simcall->result.dp = SIMIX_host_get_process_list((smx_host_t) simcall->args[0].dp);
+      simcall->result.dp = SIMIX_host_get_process_list((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_SPEED:
-      simcall->result.d = SIMIX_host_get_speed((smx_host_t) simcall->args[0].dp);
+      simcall->result.d = SIMIX_host_get_speed((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_AVAILABLE_SPEED:
-      simcall->result.d = SIMIX_host_get_available_speed((smx_host_t) simcall->args[0].dp);
+      simcall->result.d = SIMIX_host_get_available_speed((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_STATE:
-      simcall->result.i = SIMIX_host_get_state((smx_host_t) simcall->args[0].dp);
+      simcall->result.i = SIMIX_host_get_state((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_CURRENT_POWER_PEAK:
-      simcall->result.d = SIMIX_host_get_current_power_peak((smx_host_t) simcall->args[0].dp);
+      simcall->result.d = SIMIX_host_get_current_power_peak((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_POWER_PEAK_AT:
-      simcall->result.d = SIMIX_host_get_power_peak_at((smx_host_t) simcall->args[0].dp, simcall->args[1].i);
+      simcall->result.d = SIMIX_host_get_power_peak_at((sg_host_t) simcall->args[0].dp, simcall->args[1].i);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_NB_PSTATES:
-      simcall->result.i = SIMIX_host_get_nb_pstates((smx_host_t) simcall->args[0].dp);
+      simcall->result.i = SIMIX_host_get_nb_pstates((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_WATTMIN_AT:
-      simcall->result.d = SIMIX_host_get_wattmin_at((smx_host_t) simcall->args[0].dp, simcall->args[1].i);
+      simcall->result.d = SIMIX_host_get_wattmin_at((sg_host_t) simcall->args[0].dp, simcall->args[1].i);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_WATTMAX_AT:
-      simcall->result.d = SIMIX_host_get_wattmax_at((smx_host_t) simcall->args[0].dp, simcall->args[1].i);
+      simcall->result.d = SIMIX_host_get_wattmax_at((sg_host_t) simcall->args[0].dp, simcall->args[1].i);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_SET_PSTATE:
-       SIMIX_host_set_pstate((smx_host_t) simcall->args[0].dp, simcall->args[1].i);
+       SIMIX_host_set_pstate((sg_host_t) simcall->args[0].dp, simcall->args[1].i);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_PSTATE:
-      simcall->result.i = SIMIX_host_get_pstate((smx_host_t) simcall->args[0].dp);
+      simcall->result.i = SIMIX_host_get_pstate((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_CONSUMED_ENERGY:
-      simcall->result.d = SIMIX_host_get_consumed_energy((smx_host_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_EXECUTE:
-      simcall->result.dp = SIMIX_host_execute( simcall->args[0].cc,(smx_host_t) simcall->args[1].dp, simcall->args[2].d, simcall->args[3].d, simcall->args[4].d, simcall->args[5].ul);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_PARALLEL_EXECUTE:
-      simcall->result.dp = SIMIX_host_parallel_execute( simcall->args[0].cc, simcall->args[1].i,(smx_host_t*) simcall->args[2].dp,(double*) simcall->args[3].dp,(double*) simcall->args[4].dp, simcall->args[5].d, simcall->args[6].d);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_EXECUTION_DESTROY:
-       SIMIX_host_execution_destroy((smx_synchro_t) simcall->args[0].dp);
+      simcall->result.d = SIMIX_host_get_consumed_energy((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
-case SIMCALL_HOST_EXECUTION_CANCEL:
-       SIMIX_host_execution_cancel((smx_synchro_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_EXECUTION_GET_REMAINS:
-      simcall->result.d = SIMIX_host_execution_get_remains((smx_synchro_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_EXECUTION_GET_STATE:
-      simcall->result.i = SIMIX_host_execution_get_state((smx_synchro_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_EXECUTION_SET_PRIORITY:
-       SIMIX_host_execution_set_priority((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_EXECUTION_SET_BOUND:
-       SIMIX_host_execution_set_bound((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_EXECUTION_SET_AFFINITY:
-       SIMIX_host_execution_set_affinity((smx_synchro_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp, simcall->args[2].ul);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
-case SIMCALL_HOST_EXECUTION_WAIT:
-       simcall_HANDLER_host_execution_wait(simcall , (smx_synchro_t) simcall->args[0].dp);
-       break;  
-
 case SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST:
-      simcall->result.dp = SIMIX_host_get_mounted_storage_list((smx_host_t) simcall->args[0].dp);
+      simcall->result.dp = SIMIX_host_get_mounted_storage_list((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST:
-      simcall->result.dp = SIMIX_host_get_attached_storage_list((smx_host_t) simcall->args[0].dp);
+      simcall->result.dp = SIMIX_host_get_attached_storage_list((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_GET_PARAMS:
-       SIMIX_host_get_params((smx_host_t) simcall->args[0].dp,(ws_params_t) simcall->args[1].dp);
+       SIMIX_host_get_params((sg_host_t) simcall->args[0].dp,(vm_params_t) simcall->args[1].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_HOST_SET_PARAMS:
-       SIMIX_host_set_params((smx_host_t) simcall->args[0].dp,(ws_params_t) simcall->args[1].dp);
+       SIMIX_host_set_params((sg_host_t) simcall->args[0].dp,(vm_params_t) simcall->args[1].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_CREATE:
-      simcall->result.dp = SIMIX_vm_create( simcall->args[0].cc,(smx_host_t) simcall->args[1].dp);
+      simcall->result.dp = SIMIX_vm_create( simcall->args[0].cc,(sg_host_t) simcall->args[1].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_START:
-       SIMIX_vm_start((smx_host_t) simcall->args[0].dp);
+       SIMIX_vm_start((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_GET_STATE:
-      simcall->result.i = SIMIX_vm_get_state((smx_host_t) simcall->args[0].dp);
+      simcall->result.i = SIMIX_vm_get_state((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_MIGRATE:
-       SIMIX_vm_migrate((smx_host_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp);
+       SIMIX_vm_migrate((sg_host_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_GET_PM:
-      simcall->result.dp = SIMIX_vm_get_pm((smx_host_t) simcall->args[0].dp);
+      simcall->result.dp = SIMIX_vm_get_pm((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_SET_BOUND:
-       SIMIX_vm_set_bound((smx_host_t) simcall->args[0].dp, simcall->args[1].d);
+       SIMIX_vm_set_bound((sg_host_t) simcall->args[0].dp, simcall->args[1].d);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_SET_AFFINITY:
-       SIMIX_vm_set_affinity((smx_host_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp, simcall->args[2].ul);
+       SIMIX_vm_set_affinity((sg_host_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp, simcall->args[2].ul);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_DESTROY:
-       SIMIX_vm_destroy((smx_host_t) simcall->args[0].dp);
+       SIMIX_vm_destroy((sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_SUSPEND:
-       simcall_HANDLER_vm_suspend(simcall , (smx_host_t) simcall->args[0].dp);
+       simcall_HANDLER_vm_suspend(simcall , (sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_RESUME:
-       simcall_HANDLER_vm_resume(simcall , (smx_host_t) simcall->args[0].dp);
+       simcall_HANDLER_vm_resume(simcall , (sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_SHUTDOWN:
-       simcall_HANDLER_vm_shutdown(simcall , (smx_host_t) simcall->args[0].dp);
+       simcall_HANDLER_vm_shutdown(simcall , (sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_SAVE:
-       simcall_HANDLER_vm_save(simcall , (smx_host_t) simcall->args[0].dp);
+       simcall_HANDLER_vm_save(simcall , (sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_RESTORE:
-       simcall_HANDLER_vm_restore(simcall , (smx_host_t) simcall->args[0].dp);
+       simcall_HANDLER_vm_restore(simcall , (sg_host_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_MIGRATEFROM_RESUMETO:
-       SIMIX_vm_migratefrom_resumeto((smx_host_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp,(smx_host_t) simcall->args[2].dp);
+       SIMIX_vm_migratefrom_resumeto((sg_host_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp,(sg_host_t) simcall->args[2].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_CREATE:
-       simcall_HANDLER_process_create(simcall , (smx_process_t*) simcall->args[0].dp,  simcall->args[1].cc, (xbt_main_func_t) simcall->args[2].fp,  simcall->args[3].dp,  simcall->args[4].cc,  simcall->args[5].d,  simcall->args[6].i, (char**) simcall->args[7].dp, (xbt_dict_t) simcall->args[8].dp,  simcall->args[9].i);
+      simcall->result.dp = simcall_HANDLER_process_create(simcall ,  simcall->args[0].cc, (xbt_main_func_t) simcall->args[1].fp,  simcall->args[2].dp,  simcall->args[3].cc,  simcall->args[4].d,  simcall->args[5].i, (char**) simcall->args[6].dp, (xbt_dict_t) simcall->args[7].dp,  simcall->args[8].i);
       SIMIX_simcall_answer(simcall);
       break;  
 
@@ -418,7 +363,7 @@ case SIMCALL_PROCESS_CLEANUP:
       break;  
 
 case SIMCALL_PROCESS_CHANGE_HOST:
-       simcall_HANDLER_process_change_host(simcall , (smx_process_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp);
+       simcall_HANDLER_process_change_host(simcall , (smx_process_t) simcall->args[0].dp, (sg_host_t) simcall->args[1].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
@@ -484,6 +429,55 @@ case SIMCALL_PROCESS_SLEEP:
        simcall_HANDLER_process_sleep(simcall ,  simcall->args[0].d);
        break;  
 
+case SIMCALL_PROCESS_EXECUTE:
+      simcall->result.dp = simcall_HANDLER_process_execute(simcall ,  simcall->args[0].cc,  simcall->args[1].d,  simcall->args[2].d,  simcall->args[3].d,  simcall->args[4].ul);
+      SIMIX_simcall_answer(simcall);
+      break;  
+
+case SIMCALL_PROCESS_PARALLEL_EXECUTE:
+      simcall->result.dp = SIMIX_process_parallel_execute( simcall->args[0].cc, simcall->args[1].i,(sg_host_t*) simcall->args[2].dp,(double*) simcall->args[3].dp,(double*) simcall->args[4].dp, simcall->args[5].d, simcall->args[6].d);
+      SIMIX_simcall_answer(simcall);
+      break;  
+
+case SIMCALL_PROCESS_EXECUTION_DESTROY:
+       SIMIX_process_execution_destroy((smx_synchro_t) simcall->args[0].dp);
+      SIMIX_simcall_answer(simcall);
+      break;  
+
+case SIMCALL_PROCESS_EXECUTION_CANCEL:
+       SIMIX_process_execution_cancel((smx_synchro_t) simcall->args[0].dp);
+      SIMIX_simcall_answer(simcall);
+      break;  
+
+case SIMCALL_PROCESS_EXECUTION_GET_REMAINS:
+      simcall->result.d = SIMIX_process_execution_get_remains((smx_synchro_t) simcall->args[0].dp);
+      SIMIX_simcall_answer(simcall);
+      break;  
+
+case SIMCALL_PROCESS_EXECUTION_GET_STATE:
+      simcall->result.i = SIMIX_process_execution_get_state((smx_synchro_t) simcall->args[0].dp);
+      SIMIX_simcall_answer(simcall);
+      break;  
+
+case SIMCALL_PROCESS_EXECUTION_SET_PRIORITY:
+       SIMIX_process_execution_set_priority((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d);
+      SIMIX_simcall_answer(simcall);
+      break;  
+
+case SIMCALL_PROCESS_EXECUTION_SET_BOUND:
+       SIMIX_process_execution_set_bound((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d);
+      SIMIX_simcall_answer(simcall);
+      break;  
+
+case SIMCALL_PROCESS_EXECUTION_SET_AFFINITY:
+       SIMIX_process_execution_set_affinity((smx_synchro_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp, simcall->args[2].ul);
+      SIMIX_simcall_answer(simcall);
+      break;  
+
+case SIMCALL_PROCESS_EXECUTION_WAIT:
+       simcall_HANDLER_process_execution_wait(simcall , (smx_synchro_t) simcall->args[0].dp);
+       break;  
+
 case SIMCALL_PROCESS_ON_EXIT:
        SIMIX_process_on_exit((smx_process_t) simcall->args[0].dp,(int_f_pvoid_pvoid_t) simcall->args[1].fp, simcall->args[2].dp);
       SIMIX_simcall_answer(simcall);
@@ -510,7 +504,7 @@ case SIMCALL_RDV_DESTROY:
       break;  
 
 case SIMCALL_RDV_COMM_COUNT_BY_HOST:
-      simcall->result.ui = SIMIX_rdv_comm_count_by_host((smx_rdv_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp);
+      simcall->result.ui = SIMIX_rdv_comm_count_by_host((smx_rdv_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
@@ -689,23 +683,23 @@ case SIMCALL_SEM_GET_CAPACITY:
       break;  
 
 case SIMCALL_FILE_READ:
-       simcall_HANDLER_file_read(simcall , (smx_file_t) simcall->args[0].dp,  simcall->args[1].sgsz, (smx_host_t) simcall->args[2].dp);
+       simcall_HANDLER_file_read(simcall , (smx_file_t) simcall->args[0].dp,  simcall->args[1].sgsz, (sg_host_t) simcall->args[2].dp);
        break;  
 
 case SIMCALL_FILE_WRITE:
-       simcall_HANDLER_file_write(simcall , (smx_file_t) simcall->args[0].dp,  simcall->args[1].sgsz, (smx_host_t) simcall->args[2].dp);
+       simcall_HANDLER_file_write(simcall , (smx_file_t) simcall->args[0].dp,  simcall->args[1].sgsz, (sg_host_t) simcall->args[2].dp);
        break;  
 
 case SIMCALL_FILE_OPEN:
-       simcall_HANDLER_file_open(simcall ,  simcall->args[0].cc, (smx_host_t) simcall->args[1].dp);
+       simcall_HANDLER_file_open(simcall ,  simcall->args[0].cc, (sg_host_t) simcall->args[1].dp);
        break;  
 
 case SIMCALL_FILE_CLOSE:
-       simcall_HANDLER_file_close(simcall , (smx_file_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp);
+       simcall_HANDLER_file_close(simcall , (smx_file_t) simcall->args[0].dp, (sg_host_t) simcall->args[1].dp);
        break;  
 
 case SIMCALL_FILE_UNLINK:
-      simcall->result.i = SIMIX_file_unlink((smx_file_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp);
+      simcall->result.i = SIMIX_file_unlink((smx_file_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
index 44465ba..6d44227 100644 (file)
 # ./include/simgrid/simix.h (otherwise you will get a warning at the
 # compilation time)
 
-Func - host_get_by_name (void*, smx_host_t) (name, const char*)
-Func - host_get_name (const char*) (host, void*, smx_host_t)
-Proc - host_on (void) (host, void*, smx_host_t)
-Proc H host_off (void) (host, void*, smx_host_t)
-Func - host_get_properties (void*, xbt_dict_t) (host, void*, smx_host_t)
-Func - host_get_core (int) (host, void*, smx_host_t)
-Func - host_get_process_list (void*, xbt_swag_t) (host, void*, smx_host_t)
-Func - host_get_speed (double) (host, void*, smx_host_t)
-Func - host_get_available_speed (double) (host, void*, smx_host_t)
-Func - host_get_state (int) (host, void*, smx_host_t)
-Func - host_get_current_power_peak (double) (host, void*, smx_host_t)
-Func - host_get_power_peak_at (double) (host, void*, smx_host_t) (pstate_index, int)
-Func - host_get_nb_pstates (int) (host, void*, smx_host_t)
-Func - host_get_wattmin_at (double) (host, void*, smx_host_t) (pstate_index, int)
-Func - host_get_wattmax_at (double) (host, void*, smx_host_t) (pstate_index, int)
-Proc - host_set_pstate (void) (host, void*, smx_host_t) (pstate_index, int)
-Func - host_get_pstate (int) (host, void*, smx_host_t)
-Func - host_get_consumed_energy (double) (host, void*, smx_host_t)
+Func - host_get_name (const char*) (host, void*, sg_host_t)
+Proc - host_on (void) (host, void*, sg_host_t)
+Proc H host_off (void) (host, void*, sg_host_t)
+Func - host_get_properties (void*, xbt_dict_t) (host, void*, sg_host_t)
+Func - host_get_core (int) (host, void*, sg_host_t)
+Func - host_get_process_list (void*, xbt_swag_t) (host, void*, sg_host_t)
+Func - host_get_speed (double) (host, void*, sg_host_t)
+Func - host_get_available_speed (double) (host, void*, sg_host_t)
+Func - host_get_state (int) (host, void*, sg_host_t)
+Func - host_get_current_power_peak (double) (host, void*, sg_host_t)
+Func - host_get_power_peak_at (double) (host, void*, sg_host_t) (pstate_index, int)
+Func - host_get_nb_pstates (int) (host, void*, sg_host_t)
+Func - host_get_wattmin_at (double) (host, void*, sg_host_t) (pstate_index, int)
+Func - host_get_wattmax_at (double) (host, void*, sg_host_t) (pstate_index, int)
+Proc - host_set_pstate (void) (host, void*, sg_host_t) (pstate_index, int)
+Func - host_get_pstate (int) (host, void*, sg_host_t)
+Func - host_get_consumed_energy (double) (host, void*, sg_host_t)
 
-Func - host_execute (void*, smx_synchro_t) (name, const char*) (host, void*, smx_host_t) (flops_amount, double) (priority, double) (bound, double) (affinity_mask, unsigned long)
-Func - host_parallel_execute (void*, smx_synchro_t) (name, const char*) (host_nb, int) (host_list, void*, smx_host_t*) (flops_amount, void*, double*) (bytes_amount, void*, double*) (amount, double) (rate, double)
-Proc - host_execution_destroy (void) (execution, void*, smx_synchro_t)
-Proc - host_execution_cancel (void) (execution, void*, smx_synchro_t)
-Func - host_execution_get_remains (double) (execution, void*, smx_synchro_t)
-Func - host_execution_get_state (int, e_smx_state_t) (execution, void*, smx_synchro_t)
-Proc - host_execution_set_priority (void) (execution, void*, smx_synchro_t) (priority, double)
-Proc - host_execution_set_bound (void) (execution, void*, smx_synchro_t) (bound, double)
-Proc - host_execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, void*, smx_host_t) (mask, unsigned long)
-Blck H host_execution_wait (int) (execution, void*, smx_synchro_t)
-Func - host_get_mounted_storage_list (void*, xbt_dict_t) (host, void*, smx_host_t)
-Func - host_get_attached_storage_list (void*, xbt_dynar_t) (host, void*, smx_host_t)
-Proc - host_get_params (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
-Proc - host_set_params (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
-Func - vm_create (void*, smx_host_t) (name, const char*) (ind_pm, void*, smx_host_t)
-Proc - vm_start (void) (ind_vm, void*, smx_host_t)
-Func - vm_get_state (int) (ind_vm, void*, smx_host_t)
-Proc - vm_migrate (void) (ind_vm, void*, smx_host_t) (ind_dst_pm, void*, smx_host_t)
-Func - vm_get_pm (void*) (ind_vm, void*, smx_host_t)
-Proc - vm_set_bound (void) (ind_vm, void*, smx_host_t) (bound, double)
-Proc - vm_set_affinity (void) (ind_vm, void*, smx_host_t) (ind_pm, void*, smx_host_t) (mask, unsigned long)
-Proc - vm_destroy (void) (ind_vm, void*, smx_host_t)
-Proc H vm_suspend (void) (ind_vm, void*, smx_host_t)
-Proc H vm_resume (void) (ind_vm, void*, smx_host_t)
-Proc H vm_shutdown (void) (ind_vm, void*, smx_host_t)
-Proc H vm_save (void) (ind_vm, void*, smx_host_t)
-Proc H vm_restore (void) (ind_vm, void*, smx_host_t)
-Proc - vm_migratefrom_resumeto (void) (vm, void*, smx_host_t)(src_pm, void*, smx_host_t) (dst_pm, void*, smx_host_t)
-Proc H process_create (void) (process, void*, smx_process_t*) (name, const char*) (code, FPtr, xbt_main_func_t) (data, void*) (hostname, const char*) (kill_time, double) (argc, int) (argv, void*, char**) (properties, void*, xbt_dict_t) (auto_restart, int)
+Func - host_get_mounted_storage_list (void*, xbt_dict_t) (host, void*, sg_host_t)
+Func - host_get_attached_storage_list (void*, xbt_dynar_t) (host, void*, sg_host_t)
+Proc - host_get_params (void) (ind_vm, void*, sg_host_t) (params, void*, vm_params_t)
+Proc - host_set_params (void) (ind_vm, void*, sg_host_t) (params, void*, vm_params_t)
+Func - vm_create (void*, sg_host_t) (name, const char*) (ind_pm, void*, sg_host_t)
+Proc - vm_start (void) (ind_vm, void*, sg_host_t)
+Func - vm_get_state (int) (ind_vm, void*, sg_host_t)
+Proc - vm_migrate (void) (ind_vm, void*, sg_host_t) (ind_dst_pm, void*, sg_host_t)
+Func - vm_get_pm (void*) (ind_vm, void*, sg_host_t)
+Proc - vm_set_bound (void) (ind_vm, void*, sg_host_t) (bound, double)
+Proc - vm_set_affinity (void) (ind_vm, void*, sg_host_t) (ind_pm, void*, sg_host_t) (mask, unsigned long)
+Proc - vm_destroy (void) (ind_vm, void*, sg_host_t)
+Proc H vm_suspend (void) (ind_vm, void*, sg_host_t)
+Proc H vm_resume (void) (ind_vm, void*, sg_host_t)
+Proc H vm_shutdown (void) (ind_vm, void*, sg_host_t)
+Proc H vm_save (void) (ind_vm, void*, sg_host_t)
+Proc H vm_restore (void) (ind_vm, void*, sg_host_t)
+Proc - vm_migratefrom_resumeto (void) (vm, void*, sg_host_t)(src_pm, void*, sg_host_t) (dst_pm, void*, sg_host_t)
+Func H process_create (void*) (name, const char*) (code, FPtr, xbt_main_func_t) (data, void*) (hostname, const char*) (kill_time, double) (argc, int) (argv, void*, char**) (properties, void*, xbt_dict_t) (auto_restart, int)
 Proc H process_kill (void) (process, void*, smx_process_t)
 Proc H process_killall (void) (reset_pid, int)
 Proc - process_cleanup (void) (process, void*, smx_process_t)
-Proc H process_change_host (void) (process, void*, smx_process_t) (dest, void*, smx_host_t)
+Proc H process_change_host (void) (process, void*, smx_process_t) (dest, void*, sg_host_t)
 Blck H process_suspend (void) (process, void*, smx_process_t)
 Proc H process_resume (void) (process, void*, smx_process_t)
 Func - process_count (int)
@@ -105,19 +94,31 @@ Func - process_get_PID (int) (process, void*, smx_process_t)
 Func - process_get_PPID (int) (process, void*, smx_process_t)
 Func - process_get_data (void*) (process, void*, smx_process_t)
 Proc - process_set_data (void) (process, void*, smx_process_t) (data, void*)
-Func - process_get_host (void*, smx_host_t) (process, void*, smx_process_t)
+Func - process_get_host (void*, sg_host_t) (process, void*, smx_process_t)
 Func - process_get_name (const char*) (process, void*, smx_process_t)
 Func - process_is_suspended (int) (process, void*, smx_process_t)
 Func - process_get_properties (void*, xbt_dict_t) (process, void*, smx_process_t)
 Blck H process_join (int) (process, void*, smx_process_t) (timeout, double)
 Blck H process_sleep (int) (duration, double)
+
+Func H process_execute (void*, smx_synchro_t) (name, const char*) (flops_amount, double) (priority, double) (bound, double) (affinity_mask, unsigned long)
+Func - process_parallel_execute (void*, smx_synchro_t) (name, const char*) (host_nb, int) (host_list, void*, sg_host_t*) (flops_amount, void*, double*) (bytes_amount, void*, double*) (amount, double) (rate, double)
+Proc - process_execution_destroy (void) (execution, void*, smx_synchro_t)
+Proc - process_execution_cancel (void) (execution, void*, smx_synchro_t)
+Func - process_execution_get_remains (double) (execution, void*, smx_synchro_t)
+Func - process_execution_get_state (int, e_smx_state_t) (execution, void*, smx_synchro_t)
+Proc - process_execution_set_priority (void) (execution, void*, smx_synchro_t) (priority, double)
+Proc - process_execution_set_bound (void) (execution, void*, smx_synchro_t) (bound, double)
+Proc - process_execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, void*, sg_host_t) (mask, unsigned long)
+Blck H process_execution_wait (int) (execution, void*, smx_synchro_t)
+
 Proc - process_on_exit (void) (process, void*, smx_process_t) (fun, FPtr, int_f_pvoid_pvoid_t) (data, void*)
 Proc - process_auto_restart_set (void) (process, void*, smx_process_t) (auto_restart, int)
 Func H process_restart (void*, smx_process_t) (process, void*, smx_process_t)
 
 Func - rdv_create (void*, smx_rdv_t) (name, const char*)
 Proc - rdv_destroy (void) (rdv, void*, smx_rdv_t)
-Func - rdv_comm_count_by_host (unsigned int) (rdv, void*, smx_rdv_t) (host, void*, smx_host_t)
+Func - rdv_comm_count_by_host (unsigned int) (rdv, void*, smx_rdv_t) (host, void*, sg_host_t)
 Func - rdv_get_head (void*, smx_synchro_t) (rdv, void*, smx_rdv_t)
 Proc - rdv_set_receiver (void) (rdv, void*, smx_rdv_t) (receiver, void*, smx_process_t)
 Func - rdv_get_receiver (void*, smx_process_t) (rdv, void*, smx_rdv_t)
@@ -155,11 +156,11 @@ Func H sem_would_block (int) (sem, void*, smx_sem_t)
 Blck H sem_acquire (void) (sem, void*, smx_sem_t)
 Blck H sem_acquire_timeout (void) (sem, void*, smx_sem_t) (timeout, double)
 Func H sem_get_capacity (int) (sem, void*, smx_sem_t)
-Blck H file_read (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, smx_host_t)
-Blck H file_write (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, smx_host_t)
-Blck H file_open (void*, smx_file_t) (fullpath, const char*) (host, void*, smx_host_t)
-Blck H file_close (int) (fd, void*, smx_file_t) (host, void*, smx_host_t)
-Func - file_unlink (int) (fd, void*, smx_file_t) (host, void*, smx_host_t)
+Blck H file_read (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, sg_host_t)
+Blck H file_write (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, sg_host_t)
+Blck H file_open (void*, smx_file_t) (fullpath, const char*) (host, void*, sg_host_t)
+Blck H file_close (int) (fd, void*, smx_file_t) (host, void*, sg_host_t)
+Func - file_unlink (int) (fd, void*, smx_file_t) (host, void*, sg_host_t)
 Func H file_get_size (sg_size_t) (fd, void*, smx_file_t)
 Func H file_tell (sg_size_t) (fd, void*, smx_file_t)
 Func H file_seek (int) (fd, void*, smx_file_t) (offset, sg_offset_t) (origin, int)
index 5602ad6..9e59e32 100644 (file)
@@ -23,7 +23,7 @@ extern int surf_parse_lineno;
 
 static void parse_process(sg_platf_process_cbarg_t process)
 {
-  smx_host_t host = SIMIX_host_get_by_name(process->host);
+  sg_host_t host = sg_host_by_name(process->host);
   if (!host)
     THROWF(arg_error, 0, "Host '%s' unknown", process->host);
   parse_code = SIMIX_get_registered_function(process->function);
@@ -48,10 +48,10 @@ static void parse_process(sg_platf_process_cbarg_t process)
   arg->name = xbt_strdup(arg->argv[0]);
   arg->kill_time = kill_time;
   arg->properties = current_property_set;
-  if (!SIMIX_host_priv(host)->boot_processes) {
-    SIMIX_host_priv(host)->boot_processes = xbt_dynar_new(sizeof(smx_process_arg_t), _SIMIX_host_free_process_arg);
+  if (!sg_host_simix(host)->boot_processes) {
+    sg_host_simix(host)->boot_processes = xbt_dynar_new(sizeof(smx_process_arg_t), _SIMIX_host_free_process_arg);
   }
-  xbt_dynar_push_as(SIMIX_host_priv(host)->boot_processes,smx_process_arg_t,arg);
+  xbt_dynar_push_as(sg_host_simix(host)->boot_processes,smx_process_arg_t,arg);
 
   if (start_time > SIMIX_get_clock()) {
     arg = xbt_new0(s_smx_process_arg_t, 1);
@@ -71,7 +71,7 @@ static void parse_process(sg_platf_process_cbarg_t process)
     XBT_DEBUG("Starting Process %s(%s) right now", process->argv[0], sg_host_name(host));
 
     if (simix_global->create_process_function)
-      simix_global->create_process_function(&process_created,
+      process_created = simix_global->create_process_function(
                                             (char*)(process->argv)[0],
                                             parse_code,
                                             NULL,
@@ -82,7 +82,7 @@ static void parse_process(sg_platf_process_cbarg_t process)
                                             current_property_set,
                                             auto_restart, NULL);
     else
-      simcall_process_create(&process_created, (char*)(process->argv)[0], parse_code, NULL, sg_host_name(host), kill_time, process->argc,
+      process_created = simcall_process_create((char*)(process->argv)[0], parse_code, NULL, sg_host_name(host), kill_time, process->argc,
           (char**)process->argv, current_property_set,auto_restart);
     
     /* verify if process has been created (won't be the case if the host is currently dead, but that's fine) */
@@ -196,7 +196,7 @@ void SIMIX_process_set_function(const char *process_host,
 {
   s_sg_platf_process_cbarg_t process = SG_PLATF_PROCESS_INITIALIZER;
 
-  smx_host_t host = SIMIX_host_get_by_name(process_host);
+  sg_host_t host = sg_host_by_name(process_host);
   if (!host)
     THROWF(arg_error, 0, "Host '%s' unknown", process_host);
   process.host = sg_host_name(host);
index 78e3307..a591570 100644 (file)
@@ -53,7 +53,7 @@ void SIMIX_post_create_environment(void) {
   /* Create host at SIMIX level */
   xbt_lib_foreach(host_lib, cursor, name, host) {
     if(host[SURF_HOST_LEVEL])
-      SIMIX_host_create(name, NULL);
+      SIMIX_host_create(name);
   }
 
   /* Create storage at SIMIX level */
index c7abb8a..3491894 100644 (file)
@@ -206,7 +206,6 @@ void SIMIX_global_init(int *argc, char **argv)
     simix_timers = xbt_heap_new(8, &free);
   }
 
-  SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,SIMIX_host_destroy);
   SIMIX_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, SIMIX_storage_destroy);
 
   if (sg_cfg_get_boolean("clean_atexit"))
@@ -243,7 +242,14 @@ void SIMIX_clean(void)
 #endif
   if (cleaned) return; // to avoid double cleaning by java and C
   cleaned = 1;
-  /* Kill everyone (except maestro) */
+  XBT_DEBUG("SIMIX_clean called. Simulation's over.");
+  if (!xbt_dynar_is_empty(simix_global->process_to_run) && SIMIX_get_clock() == 0.0) {
+         XBT_CRITICAL("   ");
+         XBT_CRITICAL("The time is still 0, and you still have processes ready to run.");
+         XBT_CRITICAL("It seems that you forgot to run the simulation that you setup.");
+         xbt_die("Bailing out to avoid that stop-before-start madness. Please fix your code.");
+  }
+  /* Kill all processes (but maestro) */
   SIMIX_process_killall(simix_global->maestro_process, 1);
 
   /* Exit the SIMIX network module */
@@ -486,7 +492,7 @@ void SIMIX_run(void)
       char *hostname = NULL;
       xbt_dynar_foreach(host_that_restart,iter,hostname) {
         XBT_INFO("Restart processes on host: %s",hostname);
-        SIMIX_host_autorestart(SIMIX_host_get_by_name(hostname));
+        SIMIX_host_autorestart(sg_host_by_name(hostname));
       }
       xbt_dynar_reset(host_that_restart);
     }
@@ -630,12 +636,12 @@ void SIMIX_display_process_status(void)
         break;
       }
       XBT_INFO("Process %lu (%s@%s): waiting for %s synchro %p (%s) in state %d to finish",
-          process->pid, process->name, sg_host_name(process->smx_host),
+          process->pid, process->name, sg_host_name(process->host),
           synchro_description, process->waiting_synchro,
           process->waiting_synchro->name, (int)process->waiting_synchro->state);
     }
     else {
-      XBT_INFO("Process %lu (%s@%s)", process->pid, process->name, sg_host_name(process->smx_host));
+      XBT_INFO("Process %lu (%s@%s)", process->pid, process->name, sg_host_name(process->host));
     }
   }
 }
index 628ea05..6753921 100644 (file)
@@ -19,10 +19,10 @@ static void SIMIX_execution_finish(smx_synchro_t synchro);
 /**
  * \brief Internal function to create a SIMIX host.
  * \param name name of the host to create
- * \param data some user data (may be NULL)
  */
-smx_host_t SIMIX_host_create(const char *name, void *data)
+void SIMIX_host_create(const char *name) // FIXME: braindead prototype. Take sg_host as parameter
 {
+  sg_host_t host = xbt_lib_get_elm_or_null(host_lib, name);
   smx_host_priv_t smx_host = xbt_new0(s_smx_host_priv_t, 1);
   s_smx_process_t proc;
 
@@ -31,18 +31,16 @@ smx_host_t SIMIX_host_create(const char *name, void *data)
       xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup));
 
   /* Update global variables */
-  xbt_lib_set(host_lib,name,SIMIX_HOST_LEVEL,smx_host);
-
-  return xbt_lib_get_elm_or_null(host_lib, name);
+  sg_host_simix_set(host, smx_host);
 }
 
 /**
  * \brief Start the host if it is off
  *
  */
-void SIMIX_host_on(smx_host_t h)
+void SIMIX_host_on(sg_host_t h)
 {
-  smx_host_priv_t host = SIMIX_host_priv(h);
+  smx_host_priv_t host = sg_host_simix(h);
 
   xbt_assert((host != NULL), "Invalid parameters");
 
@@ -52,7 +50,6 @@ void SIMIX_host_on(smx_host_t h)
     unsigned int cpt;
     smx_process_arg_t arg;
     xbt_dynar_foreach(host->boot_processes,cpt,arg) {
-      smx_process_t process;
 
       char** argv = xbt_new(char*, arg->argc);
       for (int i=0; i<arg->argc; i++)
@@ -60,8 +57,7 @@ void SIMIX_host_on(smx_host_t h)
 
       XBT_DEBUG("Booting Process %s(%s) right now", arg->argv[0], arg->hostname);
       if (simix_global->create_process_function) {
-        simix_global->create_process_function(&process,
-                                              argv[0],
+        simix_global->create_process_function(argv[0],
                                               arg->code,
                                               NULL,
                                               arg->hostname,
@@ -72,8 +68,7 @@ void SIMIX_host_on(smx_host_t h)
                                               arg->auto_restart,
                                               NULL);
       } else {
-        simcall_process_create(&process,
-                               arg->argv[0],
+        simcall_process_create(arg->argv[0],
                                arg->code,
                                NULL,
                                arg->hostname,
@@ -87,7 +82,7 @@ void SIMIX_host_on(smx_host_t h)
   }
 }
 
-void simcall_HANDLER_host_off(smx_simcall_t simcall, smx_host_t h)
+void simcall_HANDLER_host_off(smx_simcall_t simcall, sg_host_t h)
 {
  SIMIX_host_off(h, simcall->issuer);
 }
@@ -96,9 +91,9 @@ void simcall_HANDLER_host_off(smx_simcall_t simcall, smx_host_t h)
  * \brief Stop the host if it is on
  *
  */
-void SIMIX_host_off(smx_host_t h, smx_process_t issuer)
+void SIMIX_host_off(sg_host_t h, smx_process_t issuer)
 {
-  smx_host_priv_t host = SIMIX_host_priv(h);
+  smx_host_priv_t host = sg_host_simix(h);
 
   xbt_assert((host != NULL), "Invalid parameters");
 
@@ -110,7 +105,7 @@ void SIMIX_host_off(smx_host_t h, smx_process_t issuer)
       smx_process_t process = NULL;
       xbt_swag_foreach(process, host->process_list) {
         SIMIX_process_kill(process, issuer);
-        XBT_DEBUG("Killing %s on %s by %s", process->name,  sg_host_name(process->smx_host), issuer->name);
+        XBT_DEBUG("Killing %s on %s by %s", process->name,  sg_host_name(process->host), issuer->name);
       }
     }
   }
@@ -119,7 +114,7 @@ void SIMIX_host_off(smx_host_t h, smx_process_t issuer)
 /**
  * \brief Internal function to destroy a SIMIX host.
  *
- * \param h the host to destroy (a smx_host_t)
+ * \param h the host to destroy (a sg_host_t)
  */
 void SIMIX_host_destroy(void *h)
 {
@@ -150,15 +145,7 @@ void SIMIX_host_destroy(void *h)
   return;
 }
 
-smx_host_t SIMIX_host_get_by_name(const char *name){
-  xbt_assert(((simix_global != NULL)
-               && (host_lib != NULL)),
-              "Environment not set yet");
-
-  return xbt_lib_get_elm_or_null(host_lib, name);
-}
-
-smx_host_t SIMIX_host_self(void)
+sg_host_t SIMIX_host_self(void)
 {
   smx_process_t process = SIMIX_process_self();
   return (process == NULL) ? NULL : SIMIX_process_get_host(process);
@@ -168,67 +155,67 @@ smx_host_t SIMIX_host_self(void)
    by exceptions and logging events */
 const char* SIMIX_host_self_get_name(void)
 {
-  smx_host_t host = SIMIX_host_self();
+  sg_host_t host = SIMIX_host_self();
   if (host == NULL || SIMIX_process_self() == simix_global->maestro_process)
     return "";
 
   return SIMIX_host_get_name(host);
 }
 
-xbt_dict_t SIMIX_host_get_properties(smx_host_t host){
+xbt_dict_t SIMIX_host_get_properties(sg_host_t host){
   return surf_host_get_properties(surf_host_resource_priv(host));
 }
 
-double SIMIX_host_get_speed(smx_host_t host){
+double SIMIX_host_get_speed(sg_host_t host){
   return surf_host_get_speed(host, 1.0);
 }
 
-int SIMIX_host_get_core(smx_host_t host){
+int SIMIX_host_get_core(sg_host_t host){
   return surf_host_get_core(host);
 }
 
-xbt_swag_t SIMIX_host_get_process_list(smx_host_t host){
-  smx_host_priv_t host_priv = SIMIX_host_priv(host);
+xbt_swag_t SIMIX_host_get_process_list(sg_host_t host){
+  smx_host_priv_t host_priv = sg_host_simix(host);
 
   return host_priv->process_list;
 }
 
 
-double SIMIX_host_get_available_speed(smx_host_t host){
+double SIMIX_host_get_available_speed(sg_host_t host){
   return surf_host_get_available_speed(host);
 }
 
-double SIMIX_host_get_current_power_peak(smx_host_t host) {
+double SIMIX_host_get_current_power_peak(sg_host_t host) {
          return surf_host_get_current_power_peak(host);
 }
 
-double SIMIX_host_get_power_peak_at(smx_host_t host, int pstate_index) {
+double SIMIX_host_get_power_peak_at(sg_host_t host, int pstate_index) {
          return surf_host_get_power_peak_at(host, pstate_index);
 }
 
-int SIMIX_host_get_nb_pstates(smx_host_t host) {
+int SIMIX_host_get_nb_pstates(sg_host_t host) {
          return surf_host_get_nb_pstates(host);
 }
 
 
-void SIMIX_host_set_pstate(smx_host_t host, int pstate_index) {
+void SIMIX_host_set_pstate(sg_host_t host, int pstate_index) {
          surf_host_set_pstate(host, pstate_index);
 }
-int SIMIX_host_get_pstate(smx_host_t host) {
+int SIMIX_host_get_pstate(sg_host_t host) {
          return surf_host_get_pstate(host);
 }
 
-double SIMIX_host_get_consumed_energy(smx_host_t host) {
+double SIMIX_host_get_consumed_energy(sg_host_t host) {
          return surf_host_get_consumed_energy(host);
 }
-double SIMIX_host_get_wattmin_at(smx_host_t host,int pstate) {
+double SIMIX_host_get_wattmin_at(sg_host_t host,int pstate) {
          return surf_host_get_wattmin_at(host,pstate);
 }
-double SIMIX_host_get_wattmax_at(smx_host_t host,int pstate) {
+double SIMIX_host_get_wattmax_at(sg_host_t host,int pstate) {
          return surf_host_get_wattmax_at(host,pstate);
 }
 
-int SIMIX_host_get_state(smx_host_t host){
+int SIMIX_host_get_state(sg_host_t host){
   return surf_host_get_state(surf_host_resource_priv(host));
 }
 
@@ -249,7 +236,7 @@ void _SIMIX_host_free_process_arg(void *data)
  * The processes will only be restarted once, meaning that you will have to register the process
  * again to restart the process again.
  */
-void SIMIX_host_add_auto_restart_process(smx_host_t host,
+void SIMIX_host_add_auto_restart_process(sg_host_t host,
                                          const char *name,
                                          xbt_main_func_t code,
                                          void *data,
@@ -259,8 +246,8 @@ void SIMIX_host_add_auto_restart_process(smx_host_t host,
                                          xbt_dict_t properties,
                                          int auto_restart)
 {
-  if (!SIMIX_host_priv(host)->auto_restart_processes) {
-    SIMIX_host_priv(host)->auto_restart_processes = xbt_dynar_new(sizeof(smx_process_arg_t),_SIMIX_host_free_process_arg);
+  if (!sg_host_simix(host)->auto_restart_processes) {
+    sg_host_simix(host)->auto_restart_processes = xbt_dynar_new(sizeof(smx_process_arg_t),_SIMIX_host_free_process_arg);
   }
   smx_process_arg_t arg = xbt_new(s_smx_process_arg_t,1);
   arg->name = xbt_strdup(name);
@@ -286,27 +273,24 @@ void SIMIX_host_add_auto_restart_process(smx_host_t host,
     xbt_dict_set(watched_hosts_lib,sg_host_name(host),host,NULL);
     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);
+  xbt_dynar_push_as(sg_host_simix(host)->auto_restart_processes,smx_process_arg_t,arg);
 }
 /**
  * \brief Restart the list of processes that have been registered to the host
  */
-void SIMIX_host_restart_processes(smx_host_t host)
+void SIMIX_host_restart_processes(sg_host_t host)
 {
   unsigned int cpt;
   smx_process_arg_t arg;
-  xbt_dynar_t process_list = SIMIX_host_priv(host)->auto_restart_processes;
+  xbt_dynar_t process_list = sg_host_simix(host)->auto_restart_processes;
   if (!process_list)
     return;
 
   xbt_dynar_foreach (process_list, cpt, arg) {
 
-    smx_process_t process;
-
     XBT_DEBUG("Restarting Process %s(%s) right now", arg->argv[0], arg->hostname);
     if (simix_global->create_process_function) {
-      simix_global->create_process_function(&process,
-                                            arg->argv[0],
+      simix_global->create_process_function(arg->argv[0],
                                             arg->code,
                                             NULL,
                                             arg->hostname,
@@ -317,8 +301,7 @@ void SIMIX_host_restart_processes(smx_host_t host)
                                             arg->auto_restart,
                                             NULL);
     } else {
-      simcall_process_create(&process,
-                             arg->argv[0],
+      simcall_process_create(arg->argv[0],
                              arg->code,
                              NULL,
                              arg->hostname,
@@ -338,29 +321,32 @@ void SIMIX_host_restart_processes(smx_host_t host)
   xbt_dynar_reset(process_list);
 }
 
-void SIMIX_host_autorestart(smx_host_t host)
+void SIMIX_host_autorestart(sg_host_t host)
 {
   if(simix_global->autorestart)
     simix_global->autorestart(host);
   else
     xbt_die("No function for simix_global->autorestart");
 }
-
-smx_synchro_t SIMIX_host_execute(const char *name,
-    smx_host_t host, double flops_amount, double priority, double bound, unsigned long affinity_mask){
+smx_synchro_t simcall_HANDLER_process_execute(smx_simcall_t simcall,
+               const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask) {
+       return SIMIX_process_execute(simcall->issuer, name,flops_amount,priority,bound,affinity_mask);
+}
+smx_synchro_t SIMIX_process_execute(smx_process_t issuer, const char *name,
+     double flops_amount, double priority, double bound, unsigned long affinity_mask){
 
   /* alloc structures and initialize */
   smx_synchro_t synchro = xbt_mallocator_get(simix_global->synchro_mallocator);
   synchro->type = SIMIX_SYNC_EXECUTE;
   synchro->name = xbt_strdup(name);
   synchro->state = SIMIX_RUNNING;
-  synchro->execution.host = host;
+  synchro->execution.host = issuer->host;
   synchro->category = NULL;
 
   /* set surf's action */
   if (!MC_is_active() && !MC_record_replay_is_active()) {
 
-    synchro->execution.surf_exec = surf_host_execute(host, flops_amount);
+    synchro->execution.surf_exec = surf_host_execute(issuer->host, flops_amount);
     surf_action_set_data(synchro->execution.surf_exec, synchro);
     surf_action_set_priority(synchro->execution.surf_exec, priority);
 
@@ -368,14 +354,14 @@ smx_synchro_t SIMIX_host_execute(const char *name,
      * surf layer should not be zero (i.e., unlimited). It should be the
      * capacity of a CPU core. */
     if (bound == 0)
-      surf_cpu_action_set_bound(synchro->execution.surf_exec, SIMIX_host_get_speed(host));
+      surf_cpu_action_set_bound(synchro->execution.surf_exec, SIMIX_host_get_speed(issuer->host));
     else
       surf_cpu_action_set_bound(synchro->execution.surf_exec, bound);
 
     if (affinity_mask != 0) {
       /* just a double check to confirm that this host is the host where this task is running. */
-      xbt_assert(synchro->execution.host == host);
-      surf_cpu_action_set_affinity(synchro->execution.surf_exec, host, affinity_mask);
+      xbt_assert(synchro->execution.host == issuer->host);
+      surf_cpu_action_set_affinity(synchro->execution.surf_exec, issuer->host, affinity_mask);
     }
   }
 
@@ -384,12 +370,12 @@ smx_synchro_t SIMIX_host_execute(const char *name,
   return synchro;
 }
 
-smx_synchro_t SIMIX_host_parallel_execute(const char *name,
-    int host_nb, smx_host_t *host_list,
+smx_synchro_t SIMIX_process_parallel_execute(const char *name,
+    int host_nb, sg_host_t *host_list,
     double *flops_amount, double *bytes_amount,
     double amount, double rate){
 
-  void **surf_host_list = NULL;
+  sg_host_t*host_list_cpy = NULL;
   int i;
 
   /* alloc structures and initialize */
@@ -401,9 +387,9 @@ smx_synchro_t SIMIX_host_parallel_execute(const char *name,
   synchro->category = NULL;
 
   /* set surf's synchro */
-  surf_host_list = xbt_new0(void *, host_nb);
+  host_list_cpy = xbt_new0(sg_host_t, host_nb);
   for (i = 0; i < host_nb; i++)
-    surf_host_list[i] = surf_host_resource_priv(host_list[i]);
+    host_list_cpy[i] = host_list[i];
 
 
   /* FIXME: what happens if host_list contains VMs and PMs. If
@@ -421,8 +407,8 @@ smx_synchro_t SIMIX_host_parallel_execute(const char *name,
   /* set surf's synchro */
   if (!MC_is_active() && !MC_record_replay_is_active()) {
     synchro->execution.surf_exec =
-      surf_host_model_execute_parallel_task((surf_host_model_t)surf_host_model,
-                 host_nb, surf_host_list, flops_amount, bytes_amount, rate);
+      surf_host_model_execute_parallel_task(surf_host_model,
+                 host_nb, host_list_cpy, flops_amount, bytes_amount, rate);
 
     surf_action_set_data(synchro->execution.surf_exec, synchro);
   }
@@ -431,7 +417,7 @@ smx_synchro_t SIMIX_host_parallel_execute(const char *name,
   return synchro;
 }
 
-void SIMIX_host_execution_destroy(smx_synchro_t synchro){
+void SIMIX_process_execution_destroy(smx_synchro_t synchro){
   XBT_DEBUG("Destroy synchro %p", synchro);
 
   if (synchro->execution.surf_exec) {
@@ -442,14 +428,14 @@ void SIMIX_host_execution_destroy(smx_synchro_t synchro){
   xbt_mallocator_release(simix_global->synchro_mallocator, synchro);
 }
 
-void SIMIX_host_execution_cancel(smx_synchro_t synchro){
+void SIMIX_process_execution_cancel(smx_synchro_t synchro){
   XBT_DEBUG("Cancel synchro %p", synchro);
 
   if (synchro->execution.surf_exec)
     surf_action_cancel(synchro->execution.surf_exec);
 }
 
-double SIMIX_host_execution_get_remains(smx_synchro_t synchro){
+double SIMIX_process_execution_get_remains(smx_synchro_t synchro){
   double result = 0.0;
 
   if (synchro->state == SIMIX_RUNNING)
@@ -458,23 +444,23 @@ double SIMIX_host_execution_get_remains(smx_synchro_t synchro){
   return result;
 }
 
-e_smx_state_t SIMIX_host_execution_get_state(smx_synchro_t synchro){
+e_smx_state_t SIMIX_process_execution_get_state(smx_synchro_t synchro){
   return synchro->state;
 }
 
-void SIMIX_host_execution_set_priority(smx_synchro_t synchro, double priority){
+void SIMIX_process_execution_set_priority(smx_synchro_t synchro, double priority){
 
   if(synchro->execution.surf_exec)
        surf_action_set_priority(synchro->execution.surf_exec, priority);
 }
 
-void SIMIX_host_execution_set_bound(smx_synchro_t synchro, double bound){
+void SIMIX_process_execution_set_bound(smx_synchro_t synchro, double bound){
 
   if(synchro->execution.surf_exec)
        surf_cpu_action_set_bound(synchro->execution.surf_exec, bound);
 }
 
-void SIMIX_host_execution_set_affinity(smx_synchro_t synchro, smx_host_t host, unsigned long mask){
+void SIMIX_process_execution_set_affinity(smx_synchro_t synchro, sg_host_t host, unsigned long mask){
   xbt_assert(synchro->type == SIMIX_SYNC_EXECUTE);
 
   if (synchro->execution.surf_exec) {
@@ -484,7 +470,7 @@ void SIMIX_host_execution_set_affinity(smx_synchro_t synchro, smx_host_t host, u
   }
 }
 
-void simcall_HANDLER_host_execution_wait(smx_simcall_t simcall, smx_synchro_t synchro){
+void simcall_HANDLER_process_execution_wait(smx_simcall_t simcall, smx_synchro_t synchro){
 
   XBT_DEBUG("Wait for execution of synchro %p, state %d", synchro, (int)synchro->state);
 
@@ -531,7 +517,7 @@ void SIMIX_execution_finish(smx_synchro_t synchro)
         break;
 
       case SIMIX_FAILED:
-        XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", sg_host_name(simcall->issuer->smx_host));
+        XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", sg_host_name(simcall->issuer->host));
         simcall->issuer->context->iwannadie = 1;
         SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
         break;
@@ -546,17 +532,17 @@ void SIMIX_execution_finish(smx_synchro_t synchro)
             (int)synchro->state);
     }
     /* check if the host is down */
-    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->smx_host)) != SURF_RESOURCE_ON) {
+    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->host)) != SURF_RESOURCE_ON) {
       simcall->issuer->context->iwannadie = 1;
     }
 
     simcall->issuer->waiting_synchro =    NULL;
-    simcall_host_execution_wait__set__result(simcall, synchro->state);
+    simcall_process_execution_wait__set__result(simcall, synchro->state);
     SIMIX_simcall_answer(simcall);
   }
 
   /* We no longer need it */
-  SIMIX_host_execution_destroy(synchro);
+  SIMIX_process_execution_destroy(synchro);
 }
 
 
@@ -601,28 +587,28 @@ void SIMIX_set_category(smx_synchro_t synchro, const char *category)
 /**
  * \brief Function to get the parameters of the given the SIMIX host.
  *
- * \param host the host to get_phys_host (a smx_host_t)
+ * \param host the host to get_phys_host (a sg_host_t)
  * \param param the parameter object space to be overwritten (a ws_params_t)
  */
-void SIMIX_host_get_params(smx_host_t ind_vm, ws_params_t params)
+void SIMIX_host_get_params(sg_host_t ind_vm, vm_params_t params)
 {
   /* jump to ws_get_params(). */
   surf_host_get_params(ind_vm, params);
 }
 
-void SIMIX_host_set_params(smx_host_t ind_vm, ws_params_t params)
+void SIMIX_host_set_params(sg_host_t ind_vm, vm_params_t params)
 {
   /* jump to ws_set_params(). */
   surf_host_set_params(ind_vm, params);
 }
 
-xbt_dict_t SIMIX_host_get_mounted_storage_list(smx_host_t host){
+xbt_dict_t SIMIX_host_get_mounted_storage_list(sg_host_t host){
   xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
 
   return surf_host_get_mounted_storage_list(host);
 }
 
-xbt_dynar_t SIMIX_host_get_attached_storage_list(smx_host_t host){
+xbt_dynar_t SIMIX_host_get_attached_storage_list(sg_host_t host){
   xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
 
   return surf_host_get_attached_storage_list(host);
index d807587..d204997 100644 (file)
 
 SG_BEGIN_DECL()
 
-/** @brief Host datatype */
+/** @brief Host datatype from SIMIX POV */
 typedef struct s_smx_host_priv {
   xbt_swag_t process_list;
   xbt_dynar_t auto_restart_processes;
-  xbt_dynar_t boot_processes; 
+  xbt_dynar_t boot_processes;
 } s_smx_host_priv_t;
 
-static inline smx_host_priv_t SIMIX_host_priv(smx_host_t host){
-  return (smx_host_priv_t) xbt_lib_get_level(host, SIMIX_HOST_LEVEL);
-}
-
 void _SIMIX_host_free_process_arg(void *);
-smx_host_t SIMIX_host_create(const char *name, void *data);
+void SIMIX_host_create(const char *name);
 void SIMIX_host_destroy(void *host);
 
-void SIMIX_host_add_auto_restart_process(smx_host_t host,
+void SIMIX_host_add_auto_restart_process(sg_host_t host,
                                          const char *name,
                                          xbt_main_func_t code,
                                          void *data,
@@ -37,39 +33,39 @@ void SIMIX_host_add_auto_restart_process(smx_host_t host,
                                          xbt_dict_t properties,
                                          int auto_restart);
 
-void SIMIX_host_restart_processes(smx_host_t host);
-void SIMIX_host_autorestart(smx_host_t host);
-xbt_dict_t SIMIX_host_get_properties(smx_host_t host);
-int SIMIX_host_get_core(smx_host_t host);
-xbt_swag_t SIMIX_host_get_process_list(smx_host_t host);
-double SIMIX_host_get_speed(smx_host_t host);
-double SIMIX_host_get_available_speed(smx_host_t host);
-int SIMIX_host_get_state(smx_host_t host);
-void SIMIX_host_on(smx_host_t host);
-void SIMIX_host_off(smx_host_t host, smx_process_t issuer);
-double SIMIX_host_get_current_power_peak(smx_host_t host);
-double SIMIX_host_get_power_peak_at(smx_host_t host, int pstate_index);
-int SIMIX_host_get_nb_pstates(smx_host_t host);
-double SIMIX_host_get_consumed_energy(smx_host_t host);
-double SIMIX_host_get_wattmin_at(smx_host_t host,int pstate);
-double SIMIX_host_get_wattmax_at(smx_host_t host,int pstate);
-void SIMIX_host_set_pstate(smx_host_t host, int pstate_index);
-int SIMIX_host_get_pstate(smx_host_t host);
-smx_synchro_t SIMIX_host_execute(const char *name,
-    smx_host_t host, double flops_amount, double priority, double bound, unsigned long affinity_mask);
-smx_synchro_t SIMIX_host_parallel_execute(const char *name,
-    int host_nb, smx_host_t *host_list,
+void SIMIX_host_restart_processes(sg_host_t host);
+void SIMIX_host_autorestart(sg_host_t host);
+xbt_dict_t SIMIX_host_get_properties(sg_host_t host);
+int SIMIX_host_get_core(sg_host_t host);
+xbt_swag_t SIMIX_host_get_process_list(sg_host_t host);
+double SIMIX_host_get_speed(sg_host_t host);
+double SIMIX_host_get_available_speed(sg_host_t host);
+int SIMIX_host_get_state(sg_host_t host);
+void SIMIX_host_on(sg_host_t host);
+void SIMIX_host_off(sg_host_t host, smx_process_t issuer);
+double SIMIX_host_get_current_power_peak(sg_host_t host);
+double SIMIX_host_get_power_peak_at(sg_host_t host, int pstate_index);
+int SIMIX_host_get_nb_pstates(sg_host_t host);
+double SIMIX_host_get_consumed_energy(sg_host_t host);
+double SIMIX_host_get_wattmin_at(sg_host_t host,int pstate);
+double SIMIX_host_get_wattmax_at(sg_host_t host,int pstate);
+void SIMIX_host_set_pstate(sg_host_t host, int pstate_index);
+int SIMIX_host_get_pstate(sg_host_t host);
+smx_synchro_t SIMIX_process_execute(smx_process_t issuer, const char *name,
+    double flops_amount, double priority, double bound, unsigned long affinity_mask);
+smx_synchro_t SIMIX_process_parallel_execute(const char *name,
+    int host_nb, sg_host_t *host_list,
     double *flops_amount, double *bytes_amount,
     double amount, double rate);
-void SIMIX_host_execution_destroy(smx_synchro_t synchro);
-void SIMIX_host_execution_cancel(smx_synchro_t synchro);
-double SIMIX_host_execution_get_remains(smx_synchro_t synchro);
-e_smx_state_t SIMIX_host_execution_get_state(smx_synchro_t synchro);
-void SIMIX_host_execution_set_priority(smx_synchro_t synchro, double priority);
-void SIMIX_host_execution_set_bound(smx_synchro_t synchro, double bound);
-void SIMIX_host_execution_set_affinity(smx_synchro_t synchro, smx_host_t host, unsigned long mask);
-xbt_dict_t SIMIX_host_get_mounted_storage_list(smx_host_t host);
-xbt_dynar_t SIMIX_host_get_attached_storage_list(smx_host_t host);
+void SIMIX_process_execution_destroy(smx_synchro_t synchro);
+void SIMIX_process_execution_cancel(smx_synchro_t synchro);
+double SIMIX_process_execution_get_remains(smx_synchro_t synchro);
+e_smx_state_t SIMIX_process_execution_get_state(smx_synchro_t synchro);
+void SIMIX_process_execution_set_priority(smx_synchro_t synchro, double priority);
+void SIMIX_process_execution_set_bound(smx_synchro_t synchro, double bound);
+void SIMIX_process_execution_set_affinity(smx_synchro_t synchro, sg_host_t host, unsigned long mask);
+xbt_dict_t SIMIX_host_get_mounted_storage_list(sg_host_t host);
+xbt_dynar_t SIMIX_host_get_attached_storage_list(sg_host_t host);
 
 void SIMIX_host_execution_suspend(smx_synchro_t synchro);
 void SIMIX_host_execution_resume(smx_synchro_t synchro);
@@ -78,38 +74,38 @@ void SIMIX_post_host_execute(smx_synchro_t synchro);
 void SIMIX_set_category(smx_synchro_t synchro, const char *category);
 
 /* vm related stuff */
-smx_host_t SIMIX_vm_create(const char *name, smx_host_t ind_phys_host);
+sg_host_t SIMIX_vm_create(const char *name, sg_host_t ind_phys_host);
 
-void SIMIX_vm_destroy(smx_host_t ind_vm);
+void SIMIX_vm_destroy(sg_host_t ind_vm);
 // --
-void SIMIX_vm_resume(smx_host_t ind_vm, smx_process_t issuer);
+void SIMIX_vm_resume(sg_host_t ind_vm, smx_process_t issuer);
 
-void SIMIX_vm_suspend(smx_host_t ind_vm, smx_process_t issuer);
+void SIMIX_vm_suspend(sg_host_t ind_vm, smx_process_t issuer);
 // --
-void SIMIX_vm_save(smx_host_t ind_vm, smx_process_t issuer);
+void SIMIX_vm_save(sg_host_t ind_vm, smx_process_t issuer);
 
-void SIMIX_vm_restore(smx_host_t ind_vm, smx_process_t issuer);
+void SIMIX_vm_restore(sg_host_t ind_vm, smx_process_t issuer);
 // --
-void SIMIX_vm_start(smx_host_t ind_vm);
+void SIMIX_vm_start(sg_host_t ind_vm);
 
-void SIMIX_vm_shutdown(smx_host_t ind_vm, smx_process_t issuer);
+void SIMIX_vm_shutdown(sg_host_t ind_vm, smx_process_t issuer);
 // --
 
-int SIMIX_vm_get_state(smx_host_t ind_vm);
+int SIMIX_vm_get_state(sg_host_t ind_vm);
 // --
-void SIMIX_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm);
+void SIMIX_vm_migrate(sg_host_t ind_vm, sg_host_t ind_dst_pm);
 
-void *SIMIX_vm_get_pm(smx_host_t ind_vm);
+void *SIMIX_vm_get_pm(sg_host_t ind_vm);
 
-void SIMIX_vm_set_bound(smx_host_t ind_vm, double bound);
+void SIMIX_vm_set_bound(sg_host_t ind_vm, double bound);
 
-void SIMIX_vm_set_affinity(smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask);
+void SIMIX_vm_set_affinity(sg_host_t ind_vm, sg_host_t ind_pm, unsigned long mask);
 
-void SIMIX_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm);
+void SIMIX_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm);
 
-void SIMIX_host_get_params(smx_host_t ind_vm, ws_params_t params);
+void SIMIX_host_get_params(sg_host_t ind_vm, vm_params_t params);
 
-void SIMIX_host_set_params(smx_host_t ind_vm, ws_params_t params);
+void SIMIX_host_set_params(sg_host_t ind_vm, vm_params_t params);
 
 SG_END_DECL()
 
index 5800ceb..e8c3c3f 100644 (file)
@@ -50,14 +50,14 @@ void SIMIX_storage_destroy(void *s)
 }
 
 //SIMIX FILE READ
-void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host)
+void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_read(fd, size, host);
   xbt_fifo_push(synchro->simcalls, simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, smx_host_t host)
+smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro;
 
@@ -82,14 +82,14 @@ smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, smx_host_t host)
 }
 
 //SIMIX FILE WRITE
-void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host)
+void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_write(fd,  size, host);
   xbt_fifo_push(synchro->simcalls, simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, smx_host_t host)
+smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
 {
   smx_synchro_t synchro;
 
@@ -114,14 +114,14 @@ smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, smx_host_t host)
 }
 
 //SIMIX FILE OPEN
-void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, smx_host_t host)
+void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_open(fullpath, host);
   xbt_fifo_push(synchro->simcalls, simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_synchro_t SIMIX_file_open(const char* fullpath, smx_host_t host)
+smx_synchro_t SIMIX_file_open(const char* fullpath, sg_host_t host)
 {
   smx_synchro_t synchro;
 
@@ -146,14 +146,14 @@ smx_synchro_t SIMIX_file_open(const char* fullpath, smx_host_t host)
 }
 
 //SIMIX FILE CLOSE
-void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, smx_host_t host)
+void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, sg_host_t host)
 {
   smx_synchro_t synchro = SIMIX_file_close(fd, host);
   xbt_fifo_push(synchro->simcalls, simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_synchro_t SIMIX_file_close(smx_file_t fd, smx_host_t host)
+smx_synchro_t SIMIX_file_close(smx_file_t fd, sg_host_t host)
 {
   smx_synchro_t synchro;
 
@@ -179,7 +179,7 @@ smx_synchro_t SIMIX_file_close(smx_file_t fd, smx_host_t host)
 
 
 //SIMIX FILE UNLINK
-int SIMIX_file_unlink(smx_file_t fd, smx_host_t host)
+int SIMIX_file_unlink(smx_file_t fd, sg_host_t host)
 {
   /* check if the host is active */
   if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
@@ -199,7 +199,7 @@ sg_size_t simcall_HANDLER_file_get_size(smx_simcall_t simcall, smx_file_t fd)
 
 sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_get_size(host, fd->surf_file);
 }
 
@@ -210,7 +210,7 @@ sg_size_t simcall_HANDLER_file_tell(smx_simcall_t simcall, smx_file_t fd)
 
 sg_size_t SIMIX_file_tell(smx_process_t process, smx_file_t fd)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_file_tell(host, fd->surf_file);
 }
 
@@ -222,7 +222,7 @@ xbt_dynar_t simcall_HANDLER_file_get_info(smx_simcall_t simcall, smx_file_t fd)
 
 xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_get_info(host, fd->surf_file);
 }
 
@@ -233,7 +233,7 @@ int simcall_HANDLER_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t
 
 int SIMIX_file_seek(smx_process_t process, smx_file_t fd, sg_offset_t offset, int origin)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_file_seek(host, fd->surf_file, offset, origin);
 }
 
@@ -244,7 +244,7 @@ int simcall_HANDLER_file_move(smx_simcall_t simcall, smx_file_t file, const char
 
 int SIMIX_file_move(smx_process_t process, smx_file_t file, const char* fullpath)
 {
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
   return  surf_host_file_move(host, file->surf_file, fullpath);
 }
 
@@ -375,7 +375,7 @@ void SIMIX_io_finish(smx_synchro_t synchro)
             (int)synchro->state);
     }
 
-    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->smx_host)) != SURF_RESOURCE_ON) {
+    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->host)) != SURF_RESOURCE_ON) {
       simcall->issuer->context->iwannadie = 1;
     }
 
index 1cc843d..81fa6c6 100644 (file)
@@ -22,11 +22,11 @@ static inline smx_storage_priv_t SIMIX_storage_priv(smx_storage_t storage){
 
 smx_storage_t SIMIX_storage_create(const char *name, void *storage, void *data);
 void SIMIX_storage_destroy(void *s);
-smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, smx_host_t host);
-smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, smx_host_t host);
-smx_synchro_t SIMIX_file_open(const char* fullpath, smx_host_t host);
-smx_synchro_t SIMIX_file_close(smx_file_t fd, smx_host_t host);
-int SIMIX_file_unlink(smx_file_t fd, smx_host_t host);
+smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, sg_host_t host);
+smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, sg_host_t host);
+smx_synchro_t SIMIX_file_open(const char* fullpath, sg_host_t host);
+smx_synchro_t SIMIX_file_close(smx_file_t fd, sg_host_t host);
+int SIMIX_file_unlink(smx_file_t fd, sg_host_t host);
 sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd);
 sg_size_t SIMIX_file_tell(smx_process_t process, smx_file_t fd);
 xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd);
index a671d9f..fd2a61b 100644 (file)
@@ -91,14 +91,14 @@ smx_rdv_t SIMIX_rdv_get_by_name(const char *name)
   return xbt_dict_get_or_null(rdv_points, name);
 }
 
-int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host)
+int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, sg_host_t host)
 {
   smx_synchro_t comm = NULL;
   xbt_fifo_item_t item = NULL;
   int count = 0;
 
   xbt_fifo_foreach(rdv->comm_fifo, item, comm, smx_synchro_t) {
-    if (comm->comm.src_proc->smx_host == host)
+    if (comm->comm.src_proc->host == host)
       count++;
   }
 
@@ -616,7 +616,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_synchro_t synchro, dou
   if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING) {
     SIMIX_comm_finish(synchro);
   } else { /* if (timeout >= 0) { we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host fails */
-    sleep = surf_host_sleep(simcall->issuer->smx_host, timeout);
+    sleep = surf_host_sleep(simcall->issuer->host, timeout);
     surf_action_set_data(sleep, synchro);
 
     if (simcall->issuer == synchro->comm.src_proc)
@@ -727,13 +727,13 @@ static XBT_INLINE void SIMIX_comm_start(smx_synchro_t synchro)
   /* If both the sender and the receiver are already there, start the communication */
   if (synchro->state == SIMIX_READY) {
 
-    smx_host_t sender = synchro->comm.src_proc->smx_host;
-    smx_host_t receiver = synchro->comm.dst_proc->smx_host;
+    sg_host_t sender = synchro->comm.src_proc->host;
+    sg_host_t receiver = synchro->comm.dst_proc->host;
 
     XBT_DEBUG("Starting communication %p from '%s' to '%s'", synchro,
               SIMIX_host_get_name(sender), SIMIX_host_get_name(receiver));
 
-    synchro->comm.surf_comm = surf_host_model_communicate(surf_host_model,
+    synchro->comm.surf_comm = surf_network_model_communicate(surf_network_model,
                                                                    sender, receiver,
                                                                    synchro->comm.task_size, synchro->comm.rate);
 
@@ -757,10 +757,10 @@ static XBT_INLINE void SIMIX_comm_start(smx_synchro_t synchro)
 
       if (SIMIX_process_is_suspended(synchro->comm.src_proc))
         XBT_DEBUG("The communication is suspended on startup because src (%s:%s) were suspended since it initiated the communication",
-                  SIMIX_host_get_name(synchro->comm.src_proc->smx_host), synchro->comm.src_proc->name);
+                  SIMIX_host_get_name(synchro->comm.src_proc->host), synchro->comm.src_proc->name);
       else
         XBT_DEBUG("The communication is suspended on startup because dst (%s:%s) were suspended since it initiated the communication",
-                  SIMIX_host_get_name(synchro->comm.dst_proc->smx_host), synchro->comm.dst_proc->name);
+                  SIMIX_host_get_name(synchro->comm.dst_proc->host), synchro->comm.dst_proc->name);
 
       surf_action_suspend(synchro->comm.surf_comm);
 
@@ -801,7 +801,7 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
     /* Check out for errors */
 
     if (surf_host_get_state(surf_host_resource_priv(
-          simcall->issuer->smx_host)) != SURF_RESOURCE_ON) {
+          simcall->issuer->host)) != SURF_RESOURCE_ON) {
       simcall->issuer->context->iwannadie = 1;
       SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
     } else
@@ -843,8 +843,8 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
 
       XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) detached:%d",
                 synchro,
-                synchro->comm.src_proc ? sg_host_name(synchro->comm.src_proc->smx_host) : NULL,
-                synchro->comm.dst_proc ? sg_host_name(synchro->comm.dst_proc->smx_host) : NULL,
+                synchro->comm.src_proc ? sg_host_name(synchro->comm.src_proc->host) : NULL,
+                synchro->comm.dst_proc ? sg_host_name(synchro->comm.dst_proc->host) : NULL,
                 simcall->issuer->name, simcall->issuer, synchro->comm.detached);
       if (synchro->comm.src_proc == simcall->issuer) {
         XBT_DEBUG("I'm source");
@@ -879,7 +879,7 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
       }
     }
 
-    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->smx_host)) != SURF_RESOURCE_ON) {
+    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->host)) != SURF_RESOURCE_ON) {
       simcall->issuer->context->iwannadie = 1;
     }
 
@@ -1103,9 +1103,9 @@ void SIMIX_comm_copy_data(smx_synchro_t comm)
 
   XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",
             comm,
-            comm->comm.src_proc ? sg_host_name(comm->comm.src_proc->smx_host) : "a finished process",
+            comm->comm.src_proc ? sg_host_name(comm->comm.src_proc->host) : "a finished process",
             comm->comm.src_buff,
-            comm->comm.dst_proc ? sg_host_name(comm->comm.dst_proc->smx_host) : "a finished process",
+            comm->comm.dst_proc ? sg_host_name(comm->comm.dst_proc->host) : "a finished process",
             comm->comm.dst_buff, buff_size);
 
   /* Copy at most dst_buff_size bytes of the message to receiver's buffer */
index 6ea862d..6ea4fd9 100644 (file)
@@ -30,7 +30,7 @@ smx_rdv_t SIMIX_rdv_create(const char *name);
 void SIMIX_rdv_destroy(smx_rdv_t rdv);
 smx_rdv_t SIMIX_rdv_get_by_name(const char *name);
 void SIMIX_rdv_remove(smx_rdv_t rdv, smx_synchro_t comm);
-int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host);
+int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, sg_host_t host);
 smx_synchro_t SIMIX_rdv_get_head(smx_rdv_t rdv);
 void SIMIX_rdv_set_receiver(smx_rdv_t rdv, smx_process_t proc);
 smx_process_t SIMIX_rdv_get_receiver(smx_rdv_t rdv);
index afc5e64..593cf07 100644 (file)
@@ -50,7 +50,7 @@ typedef struct s_smx_global {
   /** Callback used when killing a SMX_process */
   void_pfn_smxprocess_t cleanup_process_function;
   xbt_mallocator_t synchro_mallocator;
-  void_pfn_smxhost_t autorestart;
+  void_pfn_sghost_t autorestart;
 
 #ifdef TIME_BENCH_AMDAHL
   xbt_os_timer_t timer_seq; /* used to bench the sequential and parallel parts of the simulation, if requested to */
@@ -131,7 +131,7 @@ typedef struct s_smx_synchro {
   union {
 
     struct {
-      smx_host_t host;                /* The host where the execution takes place */
+      sg_host_t host;                /* The host where the execution takes place */
       surf_action_t surf_exec;        /* The Surf execution action encapsulated */
     } execution; /* Possibly parallel execution */
 
@@ -174,7 +174,7 @@ typedef struct s_smx_synchro {
     } comm;
 
     struct {
-      smx_host_t host;                /* The host that is sleeping */
+      sg_host_t host;                /* The host that is sleeping */
       surf_action_t surf_sleep;       /* The Surf sleeping action encapsulated */
     } sleep;
 
@@ -183,7 +183,7 @@ typedef struct s_smx_synchro {
     } synchro;
 
     struct {
-      smx_host_t host;
+      sg_host_t host;
       surf_action_t surf_io;
     } io;
   };
index f91a7a2..b09039c 100644 (file)
@@ -96,7 +96,7 @@ void SIMIX_process_cleanup(smx_process_t process)
 
   XBT_DEBUG("%p should not be run anymore",process);
   xbt_swag_remove(process, simix_global->process_list);
-  xbt_swag_remove(process, SIMIX_host_priv(process->smx_host)->process_list);
+  xbt_swag_remove(process, sg_host_simix(process->host)->process_list);
   xbt_swag_insert(process, simix_global->process_to_destroy);
   process->context->iwannadie = 0;
 
@@ -163,14 +163,14 @@ void SIMIX_process_stop(smx_process_t arg) {
   /* Add the process to the list of process to restart, only if
    * the host is down
    */
-  if (arg->auto_restart && !SIMIX_host_get_state(arg->smx_host)) {
-    SIMIX_host_add_auto_restart_process(arg->smx_host,arg->name,arg->code, arg->data,
-                                        sg_host_name(arg->smx_host),
+  if (arg->auto_restart && !SIMIX_host_get_state(arg->host)) {
+    SIMIX_host_add_auto_restart_process(arg->host,arg->name,arg->code, arg->data,
+                                        sg_host_name(arg->host),
                                         SIMIX_timer_get_date(arg->kill_timer),
                                         arg->argc,arg->argv,arg->properties,
                                         arg->auto_restart);
   }
-  XBT_DEBUG("Process %s (%s) is dead",arg->name,sg_host_name(arg->smx_host));
+  XBT_DEBUG("Process %s (%s) is dead",arg->name,sg_host_name(arg->host));
   /* stop the context */
   SIMIX_context_stop(arg->context);
 }
@@ -182,8 +182,7 @@ void SIMIX_process_stop(smx_process_t arg) {
  */
 smx_process_t SIMIX_process_create_from_wrapper(smx_process_arg_t args) {
 
-  smx_process_t process;
-  simix_global->create_process_function(&process,
+  smx_process_t process = simix_global->create_process_function(
                                         args->name,
                                         args->code,
                                         args->data,
@@ -199,8 +198,7 @@ smx_process_t SIMIX_process_create_from_wrapper(smx_process_arg_t args) {
 }
 
 
-void simcall_HANDLER_process_create(smx_simcall_t simcall,
-                         smx_process_t *process,
+void* simcall_HANDLER_process_create(smx_simcall_t simcall,
                           const char *name,
                           xbt_main_func_t code,
                           void *data,
@@ -209,7 +207,7 @@ void simcall_HANDLER_process_create(smx_simcall_t simcall,
                           int argc, char **argv,
                           xbt_dict_t properties,
                           int auto_restart){
-  SIMIX_process_create(process, name, code, data, hostname,
+  return (void*)SIMIX_process_create(name, code, data, hostname,
                        kill_time, argc, argv, properties, auto_restart,
                        simcall->issuer);
 }
@@ -222,7 +220,7 @@ void simcall_HANDLER_process_create(smx_simcall_t simcall,
  *
  * \return the process created
  */
-void SIMIX_process_create(smx_process_t *process,
+smx_process_t SIMIX_process_create(
                           const char *name,
                           xbt_main_func_t code,
                           void *data,
@@ -233,8 +231,8 @@ void SIMIX_process_create(smx_process_t *process,
                           int auto_restart,
                           smx_process_t parent_process)
 {
-  *process = NULL;
-  smx_host_t host = SIMIX_host_get_by_name(hostname);
+  smx_process_t process = NULL;
+  sg_host_t host = sg_host_by_name(hostname);
 
   XBT_DEBUG("Start process %s on host '%s'", name, hostname);
 
@@ -247,60 +245,60 @@ void SIMIX_process_create(smx_process_t *process,
     xbt_free(argv);
   }
   else {
-    *process = xbt_new0(s_smx_process_t, 1);
+    process = xbt_new0(s_smx_process_t, 1);
 
     xbt_assert(((code != NULL) && (host != NULL)), "Invalid parameters");
     /* Process data */
-    (*process)->pid = simix_process_maxpid++;
-    (*process)->name = xbt_strdup(name);
-    (*process)->smx_host = host;
-    (*process)->data = data;
-    (*process)->comms = xbt_fifo_new();
-    (*process)->simcall.issuer = *process;
+    process->pid = simix_process_maxpid++;
+    process->name = xbt_strdup(name);
+    process->host = host;
+    process->data = data;
+    process->comms = xbt_fifo_new();
+    process->simcall.issuer = process;
 
      if (parent_process) {
-       (*process)->ppid = SIMIX_process_get_PID(parent_process);
+       process->ppid = SIMIX_process_get_PID(parent_process);
      } else {
-       (*process)->ppid = -1;
+       process->ppid = -1;
      }
 
     /* Process data for auto-restart */
-    (*process)->auto_restart = auto_restart;
-    (*process)->code = code;
-    (*process)->argc = argc;
-    (*process)->argv = argv;
+    process->auto_restart = auto_restart;
+    process->code = code;
+    process->argc = argc;
+    process->argv = argv;
 
 
-    XBT_VERB("Create context %s", (*process)->name);
-    (*process)->context = SIMIX_context_new(code, argc, argv,
-      simix_global->cleanup_process_function, *process);
+    XBT_VERB("Create context %s", process->name);
+    process->context = SIMIX_context_new(code, argc, argv, simix_global->cleanup_process_function, process);
 
-    (*process)->running_ctx = xbt_new(xbt_running_ctx_t, 1);
-    XBT_RUNNING_CTX_INITIALIZE((*process)->running_ctx);
+    process->running_ctx = xbt_new(xbt_running_ctx_t, 1);
+    XBT_RUNNING_CTX_INITIALIZE(process->running_ctx);
 
     if(MC_is_active()){
-      MC_ignore_heap((*process)->running_ctx, sizeof(*(*process)->running_ctx));
+      MC_ignore_heap(process->running_ctx, sizeof(*process->running_ctx));
     }
 
     /* Add properties */
-    (*process)->properties = properties;
+    process->properties = properties;
 
     /* Add the process to it's host process list */
-    xbt_swag_insert(*process, SIMIX_host_priv(host)->process_list);
+    xbt_swag_insert(process, sg_host_simix(host)->process_list);
 
-    XBT_DEBUG("Start context '%s'", (*process)->name);
+    XBT_DEBUG("Start context '%s'", process->name);
 
     /* Now insert it in the global process list and in the process to run list */
-    xbt_swag_insert(*process, simix_global->process_list);
-    XBT_DEBUG("Inserting %s(%s) in the to_run list", (*process)->name, sg_host_name(host));
-    xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, *process);
+    xbt_swag_insert(process, simix_global->process_list);
+    XBT_DEBUG("Inserting %s(%s) in the to_run list", process->name, sg_host_name(host));
+    xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
 
     if (kill_time > SIMIX_get_clock() && simix_global->kill_process_function) {
-      XBT_DEBUG("Process %s(%s) will be kill at time %f", (*process)->name,
-          sg_host_name((*process)->smx_host), kill_time);
-      (*process)->kill_timer = SIMIX_timer_set(kill_time, simix_global->kill_process_function, *process);
+      XBT_DEBUG("Process %s(%s) will be kill at time %f", process->name,
+          sg_host_name(process->host), kill_time);
+      process->kill_timer = SIMIX_timer_set(kill_time, simix_global->kill_process_function, process);
     }
   }
+  return process;
 }
 
 /**
@@ -336,7 +334,7 @@ void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_process_t process)
  */
 void SIMIX_process_kill(smx_process_t process, smx_process_t issuer) {
 
-  XBT_DEBUG("Killing process %s on %s", process->name, sg_host_name(process->smx_host));
+  XBT_DEBUG("Killing process %s on %s", process->name, sg_host_name(process->host));
 
   process->context->iwannadie = 1;
   process->blocked = 0;
@@ -350,7 +348,7 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t issuer) {
 
     case SIMIX_SYNC_EXECUTE:
     case SIMIX_SYNC_PARALLEL_EXECUTE:
-      SIMIX_host_execution_destroy(process->waiting_synchro);
+      SIMIX_process_execution_destroy(process->waiting_synchro);
       break;
 
     case SIMIX_SYNC_COMMUNICATE:
@@ -407,7 +405,7 @@ void SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, int value, con
 
     case SIMIX_SYNC_EXECUTE:
     case SIMIX_SYNC_PARALLEL_EXECUTE:
-      SIMIX_host_execution_cancel(process->waiting_synchro);
+      SIMIX_process_execution_cancel(process->waiting_synchro);
       break;
 
     case SIMIX_SYNC_COMMUNICATE:
@@ -464,17 +462,17 @@ void SIMIX_process_killall(smx_process_t issuer, int reset_pid)
 }
 
 void simcall_HANDLER_process_change_host(smx_simcall_t simcall, smx_process_t process,
-                                  smx_host_t dest)
+                                  sg_host_t dest)
 {
   process->new_host = dest;
 }
 void SIMIX_process_change_host(smx_process_t process,
-             smx_host_t dest)
+             sg_host_t dest)
 {
   xbt_assert((process != NULL), "Invalid parameters");
-  xbt_swag_remove(process, SIMIX_host_priv(process->smx_host)->process_list);
-  process->smx_host = dest;
-  xbt_swag_insert(process, SIMIX_host_priv(dest)->process_list);
+  xbt_swag_remove(process, sg_host_simix(process->host)->process_list);
+  process->host = dest;
+  xbt_swag_insert(process, sg_host_simix(dest)->process_list);
 }
 
 
@@ -540,7 +538,7 @@ smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer)
     }
   } else {
     /* FIXME: computation size is zero. Is it okay that bound is zero ? */
-    return SIMIX_host_execute("suspend", process->smx_host, 0.0, 1.0, 0.0, 0);
+    return SIMIX_process_execute(process, "suspend", 0.0, 1.0, 0.0, 0);
   }
 }
 
@@ -646,9 +644,9 @@ void SIMIX_process_set_data(smx_process_t process, void *data)
   process->data = data;
 }
 
-smx_host_t SIMIX_process_get_host(smx_process_t process)
+sg_host_t SIMIX_process_get_host(smx_process_t process)
 {
-  return process->smx_host;
+  return process->host;
 }
 
 /* needs to be public and without simcall because it is called
@@ -743,7 +741,7 @@ void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration)
 smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration)
 {
   smx_synchro_t synchro;
-  smx_host_t host = process->smx_host;
+  sg_host_t host = process->host;
 
   /* check if the host is active */
   if (surf_host_get_state(surf_host_resource_priv(host)) != SURF_RESOURCE_ON) {
@@ -788,7 +786,7 @@ void SIMIX_post_process_sleep(smx_synchro_t synchro)
         THROW_IMPOSSIBLE;
         break;
     }
-    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->smx_host)) != SURF_RESOURCE_ON) {
+    if (surf_host_get_state(surf_host_resource_priv(simcall->issuer->host)) != SURF_RESOURCE_ON) {
       simcall->issuer->context->iwannadie = 1;
     }
     simcall_process_sleep__set__result(simcall, state);
@@ -964,12 +962,12 @@ smx_process_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_process
 }
 /** @brief Restart a process, starting it again from the beginning. */
 smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer) {
-  XBT_DEBUG("Restarting process %s on %s", process->name, sg_host_name(process->smx_host));
+  XBT_DEBUG("Restarting process %s on %s", process->name, sg_host_name(process->host));
   //retrieve the arguments of the old process
   //FIXME: Factorize this with SIMIX_host_add_auto_restart_process ?
   s_smx_process_arg_t arg;
   arg.code = process->code;
-  arg.hostname = sg_host_name(process->smx_host);
+  arg.hostname = sg_host_name(process->host);
   arg.kill_time = SIMIX_timer_get_date(process->kill_timer);
   arg.argc = process->argc;
   arg.data = process->data;
@@ -986,7 +984,7 @@ smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer)
   //start the new process
   smx_process_t new_process;
   if (simix_global->create_process_function) {
-    simix_global->create_process_function(&new_process,
+    new_process = simix_global->create_process_function(
                                           arg.argv[0],
                                           arg.code,
                                           arg.data,
@@ -998,7 +996,7 @@ smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer)
                                           arg.auto_restart,
                                           NULL);
   } else {
-    simcall_process_create(&new_process,
+    new_process = simcall_process_create(
                            arg.argv[0],
                            arg.code,
                            arg.data,
index af4d470..1aadc50 100644 (file)
@@ -39,7 +39,7 @@ typedef struct s_smx_process {
   unsigned long pid;
   unsigned long ppid;
   char *name;                   /**< @brief process name if any */
-  smx_host_t smx_host;          /* the host on which the process is running */
+  sg_host_t host;          /* the host on which the process is running */
   smx_context_t context;        /* the context (uctx/raw/thread) that executes the user function */
   xbt_running_ctx_t *running_ctx;
   unsigned doexception:1;
@@ -47,7 +47,7 @@ typedef struct s_smx_process {
   unsigned suspended:1;
   unsigned auto_restart:1;
 
-  smx_host_t new_host;          /* if not null, the host on which the process must migrate to */
+  sg_host_t new_host;          /* if not null, the host on which the process must migrate to */
   smx_synchro_t waiting_synchro;  /* the current blocking synchro if any */
   xbt_fifo_t comms;       /* the current non-blocking communication synchros */
   xbt_dict_t properties;
@@ -62,7 +62,7 @@ typedef struct s_smx_process {
 } s_smx_process_t;
 
 
-void SIMIX_process_create(smx_process_t *process,
+smx_process_t SIMIX_process_create(
                           const char *name,
                           xbt_main_func_t code,
                           void *data,
@@ -84,14 +84,14 @@ void SIMIX_process_yield(smx_process_t self);
 xbt_running_ctx_t *SIMIX_process_get_running_context(void);
 void SIMIX_process_exception_terminate(xbt_ex_t * e);
 void SIMIX_process_change_host(smx_process_t process,
-             smx_host_t dest);
+             sg_host_t dest);
 smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer);
 void SIMIX_process_resume(smx_process_t process, smx_process_t issuer);
 int SIMIX_process_get_PID(smx_process_t self);
 int SIMIX_process_get_PPID(smx_process_t self);
 void* SIMIX_process_get_data(smx_process_t process);
 void SIMIX_process_set_data(smx_process_t process, void *data);
-smx_host_t SIMIX_process_get_host(smx_process_t process);
+sg_host_t SIMIX_process_get_host(smx_process_t process);
 const char* SIMIX_process_get_name(smx_process_t process);
 smx_process_t SIMIX_process_get_by_name(const char* name);
 int SIMIX_process_is_suspended(smx_process_t process);
index 8b05de1..a9d9219 100644 (file)
@@ -11,7 +11,7 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_synchro, simix,
                                 "SIMIX Synchronization (mutex, semaphores and conditions)");
 
-static smx_synchro_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout);
+static smx_synchro_t SIMIX_synchro_wait(sg_host_t smx_host, double timeout);
 static void SIMIX_synchro_finish(smx_synchro_t synchro);
 static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout,
                              smx_process_t issuer, smx_simcall_t simcall);
@@ -20,7 +20,7 @@ static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer,
 
 /***************************** Raw synchronization *********************************/
 
-static smx_synchro_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout)
+static smx_synchro_t SIMIX_synchro_wait(sg_host_t smx_host, double timeout)
 {
   XBT_IN("(%p, %f)",smx_host,timeout);
 
@@ -154,7 +154,7 @@ void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex)
   if (mutex->locked) {
     /* FIXME: check if the host is active ? */
     /* Somebody using the mutex, use a synchronization to get host failures */
-    synchro = SIMIX_synchro_wait(process->smx_host, -1);
+    synchro = SIMIX_synchro_wait(process->host, -1);
     xbt_fifo_push(synchro->simcalls, simcall);
     simcall->issuer->waiting_synchro = synchro;
     xbt_swag_insert(simcall->issuer, mutex->sleeping);   
@@ -309,7 +309,7 @@ static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout,
     SIMIX_mutex_unlock(mutex, issuer);
   }
 
-  synchro = SIMIX_synchro_wait(issuer->smx_host, timeout);
+  synchro = SIMIX_synchro_wait(issuer->host, timeout);
   xbt_fifo_unshift(synchro->simcalls, simcall);
   issuer->waiting_synchro = synchro;
   xbt_swag_insert(simcall->issuer, cond->sleeping);   
@@ -473,7 +473,7 @@ static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer,
 
   XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout);
   if (sem->value <= 0) {
-    synchro = SIMIX_synchro_wait(issuer->smx_host, timeout);
+    synchro = SIMIX_synchro_wait(issuer->host, timeout);
     xbt_fifo_unshift(synchro->simcalls, simcall);
     issuer->waiting_synchro = synchro;
     xbt_swag_insert(issuer, sem->sleeping);
index 0ee280f..a2e9831 100644 (file)
@@ -20,24 +20,24 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_vm, simix, "Logging specific to SIMIX (vms
  * \param name name of the host to create
  * \param data some user data (may be NULL)
  */
-smx_host_t SIMIX_vm_create(const char *name, smx_host_t ind_phys_host)
+sg_host_t SIMIX_vm_create(const char *name, sg_host_t ind_phys_host)
 {
   /* Create surf associated resource */
   surf_vm_model_create(name, ind_phys_host);
 
-  smx_host_t smx_host = SIMIX_host_create(name, NULL);
+  SIMIX_host_create(name);
 
   /* We will be able to register the VM to its physical host, so that we can promptly
    * retrieve the list VMs on the physical host. */
 
-  return smx_host;
+  return sg_host_by_name(name);
 }
 
 
 /* works for VMs and PMs */
-static long host_get_ramsize(smx_host_t vm, int *overcommit)
+static long host_get_ramsize(sg_host_t vm, int *overcommit)
 {
-  s_ws_params_t params;
+  s_vm_params_t params;
   surf_host_get_params(vm, &params);
 
   if (overcommit)
@@ -47,9 +47,9 @@ static long host_get_ramsize(smx_host_t vm, int *overcommit)
 }
 
 /* **** start a VM **** */
-static int __can_be_started(smx_host_t vm)
+static int __can_be_started(sg_host_t vm)
 {
-  smx_host_t pm = surf_vm_get_pm(vm);
+  sg_host_t pm = surf_vm_get_pm(vm);
 
   int pm_overcommit = 0;
   long pm_ramsize = host_get_ramsize(pm, &pm_overcommit);
@@ -69,7 +69,7 @@ static int __can_be_started(smx_host_t vm)
   xbt_dynar_t dyn_vms = surf_host_get_vms(pm);
   {
     unsigned int cursor = 0;
-    smx_host_t another_vm;
+    sg_host_t another_vm;
     xbt_dynar_foreach(dyn_vms, cursor, another_vm) {
       long another_vm_ramsize = host_get_ramsize(vm, NULL);
       total_ramsize_of_vms += another_vm_ramsize;
@@ -87,7 +87,7 @@ static int __can_be_started(smx_host_t vm)
        return 1;
 }
 
-void SIMIX_vm_start(smx_host_t ind_vm)
+void SIMIX_vm_start(sg_host_t ind_vm)
 {
   if (__can_be_started(ind_vm))
     surf_host_set_state(surf_host_resource_priv(ind_vm),
@@ -97,7 +97,7 @@ void SIMIX_vm_start(smx_host_t ind_vm)
 }
 
 
-int SIMIX_vm_get_state(smx_host_t ind_vm)
+int SIMIX_vm_get_state(sg_host_t ind_vm)
 {
   return surf_host_get_state(surf_host_resource_priv(ind_vm));
 }
@@ -105,9 +105,9 @@ int SIMIX_vm_get_state(smx_host_t ind_vm)
 /**
  * \brief Function to migrate a SIMIX VM host.
  *
- * \param host the vm host to migrate (a smx_host_t)
+ * \param host the vm host to migrate (a sg_host_t)
  */
-void SIMIX_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm)
+void SIMIX_vm_migrate(sg_host_t ind_vm, sg_host_t ind_dst_pm)
 {
   /* precopy migration makes the VM temporally paused */
   xbt_assert(SIMIX_vm_get_state(ind_vm) == SURF_VM_STATE_SUSPENDED);
@@ -129,7 +129,7 @@ void SIMIX_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm)
  * \param src_pm  Source physical host
  * \param dst_pmt Destination physical host
  */
-void SIMIX_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm)
+void SIMIX_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm)
 {
   /* deinstall the current affinity setting for the CPU */
   SIMIX_vm_set_affinity(vm, src_pm, 0);
@@ -145,9 +145,9 @@ void SIMIX_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t
 /**
  * \brief Function to get the physical host of the given SIMIX VM host.
  *
- * \param host the vm host to get_phys_host (a smx_host_t)
+ * \param host the vm host to get_phys_host (a sg_host_t)
  */
-void *SIMIX_vm_get_pm(smx_host_t ind_vm)
+void *SIMIX_vm_get_pm(sg_host_t ind_vm)
 {
   /* jump to vm_ws_get_pm(). this will return the vm name. */
   return surf_vm_get_pm(ind_vm);
@@ -156,10 +156,10 @@ void *SIMIX_vm_get_pm(smx_host_t ind_vm)
 /**
  * \brief Function to set the CPU bound of the given SIMIX VM host.
  *
- * \param host the vm host (a smx_host_t)
+ * \param host the vm host (a sg_host_t)
  * \param bound bound (a double)
  */
-void SIMIX_vm_set_bound(smx_host_t ind_vm, double bound)
+void SIMIX_vm_set_bound(sg_host_t ind_vm, double bound)
 {
   /* jump to vm_ws_set_vm_bound(). */
   surf_vm_set_bound(ind_vm, bound);
@@ -168,11 +168,11 @@ void SIMIX_vm_set_bound(smx_host_t ind_vm, double bound)
 /**
  * \brief Function to set the CPU affinity of the given SIMIX VM host.
  *
- * \param host the vm host (a smx_host_t)
- * \param host the pm host (a smx_host_t)
+ * \param host the vm host (a sg_host_t)
+ * \param host the pm host (a sg_host_t)
  * \param mask affinity mask (a unsigned long)
  */
-void SIMIX_vm_set_affinity(smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask)
+void SIMIX_vm_set_affinity(sg_host_t ind_vm, sg_host_t ind_pm, unsigned long mask)
 {
   /* make sure this at the MSG layer. */
   xbt_assert(SIMIX_vm_get_pm(ind_vm) == ind_pm);
@@ -187,22 +187,22 @@ void SIMIX_vm_set_affinity(smx_host_t ind_vm, smx_host_t ind_pm, unsigned long m
  * VM. All the processes on this VM will pause. The state of the VM is
  * preserved on memory. We can later resume it again.
  *
- * \param host the vm host to suspend (a smx_host_t)
+ * \param host the vm host to suspend (a sg_host_t)
  */
-void SIMIX_vm_suspend(smx_host_t ind_vm, smx_process_t issuer)
+void SIMIX_vm_suspend(sg_host_t ind_vm, smx_process_t issuer)
 {
   const char *name = SIMIX_host_get_name(ind_vm);
 
   if (SIMIX_vm_get_state(ind_vm) != SURF_VM_STATE_RUNNING)
     THROWF(vm_error, 0, "VM(%s) is not running", name);
 
-  XBT_DEBUG("suspend VM(%s), where %d processes exist", name, xbt_swag_size(SIMIX_host_priv(ind_vm)->process_list));
+  XBT_DEBUG("suspend VM(%s), where %d processes exist", name, xbt_swag_size(sg_host_simix(ind_vm)->process_list));
 
   /* jump to vm_ws_suspend. The state will be set. */
   surf_vm_suspend(ind_vm);
 
   smx_process_t smx_process, smx_process_safe;
-  xbt_swag_foreach_safe(smx_process, smx_process_safe, SIMIX_host_priv(ind_vm)->process_list) {
+  xbt_swag_foreach_safe(smx_process, smx_process_safe, sg_host_simix(ind_vm)->process_list) {
     XBT_DEBUG("suspend %s", smx_process->name);
     SIMIX_process_suspend(smx_process, issuer);
   }
@@ -210,9 +210,9 @@ void SIMIX_vm_suspend(smx_host_t ind_vm, smx_process_t issuer)
   XBT_DEBUG("suspend all processes on the VM done done");
 }
 
-void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm)
+void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, sg_host_t ind_vm)
 {
-  if (simcall->issuer->smx_host == ind_vm) {
+  if (simcall->issuer->host == ind_vm) {
     XBT_ERROR("cannot suspend the VM where I run");
     DIE_IMPOSSIBLE;
   }
@@ -227,28 +227,28 @@ void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm)
  * \brief Function to resume a SIMIX VM host. This function restart the execution of the
  * VM. All the processes on this VM will run again.
  *
- * \param host the vm host to resume (a smx_host_t)
+ * \param host the vm host to resume (a sg_host_t)
  */
-void SIMIX_vm_resume(smx_host_t ind_vm, smx_process_t issuer)
+void SIMIX_vm_resume(sg_host_t ind_vm, smx_process_t issuer)
 {
   const char *name = SIMIX_host_get_name(ind_vm);
 
   if (SIMIX_vm_get_state(ind_vm) != SURF_VM_STATE_SUSPENDED)
     THROWF(vm_error, 0, "VM(%s) was not suspended", name);
 
-  XBT_DEBUG("resume VM(%s), where %d processes exist", name, xbt_swag_size(SIMIX_host_priv(ind_vm)->process_list));
+  XBT_DEBUG("resume VM(%s), where %d processes exist", name, xbt_swag_size(sg_host_simix(ind_vm)->process_list));
 
   /* jump to vm_ws_resume() */
   surf_vm_resume(ind_vm);
 
   smx_process_t smx_process, smx_process_safe;
-  xbt_swag_foreach_safe(smx_process, smx_process_safe, SIMIX_host_priv(ind_vm)->process_list) {
+  xbt_swag_foreach_safe(smx_process, smx_process_safe, sg_host_simix(ind_vm)->process_list) {
     XBT_DEBUG("resume %s", smx_process->name);
     SIMIX_process_resume(smx_process, issuer);
   }
 }
 
-void simcall_HANDLER_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm)
+void simcall_HANDLER_vm_resume(smx_simcall_t simcall, sg_host_t ind_vm)
 {
   SIMIX_vm_resume(ind_vm, simcall->issuer);
 }
@@ -259,9 +259,9 @@ void simcall_HANDLER_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm)
  * This function is the same as vm_suspend, but the state of the VM is saved to the disk, and not preserved on memory.
  * We can later restore it again.
  *
- * \param host the vm host to save (a smx_host_t)
+ * \param host the vm host to save (a sg_host_t)
  */
-void SIMIX_vm_save(smx_host_t ind_vm, smx_process_t issuer)
+void SIMIX_vm_save(sg_host_t ind_vm, smx_process_t issuer)
 {
   const char *name = SIMIX_host_get_name(ind_vm);
 
@@ -269,19 +269,19 @@ void SIMIX_vm_save(smx_host_t ind_vm, smx_process_t issuer)
     THROWF(vm_error, 0, "VM(%s) is not running", name);
 
 
-  XBT_DEBUG("save VM(%s), where %d processes exist", name, xbt_swag_size(SIMIX_host_priv(ind_vm)->process_list));
+  XBT_DEBUG("save VM(%s), where %d processes exist", name, xbt_swag_size(sg_host_simix(ind_vm)->process_list));
 
   /* jump to vm_ws_save() */
   surf_vm_save(ind_vm);
 
   smx_process_t smx_process, smx_process_safe;
-  xbt_swag_foreach_safe(smx_process, smx_process_safe, SIMIX_host_priv(ind_vm)->process_list) {
+  xbt_swag_foreach_safe(smx_process, smx_process_safe, sg_host_simix(ind_vm)->process_list) {
     XBT_DEBUG("suspend %s", smx_process->name);
     SIMIX_process_suspend(smx_process, issuer);
   }
 }
 
-void simcall_HANDLER_vm_save(smx_simcall_t simcall, smx_host_t ind_vm)
+void simcall_HANDLER_vm_save(smx_simcall_t simcall, sg_host_t ind_vm)
 {
   SIMIX_vm_save(ind_vm, simcall->issuer);
 }
@@ -291,28 +291,28 @@ void simcall_HANDLER_vm_save(smx_simcall_t simcall, smx_host_t ind_vm)
  * \brief Function to restore a SIMIX VM host. This function restart the execution of the
  * VM. All the processes on this VM will run again.
  *
- * \param host the vm host to restore (a smx_host_t)
+ * \param host the vm host to restore (a sg_host_t)
  */
-void SIMIX_vm_restore(smx_host_t ind_vm, smx_process_t issuer)
+void SIMIX_vm_restore(sg_host_t ind_vm, smx_process_t issuer)
 {
   const char *name = SIMIX_host_get_name(ind_vm);
 
   if (SIMIX_vm_get_state(ind_vm) != SURF_VM_STATE_SAVED)
     THROWF(vm_error, 0, "VM(%s) was not saved", name);
 
-  XBT_DEBUG("restore VM(%s), where %d processes exist", name, xbt_swag_size(SIMIX_host_priv(ind_vm)->process_list));
+  XBT_DEBUG("restore VM(%s), where %d processes exist", name, xbt_swag_size(sg_host_simix(ind_vm)->process_list));
 
   /* jump to vm_ws_restore() */
   surf_vm_resume(ind_vm);
 
   smx_process_t smx_process, smx_process_safe;
-  xbt_swag_foreach_safe(smx_process, smx_process_safe, SIMIX_host_priv(ind_vm)->process_list) {
+  xbt_swag_foreach_safe(smx_process, smx_process_safe, sg_host_simix(ind_vm)->process_list) {
     XBT_DEBUG("resume %s", smx_process->name);
     SIMIX_process_resume(smx_process, issuer);
   }
 }
 
-void simcall_HANDLER_vm_restore(smx_simcall_t simcall, smx_host_t ind_vm)
+void simcall_HANDLER_vm_restore(smx_simcall_t simcall, sg_host_t ind_vm)
 {
   SIMIX_vm_restore(ind_vm, simcall->issuer);
 }
@@ -323,9 +323,9 @@ void simcall_HANDLER_vm_restore(smx_simcall_t simcall, smx_host_t ind_vm)
  * VM. All the processes on this VM will be killed. But, the state of the VM is
  * preserved on memory. We can later start it again.
  *
- * \param host the vm host to shutdown (a smx_host_t)
+ * \param host the vm host to shutdown (a sg_host_t)
  */
-void SIMIX_vm_shutdown(smx_host_t ind_vm, smx_process_t issuer)
+void SIMIX_vm_shutdown(sg_host_t ind_vm, smx_process_t issuer)
 {
   const char *name = SIMIX_host_get_name(ind_vm);
 
@@ -333,10 +333,10 @@ void SIMIX_vm_shutdown(smx_host_t ind_vm, smx_process_t issuer)
     THROWF(vm_error, 0, "VM(%s) is not running", name);
 
   XBT_DEBUG("shutdown %s", name);
-  XBT_DEBUG("%d processes in the VM", xbt_swag_size(SIMIX_host_priv(ind_vm)->process_list));
+  XBT_DEBUG("%d processes in the VM", xbt_swag_size(sg_host_simix(ind_vm)->process_list));
 
   smx_process_t smx_process, smx_process_safe;
-  xbt_swag_foreach_safe(smx_process, smx_process_safe, SIMIX_host_priv(ind_vm)->process_list) {
+  xbt_swag_foreach_safe(smx_process, smx_process_safe, sg_host_simix(ind_vm)->process_list) {
     XBT_DEBUG("kill %s", smx_process->name);
     SIMIX_process_kill(smx_process, issuer);
   }
@@ -346,7 +346,7 @@ void SIMIX_vm_shutdown(smx_host_t ind_vm, smx_process_t issuer)
                           (int)SURF_VM_STATE_CREATED);
 }
 
-void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm)
+void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, sg_host_t ind_vm)
 {
   SIMIX_vm_shutdown(ind_vm, simcall->issuer);
 }
@@ -355,9 +355,9 @@ void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm)
 /**
  * \brief Function to destroy a SIMIX VM host.
  *
- * \param host the vm host to destroy (a smx_host_t)
+ * \param host the vm host to destroy (a sg_host_t)
  */
-void SIMIX_vm_destroy(smx_host_t ind_vm)
+void SIMIX_vm_destroy(sg_host_t ind_vm)
 {
   /* this code basically performs a similar thing like SIMIX_host_destroy() */
 
@@ -367,7 +367,7 @@ void SIMIX_vm_destroy(smx_host_t ind_vm)
   XBT_DEBUG("destroy %s", hostname);
 
   /* this will call the registered callback function, i.e., SIMIX_host_destroy().  */
-  xbt_lib_unset(host_lib, hostname, SIMIX_HOST_LEVEL, 1);
+  sg_host_simix_destroy(ind_vm);
 
   /* jump to vm_ws_destroy(). The surf level resource will be freed. */
   surf_vm_destroy(ind_vm);
index a67e636..2e70327 100644 (file)
@@ -153,12 +153,10 @@ void smpi_execute_(double *duration)
 
 void smpi_execute_flops(double flops) {
   smx_synchro_t action;
-  smx_host_t host;
-  host = SIMIX_host_self();
   XBT_DEBUG("Handle real computation time: %f flops", flops);
-  action = simcall_host_execute("computation", host, flops, 1, 0, 0);
+  action = simcall_process_execute("computation", flops, 1, 0, 0);
   simcall_set_category (action, TRACE_internal_smpi_get_category());
-  simcall_host_execution_wait(action);
+  simcall_process_execution_wait(action);
   smpi_switch_data_segment(smpi_process_index());
 }
 
index d5fb355..d7a4faf 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_cas, surf_cpu,
                                 "Logging specific to the SURF CPU IMPROVED module");
 
-/*************
- * CallBacks *
- *************/
-
-static void cpu_define_callbacks()
-{
-  sg_platf_host_add_cb(cpu_parse_init);
-  sg_platf_postparse_add_cb(cpu_add_traces);
-}
-
 /*********
  * Model *
  *********/
@@ -40,14 +30,16 @@ void surf_cpu_model_init_Cas01()
   surf_cpu_model_pm = new CpuCas01Model();
   surf_cpu_model_vm  = new CpuCas01Model();
 
-  cpu_define_callbacks();
-  ModelPtr model_pm = surf_cpu_model_pm;
-  ModelPtr model_vm = surf_cpu_model_vm;
+  sg_platf_host_add_cb(cpu_parse_init);
+  sg_platf_postparse_add_cb(cpu_add_traces);
+
+  Model *model_pm = surf_cpu_model_pm;
+  Model *model_vm = surf_cpu_model_vm;
   xbt_dynar_push(model_list, &model_pm);
   xbt_dynar_push(model_list, &model_vm);
 }
 
-CpuCas01Model::CpuCas01Model() : CpuModel("cpu")
+CpuCas01Model::CpuCas01Model() : CpuModel()
 {
   char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim");
   int select = xbt_cfg_get_boolean(_sg_cfg_set, "cpu/maxmin_selective_update");
@@ -105,15 +97,16 @@ CpuCas01Model::~CpuCas01Model()
   delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
 }
 
-CpuPtr CpuCas01Model::createCpu(const char *name, xbt_dynar_t power_peak,
+Cpu *CpuCas01Model::createCpu(const char *name, xbt_dynar_t power_peak,
                                  int pstate, double power_scale,
                           tmgr_trace_t power_trace, int core,
                           e_surf_resource_state_t state_initial,
                           tmgr_trace_t state_trace,
                           xbt_dict_t cpu_properties)
 {
-  CpuPtr cpu = NULL;
-  xbt_assert(!surf_cpu_resource_priv(surf_cpu_resource_by_name(name)),
+  Cpu *cpu = NULL;
+  sg_host_t host = sg_host_by_name(name);
+  xbt_assert(!sg_host_surfcpu(host),
              "Host '%s' declared several times in the platform file",
              name);
   xbt_assert(xbt_dynar_getfirst_as(power_peak, double) > 0.0,
@@ -121,7 +114,7 @@ CpuPtr CpuCas01Model::createCpu(const char *name, xbt_dynar_t power_peak,
   xbt_assert(core > 0, "Invalid number of cores %d. Must be larger than 0", core);
 
   cpu = new CpuCas01(this, name, power_peak, pstate, power_scale, power_trace, core, state_initial, state_trace, cpu_properties);
-  xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
+  sg_host_surfcpu_set(host, cpu);
 
   return cpu;
 }
@@ -144,7 +137,7 @@ void CpuCas01Model::addTraces()
   /* connect all traces relative to hosts */
   xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    CpuCas01Ptr host = static_cast<CpuCas01Ptr>(surf_cpu_resource_priv(surf_cpu_resource_by_name(elm)));
+    CpuCas01 *host = static_cast<CpuCas01*>(sg_host_surfcpu(sg_host_by_name(elm)));
 
     xbt_assert(host, "Host %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -154,7 +147,7 @@ void CpuCas01Model::addTraces()
 
   xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    CpuCas01Ptr host = static_cast<CpuCas01Ptr>(surf_cpu_resource_priv(surf_cpu_resource_by_name(elm)));
+    CpuCas01 *host = static_cast<CpuCas01*>(sg_host_surfcpu(sg_host_by_name(elm)));
 
     xbt_assert(host, "Host %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -166,7 +159,7 @@ void CpuCas01Model::addTraces()
 /************
  * Resource *
  ************/
-CpuCas01::CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t powerPeak,
+CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t powerPeak,
                          int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
                          e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
                          xbt_dict_t properties)
@@ -235,7 +228,7 @@ void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double d
                               m_powerPeak);
     while ((var = lmm_get_var_from_cnst
             (getModel()->getMaxminSystem(), getConstraint(), &elem))) {
-      CpuCas01ActionPtr action = static_cast<CpuCas01ActionPtr>(lmm_variable_id(var));
+      CpuCas01Action *action = static_cast<CpuCas01Action*>(lmm_variable_id(var));
 
       lmm_update_variable_bound(getModel()->getMaxminSystem(),
                                 action->getVariable(),
@@ -257,7 +250,7 @@ void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double d
       setState(SURF_RESOURCE_OFF);
 
       while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), cnst, &elem))) {
-        ActionPtr action = static_cast<ActionPtr>(lmm_variable_id(var));
+        Action *action = static_cast<Action*>(lmm_variable_id(var));
 
         if (action->getState() == SURF_ACTION_RUNNING ||
             action->getState() == SURF_ACTION_READY ||
@@ -277,24 +270,24 @@ void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double d
   return;
 }
 
-CpuActionPtr CpuCas01::execute(double size)
+CpuAction *CpuCas01::execute(double size)
 {
 
   XBT_IN("(%s,%g)", getName(), size);
-  CpuCas01ActionPtr action = new CpuCas01Action(getModel(), size, getState() != SURF_RESOURCE_ON,
+  CpuCas01Action *action = new CpuCas01Action(getModel(), size, getState() != SURF_RESOURCE_ON,
                                                              m_powerScale * m_powerPeak, getConstraint());
 
   XBT_OUT();
   return action;
 }
 
-CpuActionPtr CpuCas01::sleep(double duration)
+CpuAction *CpuCas01::sleep(double duration)
 {
   if (duration > 0)
     duration = MAX(duration, sg_surf_precision);
 
   XBT_IN("(%s,%g)", getName(), duration);
-  CpuCas01ActionPtr action = new CpuCas01Action(getModel(), 1.0, getState() != SURF_RESOURCE_ON,
+  CpuCas01Action *action = new CpuCas01Action(getModel(), 1.0, getState() != SURF_RESOURCE_ON,
                                                       m_powerScale * m_powerPeak, getConstraint());
 
 
@@ -305,7 +298,7 @@ CpuActionPtr CpuCas01::sleep(double duration)
     /* Move to the *end* of the corresponding action set. This convention
        is used to speed up update_resource_state  */
        action->getStateSet()->erase(action->getStateSet()->iterator_to(*action));
-    action->p_stateSet = static_cast<CpuCas01ModelPtr>(getModel())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
+    action->p_stateSet = static_cast<CpuCas01Model*>(getModel())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
     action->getStateSet()->push_back(*action);
   }
 
@@ -360,7 +353,7 @@ int CpuCas01::getPstate()
  * Action *
  **********/
 
-CpuCas01Action::CpuCas01Action(ModelPtr model, double cost, bool failed, double power, lmm_constraint_t constraint)
+CpuCas01Action::CpuCas01Action(Model *model, double cost, bool failed, double power, lmm_constraint_t constraint)
  : CpuAction(model, cost, failed,
                     lmm_variable_new(model->getMaxminSystem(), this,
                     1.0, power, 1))
index b40cd04..a763abf 100644 (file)
  * Classes *
  ***********/
 class CpuCas01Model;
-typedef CpuCas01Model *CpuCas01ModelPtr;
-
 class CpuCas01;
-typedef CpuCas01 *CpuCas01Ptr;
-
 class CpuCas01Action;
-typedef CpuCas01Action *CpuCas01ActionPtr;
 
 /*********
  * Model *
@@ -29,7 +24,7 @@ public:
   double (CpuCas01Model::*shareResources)(double now);
   void (CpuCas01Model::*updateActionsState)(double now, double delta);
 
-  CpuPtr createCpu(const char *name, xbt_dynar_t power_peak, int pstate,
+  Cpu *createCpu(const char *name, xbt_dynar_t power_peak, int pstate,
                    double power_scale,
                           tmgr_trace_t power_trace, int core,
                           e_surf_resource_state_t state_initial,
@@ -37,7 +32,7 @@ public:
                           xbt_dict_t cpu_properties);
   double shareResourcesFull(double now);
   void addTraces();
-  ActionListPtr p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
+  ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
 };
 
 /************
@@ -46,14 +41,14 @@ public:
 
 class CpuCas01 : public Cpu {
 public:
-  CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t power_peak,
+  CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t power_peak,
         int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
         e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
        xbt_dict_t properties) ;
   ~CpuCas01();
   void updateState(tmgr_trace_event_t event_type, double value, double date);
-  CpuActionPtr execute(double size);
-  CpuActionPtr sleep(double duration);
+  CpuAction *execute(double size);
+  CpuAction *sleep(double duration);
 
   double getCurrentPowerPeak();
   double getPowerPeakAt(int pstate_index);
@@ -78,10 +73,10 @@ private:
  * Action *
  **********/
 class CpuCas01Action: public CpuAction {
-  friend CpuActionPtr CpuCas01::execute(double size);
-  friend CpuActionPtr CpuCas01::sleep(double duration);
+  friend CpuAction *CpuCas01::execute(double size);
+  friend CpuAction *CpuCas01::sleep(double duration);
 public:
-  CpuCas01Action(ModelPtr model, double cost, bool failed, double power,
+  CpuCas01Action(Model *model, double cost, bool failed, double power,
                  lmm_constraint_t constraint);
 
   ~CpuCas01Action() {};
index 906e07e..23929b0 100644 (file)
@@ -13,22 +13,22 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf,
 int autoload_surf_cpu_model = 1;
 void_f_void_t surf_cpu_model_init_preparse = NULL;
 
-CpuModelPtr surf_cpu_model_pm;
-CpuModelPtr surf_cpu_model_vm;
+CpuModel *surf_cpu_model_pm;
+CpuModel *surf_cpu_model_vm;
 /*************
  * Callbacks *
  *************/
 
-CpuPtr getActionCpu(CpuActionPtr action) {
-  return static_cast<CpuPtr>(lmm_constraint_id(lmm_get_cnst_from_var
+Cpu *getActionCpu(CpuAction *action) {
+  return static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var
                                         (action->getModel()->getMaxminSystem(),
                                         action->getVariable(), 0)));
 }
 
-surf_callback(void, CpuPtr) cpuCreatedCallbacks;
-surf_callback(void, CpuPtr) cpuDestructedCallbacks;
-surf_callback(void, CpuPtr, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks;
-surf_callback(void, CpuActionPtr, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks;
+surf_callback(void, Cpu*) cpuCreatedCallbacks;
+surf_callback(void, Cpu*) cpuDestructedCallbacks;
+surf_callback(void, Cpu*, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks;
+surf_callback(void, CpuAction*, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks;
 
 void cpu_parse_init(sg_platf_host_cbarg_t host){
   surf_cpu_model_pm->createCpu(
@@ -52,13 +52,13 @@ void cpu_add_traces(){
  *********/
 void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
 {
-  CpuActionPtr action;
+  CpuAction *action;
   while ((xbt_heap_size(getActionHeap()) > 0)
          && (double_equals(xbt_heap_maxkey(getActionHeap()), now, sg_surf_precision))) {
-    action = static_cast<CpuActionPtr>(xbt_heap_pop(getActionHeap()));
+    action = static_cast<CpuAction*>(xbt_heap_pop(getActionHeap()));
     XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
     if (TRACE_is_enabled()) {
-      CpuPtr cpu = static_cast<CpuPtr>(lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)));
+      Cpu *cpu = static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)));
       TRACE_surf_host_set_utilization(cpu->getName(), action->getCategory(),
                                       lmm_variable_getvalue(action->getVariable()),
                                       action->getLastUpdate(),
@@ -77,10 +77,10 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
     //defining the last timestamp that we can safely dump to trace file
     //without losing the event ascending order (considering all CPU's)
     double smaller = -1;
-    ActionListPtr actionSet = getRunningActionSet();
+    ActionList *actionSet = getRunningActionSet();
     for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end())
        ; it != itend ; ++it) {
-      action = static_cast<CpuActionPtr>(&*it);
+      action = static_cast<CpuAction*>(&*it);
         if (smaller < 0) {
           smaller = action->getLastUpdate();
           continue;
@@ -98,16 +98,15 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
 
 void CpuModel::updateActionsStateFull(double now, double delta)
 {
-  CpuActionPtr action = NULL;
-  ActionListPtr running_actions = getRunningActionSet();
+  CpuAction *action = NULL;
+  ActionList *running_actions = getRunningActionSet();
 
   for(ActionList::iterator it(running_actions->begin()), itNext=it, itend(running_actions->end())
      ; it != itend ; it=itNext) {
        ++itNext;
-    action = static_cast<CpuActionPtr>(&*it);
+    action = static_cast<CpuAction*>(&*it);
     if (TRACE_is_enabled()) {
-      CpuPtr x = (CpuPtr) lmm_constraint_id(lmm_get_cnst_from_var
-                              (getMaxminSystem(), action->getVariable(), 0));
+      Cpu *x = static_cast<Cpu*> (lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)) );
 
       TRACE_surf_host_set_utilization(x->getName(),
                                       action->getCategory(),
@@ -146,7 +145,7 @@ Cpu::Cpu(){
   surf_callback_emit(cpuCreatedCallbacks, this);
 }
 
-Cpu::Cpu(ModelPtr model, const char *name, xbt_dict_t props,
+Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
                 int core, double powerPeak, double powerScale)
  : Resource(model, name, props)
  , m_core(core)
@@ -158,7 +157,7 @@ Cpu::Cpu(ModelPtr model, const char *name, xbt_dict_t props,
   surf_callback_emit(cpuCreatedCallbacks, this);
 }
 
-Cpu::Cpu(ModelPtr model, const char *name, xbt_dict_t props,
+Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
                 lmm_constraint_t constraint, int core, double powerPeak, double powerScale)
  : Resource(model, name, props, constraint)
  , m_core(core)
@@ -246,7 +245,7 @@ void CpuAction::updateRemainingLazy(double now)
     double_update(&(m_remains), m_lastValue * delta, sg_maxmin_precision*sg_surf_precision);
 
     if (TRACE_is_enabled()) {
-      CpuPtr cpu = static_cast<CpuPtr>(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0)));
+      Cpu *cpu = static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0)));
       TRACE_surf_host_set_utilization(cpu->getName(), getCategory(), m_lastValue, m_lastUpdate, now - m_lastUpdate);
     }
     XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, m_remains);
@@ -276,7 +275,7 @@ void CpuAction::updateRemainingLazy(double now)
  * action object does not have the information about the location where the
  * action is being executed.
  */
-void CpuAction::setAffinity(CpuPtr cpu, unsigned long mask)
+void CpuAction::setAffinity(Cpu *cpu, unsigned long mask)
 {
   lmm_variable_t var_obj = getVariable();
   XBT_IN("(%p,%lx)", this, mask);
index a2dd954..595ff81 100644 (file)
  * Classes *
  ***********/
 class CpuModel;
-typedef CpuModel *CpuModelPtr;
-
 class Cpu;
-typedef Cpu *CpuPtr;
-
 class CpuAction;
-typedef CpuAction *CpuActionPtr;
-
 class CpuPlugin;
-typedef CpuPlugin *CpuPluginPtr;
 
 /*************
  * Callbacks *
  *************/
-XBT_PUBLIC(CpuPtr) getActionCpu(CpuActionPtr action);
+XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action);
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Cpu creation *
  * @details Callback functions have the following signature: `void(CpuPtr)`
  */
-XBT_PUBLIC_DATA( surf_callback(void, CpuPtr)) cpuCreatedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, Cpu*)) cpuCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Cpu destruction *
  * @details Callback functions have the following signature: `void(CpuPtr)`
  */
-XBT_PUBLIC_DATA( surf_callback(void, CpuPtr)) cpuDestructedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, Cpu*)) cpuDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Cpu State changed *
- * @details Callback functions have the following signature: `void(CpuActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
+ * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
  */
-XBT_PUBLIC_DATA( surf_callback(void, CpuPtr, e_surf_resource_state_t, e_surf_resource_state_t)) cpuStateChangedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, Cpu*, e_surf_resource_state_t, e_surf_resource_state_t)) cpuStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after CpuAction State changed *
- * @details Callback functions have the following signature: `void(CpuActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
+ * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
  */
-XBT_PUBLIC_DATA( surf_callback(void, CpuActionPtr, e_surf_action_state_t, e_surf_action_state_t)) cpuActionStateChangedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, CpuAction*, e_surf_action_state_t, e_surf_action_state_t)) cpuActionStateChangedCallbacks;
 
 XBT_PUBLIC(void) cpu_parse_init(sg_platf_host_cbarg_t host);
 
@@ -68,12 +61,8 @@ XBT_PUBLIC(void) cpu_add_traces();
  */
 XBT_PUBLIC_CLASS CpuModel : public Model {
 public:
-  /**
-   * @brief CpuModel constructor
-   *
-   * @param name The name of the model
-   */
-  CpuModel(const char *name) : Model(name) {};
+  /** @brief Constructor */
+  CpuModel() : Model() {};
 
   /**
    * @brief Create a Cpu
@@ -88,7 +77,7 @@ public:
    * @param state_trace [TODO]
    * @param cpu_properties Dictionary of properties associated to this Cpu
    */
-  virtual CpuPtr createCpu(const char *name, xbt_dynar_t power_peak,
+  virtual Cpu *createCpu(const char *name, xbt_dynar_t power_peak,
                       int pstate, double power_scale,
                           tmgr_trace_t power_trace, int core,
                           e_surf_resource_state_t state_initial,
@@ -97,6 +86,7 @@ public:
 
   void updateActionsStateLazy(double now, double delta);
   void updateActionsStateFull(double now, double delta);
+  bool shareResourcesIsIdempotent() {return true;}
 };
 
 /************
@@ -125,7 +115,7 @@ public:
    * @param powerPeak The power peak of this Cpu
    * @param powerScale The power scale of this Cpu
    */
-  Cpu(ModelPtr model, const char *name, xbt_dict_t props,
+  Cpu(Model *model, const char *name, xbt_dict_t props,
          lmm_constraint_t constraint, int core, double powerPeak, double powerScale);
 
   /**
@@ -138,7 +128,7 @@ public:
    * @param powerPeak The power peak of this Cpu in [TODO]
    * @param powerScale The power scale of this Cpu in [TODO]
    */
-  Cpu(ModelPtr model, const char *name, xbt_dict_t props,
+  Cpu(Model *model, const char *name, xbt_dict_t props,
          int core, double powerPeak, double powerScale);
 
   /**
@@ -152,7 +142,7 @@ public:
    * @param size The value of the processing amount (in flop) needed to process
    * @return The CpuAction corresponding to the processing
    */
-  virtual CpuActionPtr execute(double size)=0;
+  virtual CpuAction *execute(double size)=0;
 
   /**
    * @brief Make a process sleep for duration (in seconds)
@@ -160,7 +150,7 @@ public:
    * @param duration The number of seconds to sleep
    * @return The CpuAction corresponding to the sleeping
    */
-  virtual CpuActionPtr sleep(double duration)=0;
+  virtual CpuAction *sleep(double duration)=0;
 
   /**
    * @brief Get the number of cores of the current Cpu
@@ -223,7 +213,7 @@ public:
  * @details A CpuAction represent the execution of code on a Cpu
  */
 XBT_PUBLIC_CLASS CpuAction : public Action {
-friend XBT_PUBLIC(CpuPtr) getActionCpu(CpuActionPtr action);
+friend XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action);
 public:
   /**
    * @brief CpuAction constructor
@@ -232,7 +222,7 @@ public:
    * @param cost [TODO]
    * @param failed [TODO]
    */
-  CpuAction(ModelPtr model, double cost, bool failed)
+  CpuAction(Model *model, double cost, bool failed)
     : Action(model, cost, failed) {} //FIXME:REMOVE
 
   /**
@@ -243,7 +233,7 @@ public:
    * @param failed [TODO]
    * @param var The lmm variable associated to this CpuAction if it is part of a LMM component
    */
-  CpuAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
+  CpuAction(Model *model, double cost, bool failed, lmm_variable_t var)
     : Action(model, cost, failed, var) {}
 
   /**
@@ -253,7 +243,7 @@ public:
    * @param cpu [TODO]
    * @param mask [TODO]
    */
-  virtual void setAffinity(CpuPtr cpu, unsigned long mask);
+  virtual void setAffinity(Cpu *cpu, unsigned long mask);
 
   void setState(e_surf_action_state_t state);
 
index 81a156d..65bfcca 100644 (file)
@@ -395,16 +395,16 @@ void surf_cpu_model_init_ti()
   xbt_assert(!surf_cpu_model_vm,"CPU model already initialized. This should not happen.");
 
   surf_cpu_model_pm = new CpuTiModel();
-  surf_cpu_model_vm  = new CpuTiModel();
+  surf_cpu_model_vm = new CpuTiModel();
 
   cpu_ti_define_callbacks();
-  ModelPtr model_pm = static_cast<ModelPtr>(surf_cpu_model_pm);
-  ModelPtr model_vm = static_cast<ModelPtr>(surf_cpu_model_vm);
+  Model *model_pm = static_cast<Model*>(surf_cpu_model_pm);
+  Model *model_vm = static_cast<Model*>(surf_cpu_model_vm);
   xbt_dynar_push(model_list, &model_pm);
   xbt_dynar_push(model_list, &model_vm);
 }
 
-CpuTiModel::CpuTiModel() : CpuModel("cpu_ti")
+CpuTiModel::CpuTiModel() : CpuModel()
 {
   p_runningActionSetThatDoesNotNeedBeingChecked = new ActionList();
 
@@ -423,7 +423,7 @@ CpuTiModel::~CpuTiModel()
   xbt_heap_free(p_tiActionHeap);
 }
 
-CpuPtr CpuTiModel::createCpu(const char *name,
+Cpu *CpuTiModel::createCpu(const char *name,
                               xbt_dynar_t powerPeak,
                               int pstate,
                            double powerScale,
@@ -434,14 +434,15 @@ CpuPtr CpuTiModel::createCpu(const char *name,
                            xbt_dict_t cpuProperties)
 {
   xbt_assert(core==1,"Multi-core not handled with this model yet");
-  xbt_assert(!surf_cpu_resource_priv(surf_cpu_resource_by_name(name)),
+  sg_host_t host = sg_host_by_name(name);
+  xbt_assert(!sg_host_surfcpu(host),
               "Host '%s' declared several times in the platform file",
               name);
   xbt_assert(xbt_dynar_getfirst_as(powerPeak, double) > 0.0,
       "Power has to be >0.0. Did you forget to specify the mandatory power attribute?");
-  CpuTiPtr cpu = new CpuTi(this, name, powerPeak, pstate, powerScale, powerTrace,
+  CpuTi *cpu = new CpuTi(this, name, powerPeak, pstate, powerScale, powerTrace,
                           core, stateInitial, stateTrace, cpuProperties);
-  xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, static_cast<ResourcePtr>(cpu));
+  sg_host_surfcpu_set(host, cpu);
   return cpu;
 }
 
@@ -452,7 +453,7 @@ double CpuTiModel::shareResources(double now)
 /* iterates over modified cpus to update share resources */
   for(CpuTiList::iterator it(p_modifiedCpu->begin()), itend(p_modifiedCpu->end())
      ; it != itend ;) {
-    CpuTiPtr ti = &*it;
+    CpuTi *ti = &*it;
     ++it;
     ti->updateActionsFinishTime(now);
   }
@@ -470,7 +471,7 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/)
 {
   while ((xbt_heap_size(p_tiActionHeap) > 0)
          && (xbt_heap_maxkey(p_tiActionHeap) <= now)) {
-    CpuTiActionPtr action = (CpuTiActionPtr) xbt_heap_pop(p_tiActionHeap);
+    CpuTiAction *action = (CpuTiAction*) xbt_heap_pop(p_tiActionHeap);
     XBT_DEBUG("Action %p: finish", action);
     action->finish();
     /* set the remains to 0 due to precision problems when updating the remaining amount */
@@ -495,7 +496,7 @@ void CpuTiModel::addTraces()
 /* connect all traces relative to hosts */
   xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    CpuTiPtr cpu = static_cast<CpuTiPtr>(surf_cpu_resource_priv(surf_cpu_resource_by_name(elm)));
+    CpuTi *cpu = static_cast<CpuTi*>(sg_host_surfcpu(sg_host_by_name(elm)));
 
     xbt_assert(cpu, "Host %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -511,7 +512,7 @@ void CpuTiModel::addTraces()
 
   xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    CpuTiPtr cpu = static_cast<CpuTiPtr>(surf_cpu_resource_priv(surf_cpu_resource_by_name(elm)));
+    CpuTi *cpu = static_cast<CpuTi*>(sg_host_surfcpu(sg_host_by_name(elm)));
 
     xbt_assert(cpu, "Host %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -541,7 +542,7 @@ void CpuTiModel::addTraces()
 /************
  * Resource *
  ************/
-CpuTi::CpuTi(CpuTiModelPtr model, const char *name, xbt_dynar_t powerPeak,
+CpuTi::CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t powerPeak,
         int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
         e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
        xbt_dict_t properties)
@@ -589,11 +590,11 @@ CpuTi::~CpuTi(){
 void CpuTi::updateState(tmgr_trace_event_t event_type,
                         double value, double date)
 {
-  CpuTiActionPtr action;
+  CpuTiAction *action;
 
   if (event_type == p_powerEvent) {
     tmgr_trace_t power_trace;
-    CpuTiTgmrPtr trace;
+    CpuTiTgmr *trace;
     s_tmgr_event_t val;
 
     XBT_DEBUG("Finish trace date: %f value %f date %f", surf_get_clock(),
@@ -636,8 +637,8 @@ void CpuTi::updateState(tmgr_trace_event_t event_type,
           action->setFinishTime(date);
           action->setState(SURF_ACTION_FAILED);
           if (action->m_indexHeap >= 0) {
-            CpuTiActionPtr heap_act = (CpuTiActionPtr)
-                xbt_heap_remove(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action->m_indexHeap);
+            CpuTiAction *heap_act = (CpuTiAction*)
+                xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->p_tiActionHeap, action->m_indexHeap);
             if (heap_act != action)
               DIE_IMPOSSIBLE;
           }
@@ -656,7 +657,7 @@ void CpuTi::updateState(tmgr_trace_event_t event_type,
 
 void CpuTi::updateActionsFinishTime(double now)
 {
-  CpuTiActionPtr action;
+  CpuTiAction *action;
   double sum_priority = 0.0, total_area, min_finish = -1;
 
 /* update remaning amount of actions */
@@ -715,13 +716,13 @@ updateRemainingAmount(now);
     /* add in action heap */
     XBT_DEBUG("action(%p) index %d", action, action->m_indexHeap);
     if (action->m_indexHeap >= 0) {
-      CpuTiActionPtr heap_act = (CpuTiActionPtr)
-          xbt_heap_remove(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action->m_indexHeap);
+      CpuTiAction *heap_act = (CpuTiAction*)
+          xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->p_tiActionHeap, action->m_indexHeap);
       if (heap_act != action)
         DIE_IMPOSSIBLE;
     }
     if (min_finish != NO_MAX_DURATION)
-      xbt_heap_push(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action, min_finish);
+      xbt_heap_push(static_cast<CpuTiModel*>(getModel())->p_tiActionHeap, action, min_finish);
 
     XBT_DEBUG
         ("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f",
@@ -752,7 +753,7 @@ double CpuTi::getAvailableSpeed()
 void CpuTi::updateRemainingAmount(double now)
 {
   double area_total;
-  CpuTiActionPtr action;
+  CpuTiAction *action;
 
   /* already updated */
   if (m_lastUpdate >= now)
@@ -796,10 +797,10 @@ void CpuTi::updateRemainingAmount(double now)
   m_lastUpdate = now;
 }
 
-CpuActionPtr CpuTi::execute(double size)
+CpuAction *CpuTi::execute(double size)
 {
   XBT_IN("(%s,%g)", getName(), size);
-  CpuTiActionPtr action = new CpuTiAction(static_cast<CpuTiModelPtr>(getModel()), size, getState() != SURF_RESOURCE_ON, this);
+  CpuTiAction *action = new CpuTiAction(static_cast<CpuTiModel*>(getModel()), size, getState() != SURF_RESOURCE_ON, this);
 
   p_actionSet->push_back(*action);
 
@@ -808,13 +809,13 @@ CpuActionPtr CpuTi::execute(double size)
 }
 
 
-CpuActionPtr CpuTi::sleep(double duration)
+CpuAction *CpuTi::sleep(double duration)
 {
   if (duration > 0)
     duration = MAX(duration, sg_surf_precision);
 
   XBT_IN("(%s,%g)", getName(), duration);
-  CpuTiActionPtr action = new CpuTiAction(static_cast<CpuTiModelPtr>(getModel()), 1.0, getState() != SURF_RESOURCE_ON, this);
+  CpuTiAction *action = new CpuTiAction(static_cast<CpuTiModel*>(getModel()), 1.0, getState() != SURF_RESOURCE_ON, this);
 
   action->m_maxDuration = duration;
   action->m_suspended = 2;
@@ -822,7 +823,7 @@ CpuActionPtr CpuTi::sleep(double duration)
    /* Move to the *end* of the corresponding action set. This convention
       is used to speed up update_resource_state  */
        action->getStateSet()->erase(action->getStateSet()->iterator_to(*action));
-    action->p_stateSet = static_cast<CpuTiModelPtr>(getModel())->p_runningActionSetThatDoesNotNeedBeingChecked;
+    action->p_stateSet = static_cast<CpuTiModel*>(getModel())->p_runningActionSetThatDoesNotNeedBeingChecked;
     action->getStateSet()->push_back(*action);
   }
 
@@ -833,7 +834,7 @@ CpuActionPtr CpuTi::sleep(double duration)
 }
 
 void CpuTi::modified(bool modified){
-  CpuTiListPtr modifiedCpu = static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu;
+  CpuTiList *modifiedCpu = static_cast<CpuTiModel*>(getModel())->p_modifiedCpu;
   if (modified) {
     if (!is_linked()) {
       modifiedCpu->push_back(*this);
@@ -851,11 +852,11 @@ void CpuTi::modified(bool modified){
 
 static void cpu_ti_action_update_index_heap(void *action, int i)
 {
-((CpuTiActionPtr)action)->updateIndexHeap(i);
+((CpuTiAction*)action)->updateIndexHeap(i);
 }
 
-CpuTiAction::CpuTiAction(CpuTiModelPtr model_, double cost, bool failed,
-                                CpuTiPtr cpu)
+CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed,
+                                CpuTi *cpu)
  : CpuAction(model_, cost, failed)
 {
   m_suspended = 0;        /* Should be useless because of the
@@ -886,7 +887,7 @@ int CpuTiAction::unref()
     if (actionTiHook::is_linked())
       p_cpu->p_actionSet->erase(p_cpu->p_actionSet->iterator_to(*this));
     /* remove from heap */
-    xbt_heap_remove(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, this->m_indexHeap);
+    xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->p_tiActionHeap, this->m_indexHeap);
     p_cpu->modified(true);
     delete this;
     return 1;
@@ -902,11 +903,6 @@ void CpuTiAction::cancel()
   return;
 }
 
-void CpuTiAction::recycle()
-{
-  DIE_IMPOSSIBLE;
-}
-
 void CpuTiAction::suspend()
 {
   XBT_IN("(%p)", this);
@@ -949,7 +945,7 @@ void CpuTiAction::setMaxDuration(double duration)
 
 /* add in action heap */
   if (m_indexHeap >= 0) {
-    CpuTiActionPtr heap_act = (CpuTiActionPtr)
+    CpuTiAction *heap_act = (CpuTiAction*)
         xbt_heap_remove(getModel()->getActionHeap(), m_indexHeap);
     if (heap_act != this)
       DIE_IMPOSSIBLE;
index 80679ad..de57ece 100644 (file)
  * Classes *
  ***********/
 class CpuTiTrace;
-typedef CpuTiTrace *CpuTiTracePtr;
-
 class CpuTiTgmr;
-typedef CpuTiTgmr *CpuTiTgmrPtr;
-
 class CpuTiModel;
-typedef CpuTiModel *CpuTiModelPtr;
-
 class CpuTi;
-typedef CpuTi *CpuTiPtr;
-
 class CpuTiAction;
-typedef CpuTiAction *CpuTiActionPtr;
 
 typedef boost::intrusive::list<CpuTi> CpuTiList;
-typedef CpuTiList* CpuTiListPtr;
 typedef boost::intrusive::list_base_hook<> cpuTiHook;
 
 struct tiTag;
 typedef boost::intrusive::list<CpuTiAction, boost::intrusive::base_hook<boost::intrusive::list_base_hook<boost::intrusive::tag<tiTag> > > > ActionTiList;
-typedef ActionTiList* ActionTiListPtr;
 typedef boost::intrusive::list_base_hook<boost::intrusive::tag<tiTag> > actionTiHook;
 
 /*********
@@ -82,7 +71,7 @@ public:
   double m_lastTime;             /*< Integral interval last point (discret time) */
   double m_total;                 /*< Integral total between 0 and last_pointn */
 
-  CpuTiTracePtr p_trace;
+  CpuTiTrace *p_trace;
   tmgr_trace_t p_powerTrace;
 };
 
@@ -93,7 +82,7 @@ class CpuTiModel : public CpuModel {
 public:
   CpuTiModel();
   ~CpuTiModel();
-  CpuPtr createCpu(const char *name,  xbt_dynar_t powerPeak,
+  Cpu *createCpu(const char *name,  xbt_dynar_t powerPeak,
                           int pstate, double power_scale,
                           tmgr_trace_t power_trace, int core,
                           e_surf_resource_state_t state_initial,
@@ -103,17 +92,17 @@ public:
   void updateActionsState(double now, double delta);
   void addTraces();
 
-  ActionListPtr p_runningActionSetThatDoesNotNeedBeingChecked;
-  CpuTiListPtr p_modifiedCpu;
+  ActionList *p_runningActionSetThatDoesNotNeedBeingChecked;
+  CpuTiList *p_modifiedCpu;
   xbt_heap_t p_tiActionHeap;
 
 protected:
-  void NotifyResourceTurnedOn(ResourcePtr){};
-  void NotifyResourceTurnedOff(ResourcePtr){};
+  void NotifyResourceTurnedOn(Resource*){};
+  void NotifyResourceTurnedOff(Resource*){};
 
-  void NotifyActionCancel(ActionPtr){};
-  void NotifyActionResume(ActionPtr){};
-  void NotifyActionSuspend(ActionPtr){};
+  void NotifyActionCancel(Action*){};
+  void NotifyActionResume(Action*){};
+  void NotifyActionSuspend(Action*){};
 };
 
 /************
@@ -122,7 +111,7 @@ protected:
 class CpuTi : public cpuTiHook, public Cpu {
 public:
   CpuTi() {};
-  CpuTi(CpuTiModelPtr model, const char *name, xbt_dynar_t powerPeak,
+  CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t powerPeak,
         int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
         e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
        xbt_dict_t properties) ;
@@ -132,8 +121,8 @@ public:
   void updateActionsFinishTime(double now);
   bool isUsed();
   void printCpuTiModel();
-  CpuActionPtr execute(double size);
-  CpuActionPtr sleep(double duration);
+  CpuAction *execute(double size);
+  CpuAction *sleep(double duration);
   double getAvailableSpeed();
 
   double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
@@ -143,10 +132,10 @@ public:
   int  getPstate() { THROW_UNIMPLEMENTED;}
   void modified(bool modified);
 
-  CpuTiTgmrPtr p_availTrace;       /*< Structure with data needed to integrate trace file */
+  CpuTiTgmr *p_availTrace;       /*< Structure with data needed to integrate trace file */
   tmgr_trace_event_t p_stateEvent;       /*< trace file with states events (ON or OFF) */
   tmgr_trace_event_t p_powerEvent;       /*< trace file with availability events */
-  ActionTiListPtr p_actionSet;        /*< set with all actions running on cpu */
+  ActionTiList *p_actionSet;        /*< set with all actions running on cpu */
   double m_sumPriority;          /*< the sum of actions' priority that are running on cpu */
   double m_lastUpdate;           /*< last update of actions' remaining amount done */
 
@@ -160,19 +149,18 @@ public:
  **********/
 
 class CpuTiAction: public actionTiHook, public CpuAction {
-  friend CpuActionPtr CpuTi::execute(double size);
-  friend CpuActionPtr CpuTi::sleep(double duration);
+  friend CpuAction *CpuTi::execute(double size);
+  friend CpuAction *CpuTi::sleep(double duration);
   friend void CpuTi::updateActionsFinishTime(double now);//FIXME
   friend void CpuTi::updateRemainingAmount(double now);//FIXME
 
 public:
-  CpuTiAction(CpuTiModelPtr model, double cost, bool failed,
-                                CpuTiPtr cpu);
+  CpuTiAction(CpuTiModel *model, double cost, bool failed,
+                                CpuTi *cpu);
 
   void setState(e_surf_action_state_t state);
   int unref();
   void cancel();
-  void recycle();
   void updateIndexHeap(int i);
   void suspend();
   void resume();
@@ -180,9 +168,9 @@ public:
   void setMaxDuration(double duration);
   void setPriority(double priority);
   double getRemains();
-  void setAffinity(CpuPtr /*cpu*/, unsigned long /*mask*/) {};
+  void setAffinity(Cpu */*cpu*/, unsigned long /*mask*/) {};
 
-  CpuTiPtr p_cpu;
+  CpuTi *p_cpu;
   int m_indexHeap;
   int m_suspended;
 private:
index 920b915..6c348f7 100644 (file)
@@ -14,6 +14,7 @@
 #include "xbt/log.h"
 #include "xbt/asserts.h"
 #include "RngStream.h"
+#include <unistd.h> /* pipe */
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets_simulator, surf_network_gtnets,
                                 "Logging specific to the SURF network GTNetS simulator");
index 5c1a5d6..22fcb9c 100644 (file)
@@ -26,9 +26,8 @@ void surf_host_model_init_current_default(void)
   xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "yes");
   surf_cpu_model_init_Cas01();
   surf_network_model_init_LegrandVelho();
-  surf_host_model->p_cpuModel = surf_cpu_model_pm;
 
-  ModelPtr model = surf_host_model;
+  Model *model = surf_host_model;
   xbt_dynar_push(model_list, &model);
   xbt_dynar_push(model_list_invoke, &model);
   sg_platf_host_add_cb(host_parse_init);
@@ -41,25 +40,18 @@ void surf_host_model_init_compound()
   xbt_assert(surf_network_model, "No network model defined yet!");
   surf_host_model = new HostCLM03Model();
 
-  ModelPtr model = surf_host_model;
+  Model *model = surf_host_model;
   xbt_dynar_push(model_list, &model);
   xbt_dynar_push(model_list_invoke, &model);
   sg_platf_host_add_cb(host_parse_init);
 }
 
-HostCLM03Model::HostCLM03Model()
- : HostModel("Host CLM03")
-{
-}
-
-HostCLM03Model::~HostCLM03Model()
-{}
-
-HostPtr HostCLM03Model::createHost(const char *name){
-  HostPtr host = new HostCLM03(surf_host_model, name, NULL,
+Host *HostCLM03Model::createHost(const char *name){
+  sg_host_t sg_host = sg_host_by_name(name);
+  Host *host = new HostCLM03(surf_host_model, name, NULL,
                  (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL),
-                 (RoutingEdgePtr)xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL),
-                 static_cast<CpuPtr>(xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL)));
+                 sg_host_edge(sg_host),
+                 sg_host_surfcpu(sg_host));
   XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage));
   xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, host);
   return host;
@@ -68,16 +60,14 @@ HostPtr HostCLM03Model::createHost(const char *name){
 double HostCLM03Model::shareResources(double now){
   adjustWeightOfDummyCpuActions();
 
-  double min_by_cpu = p_cpuModel->shareResources(now);
-  double min_by_net = (strcmp(surf_network_model->getName(), "network NS3")) ? surf_network_model->shareResources(now) : -1;
-  double min_by_sto = -1;
-  if (p_cpuModel == surf_cpu_model_pm)
-       min_by_sto = surf_storage_model->shareResources(now);
+  double min_by_cpu = surf_cpu_model_pm->shareResources(now);
+  double min_by_net = surf_network_model->shareResourcesIsIdempotent() ? surf_network_model->shareResources(now) : -1;
+  double min_by_sto = surf_storage_model->shareResources(now);
 
   XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
-      this, surf_cpu_model_pm->getName(), min_by_cpu,
-            surf_network_model->getName(), min_by_net,
-            surf_storage_model->getName(), min_by_sto);
+      this, typeid(surf_cpu_model_pm).name(), min_by_cpu,
+               typeid(surf_network_model).name(), min_by_net,
+                       typeid(surf_storage_model).name(), min_by_sto);
 
   double res = max(max(min_by_cpu, min_by_net), min_by_sto);
   if (min_by_cpu >= 0.0 && min_by_cpu < res)
@@ -93,20 +83,21 @@ void HostCLM03Model::updateActionsState(double /*now*/, double /*delta*/){
   return;
 }
 
-ActionPtr HostCLM03Model::executeParallelTask(int host_nb,
-                                        void **host_list,
+Action *HostCLM03Model::executeParallelTask(int host_nb,
+                                        sg_host_t *host_list,
                                         double *flops_amount,
                                         double *bytes_amount,
                                         double rate){
 #define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
-  ActionPtr action =NULL;
+  Action *action =NULL;
   if ((host_nb == 1)
       && (cost_or_zero(bytes_amount, 0) == 0.0)){
-    action = ((HostCLM03Ptr)host_list[0])->execute(flops_amount[0]);
+    action = surf_host_execute(host_list[0],flops_amount[0]);
   } else if ((host_nb == 1)
            && (cost_or_zero(flops_amount, 0) == 0.0)) {
-    action = communicate((HostCLM03Ptr)host_list[0],
-        (HostCLM03Ptr)host_list[0],bytes_amount[0], rate);
+    action = surf_network_model->communicate(sg_host_edge(host_list[0]),
+                                                sg_host_edge(host_list[0]),
+                                                                                        bytes_amount[0], rate);
   } else if ((host_nb == 2)
              && (cost_or_zero(flops_amount, 0) == 0.0)
              && (cost_or_zero(flops_amount, 1) == 0.0)) {
@@ -120,26 +111,21 @@ ActionPtr HostCLM03Model::executeParallelTask(int host_nb,
       }
     }
     if (nb == 1){
-      action = communicate((HostCLM03Ptr)host_list[0],
-          (HostCLM03Ptr)host_list[1],value, rate);
+      action = surf_network_model->communicate(sg_host_edge(host_list[0]),
+                                                  sg_host_edge(host_list[1]),
+                                                                                          value, rate);
     }
   } else
-    THROW_UNIMPLEMENTED;      /* This model does not implement parallel tasks */
+    THROW_UNIMPLEMENTED;      /* This model does not implement parallel tasks for more than 2 hosts */
 #undef cost_or_zero
-  xbt_free((HostCLM03Ptr)host_list);
+  xbt_free(host_list);
   return action;
 }
 
-ActionPtr HostCLM03Model::communicate(HostPtr src, HostPtr dst, double size, double rate){
-  return surf_network_model->communicate(src->p_netElm, dst->p_netElm, size, rate);
-}
-
-
-
 /************
  * Resource *
  ************/
-HostCLM03::HostCLM03(HostModelPtr model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu)
+HostCLM03::HostCLM03(HostModel *model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
   : Host(model, name, properties, storage, netElm, cpu) {}
 
 bool HostCLM03::isUsed(){
@@ -151,11 +137,11 @@ void HostCLM03::updateState(tmgr_trace_event_t /*event_type*/, double /*value*/,
   THROW_IMPOSSIBLE;             /* This model does not implement parallel tasks */
 }
 
-ActionPtr HostCLM03::execute(double size) {
+Action *HostCLM03::execute(double size) {
   return p_cpu->execute(size);
 }
 
-ActionPtr HostCLM03::sleep(double duration) {
+Action *HostCLM03::sleep(double duration) {
   return p_cpu->sleep(duration);
 }
 
index b362a72..3bbd4fa 100644 (file)
  ***********/
 
 class HostCLM03Model;
-typedef HostCLM03Model *HostCLM03ModelPtr;
-
 class HostCLM03;
-typedef HostCLM03 *HostCLM03Ptr;
-
 class HostCLM03Action;
-typedef HostCLM03Action *HostCLM03ActionPtr;
 
 /*********
  * Model *
@@ -31,19 +26,18 @@ typedef HostCLM03Action *HostCLM03ActionPtr;
 
 class HostCLM03Model : public HostModel {
 public:
-  HostCLM03Model();
-  ~HostCLM03Model();
-  HostPtr createHost(const char *name);
+  HostCLM03Model(): HostModel(){}
+  ~HostCLM03Model() {}
+  Host *createHost(const char *name);
   double shareResources(double now);
 
   void updateActionsState(double now, double delta);
 
-  ActionPtr executeParallelTask(int host_nb,
-                                        void **host_list,
-                                        double *flops_amount,
-                                        double *bytes_amount,
-                                        double rate);
- ActionPtr communicate(HostPtr src, HostPtr dst, double size, double rate);
+  Action *executeParallelTask(int host_nb,
+                              sg_host_t *host_list,
+                                                         double *flops_amount,
+                                                         double *bytes_amount,
+                                                         double rate);
 };
 
 /************
@@ -52,21 +46,17 @@ public:
 
 class HostCLM03 : public Host {
 public:
-  HostCLM03(HostModelPtr model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu);
+  HostCLM03(HostModel *model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu);
 
   void updateState(tmgr_trace_event_t event_type, double value, double date);
 
-  virtual ActionPtr execute(double size);
-  virtual ActionPtr sleep(double duration);
+  virtual Action *execute(double size);
+  virtual Action *sleep(double duration);
   e_surf_resource_state_t getState();
 
   bool isUsed();
 
   xbt_dynar_t getVms();
-
-  /* common with vm */
-  void getParams(ws_params_t params);
-  void setParams(ws_params_t params);
 };
 
 
index 40ba2fa..956a0b6 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_host, surf,
                                 "Logging specific to the SURF host module");
 
-HostModelPtr surf_host_model = NULL;
+HostModel *surf_host_model = NULL;
 
 /*************
  * Callbacks *
  *************/
 
-surf_callback(void, HostPtr) hostCreatedCallbacks;
-surf_callback(void, HostPtr) hostDestructedCallbacks;
-surf_callback(void, HostPtr, e_surf_resource_state_t, e_surf_resource_state_t) hostStateChangedCallbacks;
-surf_callback(void, HostActionPtr, e_surf_action_state_t, e_surf_action_state_t) hostActionStateChangedCallbacks;
+surf_callback(void, Host*) hostCreatedCallbacks;
+surf_callback(void, Host*) hostDestructedCallbacks;
+surf_callback(void, Host*, e_surf_resource_state_t, e_surf_resource_state_t) hostStateChangedCallbacks;
+surf_callback(void, HostAction*, e_surf_action_state_t, e_surf_action_state_t) hostActionStateChangedCallbacks;
 
 void host_parse_init(sg_platf_host_cbarg_t host)
 {
@@ -39,20 +39,6 @@ void host_add_traces(){
 /*********
  * Model *
  *********/
-HostModel::HostModel(const char *name)
- : Model(name)
-{
-  p_cpuModel = surf_cpu_model_pm;
-}
-
-HostModel::HostModel()
-: Model("Host") {
-  p_cpuModel = surf_cpu_model_pm;
-}
-
-HostModel::~HostModel() {
-}
-
 /* Each VM has a dummy CPU action on the PM layer. This CPU action works as the
  * constraint (capacity) of the VM in the PM layer. If the VM does not have any
  * active task, the dummy CPU action must be deactivated, so that the VM does
@@ -64,8 +50,8 @@ void HostModel::adjustWeightOfDummyCpuActions()
          VMModel::ws_vms.begin();
        iter !=  VMModel::ws_vms.end(); ++iter) {
 
-    VMPtr ws_vm = &*iter;
-    CpuCas01Ptr cpu_cas01 = static_cast<CpuCas01Ptr>(ws_vm->p_cpu);
+    VM *ws_vm = &*iter;
+    CpuCas01 *cpu_cas01 = static_cast<CpuCas01*>(ws_vm->p_cpu);
     xbt_assert(cpu_cas01, "cpu-less host");
 
     int is_active = lmm_constraint_used(cpu_cas01->getModel()->getMaxminSystem(), cpu_cas01->getConstraint());
@@ -91,8 +77,8 @@ void HostModel::adjustWeightOfDummyCpuActions()
 /************
  * Resource *
  ************/
-Host::Host(ModelPtr model, const char *name, xbt_dict_t props,
-                                xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu)
+Host::Host(Model *model, const char *name, xbt_dict_t props,
+                                xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
  : Resource(model, name, props)
  , p_storage(storage), p_netElm(netElm), p_cpu(cpu)
 {
@@ -100,8 +86,8 @@ Host::Host(ModelPtr model, const char *name, xbt_dict_t props,
   surf_callback_emit(hostCreatedCallbacks, this);
 }
 
-Host::Host(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
-                                        xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu)
+Host::Host(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
+                                        xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
  : Resource(model, name, props, constraint)
  , p_storage(storage), p_netElm(netElm), p_cpu(cpu)
 {
@@ -120,50 +106,14 @@ void Host::setState(e_surf_resource_state_t state){
   p_cpu->setState(state);
 }
 
-int Host::getCore(){
-  return p_cpu->getCore();
-}
-
-double Host::getSpeed(double load){
-  return p_cpu->getSpeed(load);
-}
-
-double Host::getAvailableSpeed(){
-  return p_cpu->getAvailableSpeed();
-}
-
-double Host::getCurrentPowerPeak()
-{
-  return p_cpu->getCurrentPowerPeak();
-}
-
-double Host::getPowerPeakAt(int pstate_index)
-{
-  return p_cpu->getPowerPeakAt(pstate_index);
-}
-
-int Host::getNbPstates()
-{
-  return p_cpu->getNbPstates();
-}
-
-void Host::setPstate(int pstate_index)
-{
-       p_cpu->setPstate(pstate_index);
-}
-int Host::getPstate()
-{
-       return p_cpu->getPstate();
-}
-
 xbt_dict_t Host::getProperties()
 {
   return p_cpu->getProperties();
 }
 
-StoragePtr Host::findStorageOnMountList(const char* mount)
+Storage *Host::findStorageOnMountList(const char* mount)
 {
-  StoragePtr st = NULL;
+  Storage *st = NULL;
   s_mount_t mnt;
   unsigned int cursor;
 
@@ -172,7 +122,7 @@ StoragePtr Host::findStorageOnMountList(const char* mount)
   {
     XBT_DEBUG("See '%s'",mnt.name);
     if(!strcmp(mount,mnt.name)){
-      st = static_cast<StoragePtr>(mnt.storage);
+      st = static_cast<Storage*>(mnt.storage);
       break;
     }
   }
@@ -188,7 +138,7 @@ xbt_dict_t Host::getMountedStorageList()
   char *storage_name = NULL;
 
   xbt_dynar_foreach(p_storage,i,mnt){
-    storage_name = (char *)static_cast<StoragePtr>(mnt.storage)->getName();
+    storage_name = (char *)static_cast<Storage*>(mnt.storage)->getName();
     xbt_dict_set(storage_list,mnt.name,storage_name,NULL);
   }
   return storage_list;
@@ -202,7 +152,7 @@ xbt_dynar_t Host::getAttachedStorageList()
   xbt_dynar_t result = xbt_dynar_new(sizeof(void*), NULL);
   xbt_lib_foreach(storage_lib, cursor, key, data) {
     if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
-         StoragePtr storage = static_cast<StoragePtr>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
+         Storage *storage = static_cast<Storage*>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
          if(!strcmp((const char*)storage->p_attach,this->getName())){
            xbt_dynar_push_as(result, void *, (void*)storage->getName());
          }
@@ -211,9 +161,9 @@ xbt_dynar_t Host::getAttachedStorageList()
   return result;
 }
 
-ActionPtr Host::open(const char* fullpath) {
+Action *Host::open(const char* fullpath) {
 
-  StoragePtr st = NULL;
+  Storage *st = NULL;
   s_mount_t mnt;
   unsigned int cursor;
   size_t longest_prefix_length = 0;
@@ -232,7 +182,7 @@ ActionPtr Host::open(const char* fullpath) {
     if(!strcmp(file_mount_name,mnt.name) && strlen(mnt.name)>longest_prefix_length)
     {/* The current mount name is found in the full path and is bigger than the previous*/
       longest_prefix_length = strlen(mnt.name);
-      st = static_cast<StoragePtr>(mnt.storage);
+      st = static_cast<Storage*>(mnt.storage);
     }
     free(file_mount_name);
   }
@@ -249,26 +199,26 @@ ActionPtr Host::open(const char* fullpath) {
     xbt_die("Can't find mount point for '%s' on '%s'", fullpath, getName());
 
   XBT_DEBUG("OPEN %s on disk '%s'",path, st->getName());
-  ActionPtr action = st->open((const char*)mount_name, (const char*)path);
+  Action *action = st->open((const char*)mount_name, (const char*)path);
   free((char*)path);
   free((char*)mount_name);
   return action;
 }
 
-ActionPtr Host::close(surf_file_t fd) {
-  StoragePtr st = findStorageOnMountList(fd->mount);
+Action *Host::close(surf_file_t fd) {
+  Storage *st = findStorageOnMountList(fd->mount);
   XBT_DEBUG("CLOSE %s on disk '%s'",fd->name, st->getName());
   return st->close(fd);
 }
 
-ActionPtr Host::read(surf_file_t fd, sg_size_t size) {
-  StoragePtr st = findStorageOnMountList(fd->mount);
+Action *Host::read(surf_file_t fd, sg_size_t size) {
+  Storage *st = findStorageOnMountList(fd->mount);
   XBT_DEBUG("READ %s on disk '%s'",fd->name, st->getName());
   return st->read(fd, size);
 }
 
-ActionPtr Host::write(surf_file_t fd, sg_size_t size) {
-  StoragePtr st = findStorageOnMountList(fd->mount);
+Action *Host::write(surf_file_t fd, sg_size_t size) {
+  Storage *st = findStorageOnMountList(fd->mount);
   XBT_DEBUG("WRITE %s on disk '%s'",fd->name, st->getName());
   return st->write(fd, size);
 }
@@ -279,7 +229,7 @@ int Host::unlink(surf_file_t fd) {
     return -1;
   } else {
 
-    StoragePtr st = findStorageOnMountList(fd->mount);
+    Storage *st = findStorageOnMountList(fd->mount);
     /* Check if the file is on this storage */
     if (!xbt_dict_get_or_null(st->p_content, fd->name)){
       XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name,
@@ -306,7 +256,7 @@ sg_size_t Host::getSize(surf_file_t fd){
 
 xbt_dynar_t Host::getInfo( surf_file_t fd)
 {
-  StoragePtr st = findStorageOnMountList(fd->mount);
+  Storage *st = findStorageOnMountList(fd->mount);
   sg_size_t *psize = xbt_new(sg_size_t, 1);
   *psize = fd->size;
   xbt_dynar_t info = xbt_dynar_new(sizeof(void*), NULL);
@@ -372,14 +322,14 @@ int Host::fileMove(surf_file_t fd, const char* fullpath){
 
 xbt_dynar_t Host::getVms()
 {
-  xbt_dynar_t dyn = xbt_dynar_new(sizeof(VMPtr), NULL);
+  xbt_dynar_t dyn = xbt_dynar_new(sizeof(VM*), NULL);
 
   /* iterate for all virtual machines */
   for (VMModel::vm_list_t::iterator iter =
          VMModel::ws_vms.begin();
        iter !=  VMModel::ws_vms.end(); ++iter) {
 
-    VMPtr ws_vm = &*iter;
+    VM *ws_vm = &*iter;
     if (this == ws_vm->p_subWs)
       xbt_dynar_push(dyn, &ws_vm);
   }
@@ -387,12 +337,12 @@ xbt_dynar_t Host::getVms()
   return dyn;
 }
 
-void Host::getParams(ws_params_t params)
+void Host::getParams(vm_params_t params)
 {
   *params = p_params;
 }
 
-void Host::setParams(ws_params_t params)
+void Host::setParams(vm_params_t params)
 {
   /* may check something here. */
   p_params = *params;
index 71ee1b7..b451329 100644 (file)
  ***********/
 
 class HostModel;
-typedef HostModel *HostModelPtr;
-
 class Host;
-typedef Host *HostPtr;
-
 class HostAction;
-typedef HostAction *HostActionPtr;
 
 /*************
  * Callbacks *
  *************/
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Host creation *
- * @details Callback functions have the following signature: `void(HostPtr)`
+ * @brief Callbacks fired after Host creation. Signature: `void(Host*)`
  */
-XBT_PUBLIC_DATA(surf_callback(void, HostPtr)) hostCreatedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Host*)) hostCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Host destruction *
- * @details Callback functions have the following signature: `void(HostPtr)`
+ * @brief Callbacks fired Host destruction. Signature: `void(Host*)`
  */
-XBT_PUBLIC_DATA(surf_callback(void, HostPtr)) hostDestructedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Host*)) hostDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Host State changed *
- * @details Callback functions have the following signature: `void(HostActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
+ * @brief Callbacks fired after Host State changed. Signature: `void(Host *, e_surf_resource_state_t old, e_surf_resource_state_t current)`
  */
-XBT_PUBLIC_DATA(surf_callback(void, HostPtr, e_surf_resource_state_t, e_surf_resource_state_t)) hostStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Host*, e_surf_resource_state_t, e_surf_resource_state_t)) hostStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after HostAction State changed *
- * @details Callback functions have the following signature: `void(HostActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
+ * @brief Callbacks fired HostAction State changed. Signature: `void(HostAction *, e_surf_action_state_t old, e_surf_action_state_t current)`
  */
-XBT_PUBLIC_DATA(surf_callback(void, HostActionPtr, e_surf_action_state_t, e_surf_action_state_t)) hostActionStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, HostAction*, e_surf_action_state_t, e_surf_action_state_t)) hostActionStateChangedCallbacks;
 
 /*********
  * Tools *
  *********/
-XBT_PUBLIC_DATA(HostModelPtr) surf_host_model;
+XBT_PUBLIC_DATA(HostModel*) surf_host_model;
 XBT_PUBLIC(void) host_parse_init(sg_platf_host_cbarg_t host);
 XBT_PUBLIC(void) host_add_traces();
 
@@ -69,58 +60,20 @@ XBT_PUBLIC(void) host_add_traces();
  */
 class HostModel : public Model {
 public:
-    /**
-   * @brief HostModel constructor
-   *
-   * @param name the name of the model
-   */
-  HostModel(const char *name);
+  HostModel() : Model() {}
+  ~HostModel() {}
 
-  /** @brief HostModel constructor */
-  HostModel();
-
-  /** @brief HostModel destructor */
-  ~HostModel();
-
-  virtual HostPtr createHost(const char *name)=0;
+  virtual Host *createHost(const char *name)=0;
   void addTraces(){DIE_IMPOSSIBLE;}
 
-  /**
-   * @brief [brief description]
-   * @details [long description]
-   */
   virtual void adjustWeightOfDummyCpuActions();
+  virtual Action *executeParallelTask(int host_nb,
+                                      sg_host_t *host_list,
+                                                                         double *flops_amount,
+                                                                         double *bytes_amount,
+                                                                         double rate)=0;
 
-  /**
-   * @brief [brief description]
-   * @details [long description]
-   *
-   * @param host_nb [description]
-   * @param host_list [description]
-   * @param flops_amount [description]
-   * @param bytes_amount [description]
-   * @param rate [description]
-   * @return [description]
-   */
-  virtual ActionPtr executeParallelTask(int host_nb,
-                                        void **host_list,
-                                        double *flops_amount,
-                                        double *bytes_amount,
-                                        double rate)=0;
-
- /**
-  * @brief [brief description]
-  * @details [long description]
-  *
-  * @param src [description]
-  * @param dst [description]
-  * @param size [description]
-  * @param rate [description]
-  * @return [description]
-  */
- virtual ActionPtr communicate(HostPtr src, HostPtr dst, double size, double rate)=0;
-
- CpuModelPtr p_cpuModel;
+  bool shareResourcesIsIdempotent() {return true;}
 };
 
 /************
@@ -128,7 +81,7 @@ public:
  ************/
 /** @ingroup SURF_host_interface
  * @brief SURF Host interface class
- * @details An host represents a machine with a aggregation of a Cpu, a NetworkLink and a Storage
+ * @details An host represents a machine with a aggregation of a Cpu, a Link and a Storage
  */
 class Host : public Resource {
 public:
@@ -142,8 +95,8 @@ public:
    * @param netElm The RoutingEdge associated to this Host
    * @param cpu The Cpu associated to this Host
    */
-  Host(ModelPtr model, const char *name, xbt_dict_t props,
-                     xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu);
+  Host(Model *model, const char *name, xbt_dict_t props,
+                     xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu);
 
   /**
    * @brief Host constructor
@@ -156,9 +109,9 @@ public:
    * @param netElm The RoutingEdge associated to this Host
    * @param cpu The Cpu associated to this Host
    */
-  Host(ModelPtr model, const char *name, xbt_dict_t props,
-      lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdgePtr netElm,
-      CpuPtr cpu);
+  Host(Model *model, const char *name, xbt_dict_t props,
+      lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdge *netElm,
+      Cpu *cpu);
 
   /** @brief Host destructor */
   ~ Host();
@@ -179,7 +132,7 @@ public:
    * @return The CpuAction corresponding to the processing
    * @see Cpu
    */
-  virtual ActionPtr execute(double flops_amount)=0;
+  virtual Action *execute(double flops_amount)=0;
 
   /**
    * @brief Make a process sleep for duration seconds
@@ -188,67 +141,15 @@ public:
    * @return The CpuAction corresponding to the sleeping
    * @see Cpu
    */
-  virtual ActionPtr sleep(double duration)=0;
-
-  /**
-   * @brief Get the number of cores of the associated Cpu
-   *
-   * @return The number of cores of the associated Cpu
-   * @see Cpu
-   */
-  virtual int getCore();
-
-  /**
-   * @brief Get the speed of the associated Cpu
-   *
-   * @param load [TODO]
-   * @return The speed of the associated Cpu
-   * @see Cpu
-   */
-  virtual double getSpeed(double load);
-
-  /**
-   * @brief Get the available speed of the associated Cpu
-   * @details [TODO]
-   *
-   * @return The available speed of the associated Cpu
-   * @see Cpu
-   */
-  virtual double getAvailableSpeed();
-
-  /**
-   * @brief Get the associated Cpu power peak
-   *
-   * @return The associated Cpu power peak
-   * @see Cpu
-   */
-  virtual double getCurrentPowerPeak();
-
-  virtual double getPowerPeakAt(int pstate_index);
-  virtual int getNbPstates();
-  virtual void setPstate(int pstate_index);
-  virtual int  getPstate();
+  virtual Action *sleep(double duration)=0;
 
-  /**
-   * @brief Return the storage of corresponding mount point
-   *
-   * @param storage The mount point
-   * @return The corresponding Storage
-   */
-  virtual StoragePtr findStorageOnMountList(const char* storage);
+  /** @brief Return the storage of corresponding mount point */
+  virtual Storage *findStorageOnMountList(const char* storage);
 
-  /**
-   * @brief Get the xbt_dict_t of mount_point: Storage
-   *
-   * @return The xbt_dict_t of mount_point: Storage
-   */
+  /** @brief Get the xbt_dict_t of mount_point: Storage */
   virtual xbt_dict_t getMountedStorageList();
 
-  /**
-   * @brief Get the xbt_dynar_t of storages attached to the Host
-   *
-   * @return The xbt_dynar_t of Storage names
-   */
+  /** @brief Get the xbt_dynar_t of storages attached to the Host */
   virtual xbt_dynar_t getAttachedStorageList();
 
   /**
@@ -258,7 +159,7 @@ public:
    *
    * @return The StorageAction corresponding to the opening
    */
-  virtual ActionPtr open(const char* fullpath);
+  virtual Action *open(const char* fullpath);
 
   /**
    * @brief Close a file
@@ -266,7 +167,7 @@ public:
    * @param fd The file descriptor to close
    * @return The StorageAction corresponding to the closing
    */
-  virtual ActionPtr close(surf_file_t fd);
+  virtual Action *close(surf_file_t fd);
 
   /**
    * @brief Unlink a file
@@ -292,7 +193,7 @@ public:
    * @param size The size in bytes to read
    * @return The StorageAction corresponding to the reading
    */
-  virtual ActionPtr read(surf_file_t fd, sg_size_t size);
+  virtual Action *read(surf_file_t fd, sg_size_t size);
 
   /**
    * @brief Write a file
@@ -301,7 +202,7 @@ public:
    * @param size The size in bytes to write
    * @return The StorageAction corresponding to the writing
    */
-  virtual ActionPtr write(surf_file_t fd, sg_size_t size);
+  virtual Action *write(surf_file_t fd, sg_size_t size);
 
   /**
    * @brief Get the informations of a file descriptor
@@ -351,34 +252,20 @@ public:
   virtual int fileMove(surf_file_t fd, const char* fullpath);
 
   xbt_dynar_t p_storage;
-  RoutingEdgePtr p_netElm;
-  CpuPtr p_cpu;
-  NetworkLinkPtr p_network;
+  RoutingEdge *p_netElm;
+  Cpu *p_cpu;
 
-  /**
-   * @brief Get the list of virtual machines on the current Host
-   *
-   * @return The list of VMs
-   */
+  /** @brief Get the list of virtual machines on the current Host */
   xbt_dynar_t getVms();
 
   /* common with vm */
-  /**
-   * @brief [brief description]
-   * @details [long description]
-   *
-   * @param params [description]
-   */
-  void getParams(ws_params_t params);
-
-  /**
-   * @brief [brief description]
-   * @details [long description]
-   *
-   * @param params [description]
-   */
-  void setParams(ws_params_t params);
-  s_ws_params_t p_params;
+  /** @brief Retrieve a copy of the parameters of that VM/PM
+   *  @details The ramsize and overcommit fields are used on the PM too */
+  void getParams(vm_params_t params);
+  /** @brief Sets the params of that VM/PM */
+  void setParams(vm_params_t params);
+private:
+  s_vm_params_t p_params;
 };
 
 /**********
@@ -397,7 +284,7 @@ public:
    * @param cost The cost of this HostAction in [TODO]
    * @param failed [description]
    */
-  HostAction(ModelPtr model, double cost, bool failed)
+  HostAction(Model *model, double cost, bool failed)
   : Action(model, cost, failed) {}
 
   /**
@@ -408,7 +295,7 @@ public:
    * @param failed [description]
    * @param var The lmm variable associated to this StorageAction if it is part of a LMM component
    */
-  HostAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
+  HostAction(Model *model, double cost, bool failed, lmm_variable_t var)
   : Action(model, cost, failed, var) {}
 
   void setState(e_surf_action_state_t state);
index 4b7b762..7212d00 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "cpu_interface.hpp"
 #include "surf_routing.hpp"
+#include "xbt/lib.h"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host);
 
@@ -26,39 +27,37 @@ static void ptask_netlink_parse_init(sg_platf_link_cbarg_t link)
   current_property_set = NULL;
 }
 
-static void ptask_define_callbacks()
+void surf_host_model_init_ptask_L07(void)
 {
+  XBT_INFO("Switching to the L07 model to handle parallel tasks.");
+  xbt_assert(!surf_cpu_model_pm, "CPU model type already defined");
+  xbt_assert(!surf_network_model, "network model type already defined");
+
+  // Define the callbacks to parse the XML
   sg_platf_host_add_cb(cpu_parse_init);
   sg_platf_host_add_cb(host_parse_init);
   sg_platf_link_add_cb(ptask_netlink_parse_init);
   sg_platf_postparse_add_cb(host_add_traces);
-}
 
-void surf_host_model_init_ptask_L07(void)
-{
-  XBT_INFO("surf_host_model_init_ptask_L07");
-  xbt_assert(!surf_cpu_model_pm, "CPU model type already defined");
-  xbt_assert(!surf_network_model, "network model type already defined");
-  ptask_define_callbacks();
   surf_host_model = new HostL07Model();
-  ModelPtr model = surf_host_model;
+  Model *model = surf_host_model;
   xbt_dynar_push(model_list, &model);
   xbt_dynar_push(model_list_invoke, &model);
 }
 
 
-HostL07Model::HostL07Model() : HostModel("Host ptask_L07") {
+HostL07Model::HostL07Model() : HostModel() {
   if (!ptask_maxmin_system)
        ptask_maxmin_system = lmm_system_new(1);
   surf_host_model = NULL;
   surf_network_model = new NetworkL07Model();
   surf_cpu_model_pm = new CpuL07Model();
-  routing_model_create(surf_network_model->createNetworkLink("__loopback__",
+
+  routing_model_create(surf_network_model->createLink("__loopback__",
                                                          498000000, NULL,
                                                          0.000015, NULL,
                                                          SURF_RESOURCE_ON, NULL,
                                                          SURF_LINK_FATPIPE, NULL));
-  p_cpuModel = surf_cpu_model_pm;
 }
 
 HostL07Model::~HostL07Model() {
@@ -76,16 +75,16 @@ HostL07Model::~HostL07Model() {
 
 double HostL07Model::shareResources(double /*now*/)
 {
-  HostL07ActionPtr action;
+  L07Action *action;
 
-  ActionListPtr running_actions = getRunningActionSet();
+  ActionList *running_actions = getRunningActionSet();
   double min = this->shareResourcesMaxMin(running_actions,
                                               ptask_maxmin_system,
                                               bottleneck_solve);
 
   for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end())
         ; it != itend ; ++it) {
-       action = static_cast<HostL07ActionPtr>(&*it);
+       action = static_cast<L07Action*>(&*it);
     if (action->m_latency > 0) {
       if (min < 0) {
         min = action->m_latency;
@@ -104,24 +103,20 @@ double HostL07Model::shareResources(double /*now*/)
   return min;
 }
 
-void HostL07Model::updateActionsState(double /*now*/, double delta)
-{
-  double deltap = 0.0;
-  HostL07ActionPtr action;
+void HostL07Model::updateActionsState(double /*now*/, double delta) {
 
-  ActionListPtr actionSet = getRunningActionSet();
+  L07Action *action;
+  ActionList *actionSet = getRunningActionSet();
 
-  for(ActionList::iterator it(actionSet->begin()), itNext = it, itend(actionSet->end())
-        ; it != itend ; it=itNext) {
+  for(ActionList::iterator it = actionSet->begin(), itNext = it
+        ; it != actionSet->end()
+        ; it =  itNext) {
        ++itNext;
-    action = static_cast<HostL07ActionPtr>(&*it);
-    deltap = delta;
+    action = static_cast<L07Action*>(&*it);
     if (action->m_latency > 0) {
-      if (action->m_latency > deltap) {
-        double_update(&(action->m_latency), deltap, sg_surf_precision);
-        deltap = 0.0;
+      if (action->m_latency > delta) {
+        double_update(&(action->m_latency), delta, sg_surf_precision);
       } else {
-        double_update(&(deltap), action->m_latency, sg_surf_precision);
         action->m_latency = 0.0;
       }
       if ((action->m_latency == 0.0) && (action->isSuspended() == 0)) {
@@ -136,8 +131,14 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
     if (action->getMaxDuration() != NO_MAX_DURATION)
       action->updateMaxDuration(delta);
 
-    XBT_DEBUG("Action (%p) : remains (%g).",
-           action, action->getRemains());
+    XBT_DEBUG("Action (%p) : remains (%g).", action, action->getRemains());
+
+    /* In the next if cascade, the action can be finished either because:
+     *  - The amount of remaining work reached 0
+     *  - The max duration was reached
+     * If it's not done, it may have failed.
+     */
+
     if ((action->getRemains() <= 0) &&
         (lmm_get_variable_weight(action->getVariable()) > 0)) {
       action->finish();
@@ -145,18 +146,16 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
     } else if ((action->getMaxDuration() != NO_MAX_DURATION) &&
                (action->getMaxDuration() <= 0)) {
       action->finish();
-     action->setState(SURF_ACTION_DONE);
+      action->setState(SURF_ACTION_DONE);
     } else {
       /* Need to check that none of the model has failed */
       lmm_constraint_t cnst = NULL;
       int i = 0;
-      void *constraint_id = NULL;
 
-      while ((cnst = lmm_get_cnst_from_var(ptask_maxmin_system, action->getVariable(),
-                                    i++))) {
-        constraint_id = lmm_constraint_id(cnst);
+      while ((cnst = lmm_get_cnst_from_var(ptask_maxmin_system, action->getVariable(), i++))) {
+        void *constraint_id = lmm_constraint_id(cnst);
 
-        if (static_cast<HostPtr>(constraint_id)->getState() == SURF_RESOURCE_OFF) {
+        if (static_cast<Host*>(constraint_id)->getState() == SURF_RESOURCE_OFF) {
           XBT_DEBUG("Action (%p) Failed!!", action);
           action->finish();
           action->setState(SURF_ACTION_FAILED);
@@ -168,43 +167,44 @@ void HostL07Model::updateActionsState(double /*now*/, double delta)
   return;
 }
 
-ActionPtr HostL07Model::executeParallelTask(int host_nb,
-                                                   void **host_list,
-                                                   double *flops_amount,
-                                                                                                  double *bytes_amount,
-                                                   double rate)
+Action *HostL07Model::executeParallelTask(int host_nb,
+                                          sg_host_t*host_list,
+                                                                                 double *flops_amount,
+                                                                                 double *bytes_amount,
+                                                                                 double rate)
 {
-  HostL07ActionPtr action;
-  int i, j;
+  L07Action *action = new L07Action(this, 1, 0);
   unsigned int cpt;
   int nb_link = 0;
   int nb_host = 0;
   double latency = 0.0;
 
+  action->p_edgeList->reserve(host_nb);
+  for (int i = 0; i<host_nb; i++)
+         action->p_edgeList->push_back(sg_host_edge(host_list[i]));
+
   if (ptask_parallel_task_link_set == NULL)
     ptask_parallel_task_link_set = xbt_dict_new_homogeneous(NULL);
 
   xbt_dict_reset(ptask_parallel_task_link_set);
 
   /* Compute the number of affected resources... */
-  for (i = 0; i < host_nb; i++) {
-    for (j = 0; j < host_nb; j++) {
+  for (int i = 0; i < host_nb; i++) {
+    for (int j = 0; j < host_nb; j++) {
       xbt_dynar_t route=NULL;
 
       if (bytes_amount[i * host_nb + j] > 0) {
         double lat=0.0;
         unsigned int cpt;
         void *_link;
-        LinkL07Ptr link;
+        LinkL07 *link;
 
-        routing_platf->getRouteAndLatency(static_cast<HostL07Ptr>(host_list[i])->p_netElm,
-                                                 static_cast<HostL07Ptr>(host_list[j])->p_netElm,
-                                                 &route,
-                                                 &lat);
+        routing_platf->getRouteAndLatency((*action->p_edgeList)[i], (*action->p_edgeList)[j],
+                                                 &route, &lat);
         latency = MAX(latency, lat);
 
         xbt_dynar_foreach(route, cpt, _link) {
-           link = static_cast<LinkL07Ptr>(_link);
+           link = static_cast<LinkL07*>(_link);
            xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL);
         }
       }
@@ -214,49 +214,43 @@ ActionPtr HostL07Model::executeParallelTask(int host_nb,
   nb_link = xbt_dict_length(ptask_parallel_task_link_set);
   xbt_dict_reset(ptask_parallel_task_link_set);
 
-  for (i = 0; i < host_nb; i++)
+  for (int i = 0; i < host_nb; i++)
     if (flops_amount[i] > 0)
       nb_host++;
 
-  action = new HostL07Action(this, 1, 0);
   XBT_DEBUG("Creating a parallel task (%p) with %d cpus and %d links.",
          action, host_nb, nb_link);
-  action->m_suspended = 0;        /* Should be useless because of the
-                                   calloc but it seems to help valgrind... */
-  action->m_hostNb = host_nb;
-  action->p_hostList = (HostPtr *) host_list;
+  action->m_suspended = 0; /* valgrind seems to want it despite the calloc... */
   action->p_computationAmount = flops_amount;
   action->p_communicationAmount = bytes_amount;
   action->m_latency = latency;
   action->m_rate = rate;
 
   action->p_variable = lmm_variable_new(ptask_maxmin_system, action, 1.0,
-                       (action->m_rate > 0) ? action->m_rate : -1.0,
-                       host_nb + nb_link);
+                                        (rate > 0 ? rate : -1.0),
+                                                                               host_nb + nb_link);
 
   if (action->m_latency > 0)
     lmm_update_variable_weight(ptask_maxmin_system, action->getVariable(), 0.0);
 
-  for (i = 0; i < host_nb; i++)
+  for (int i = 0; i < host_nb; i++)
     lmm_expand(ptask_maxmin_system,
-                static_cast<HostL07Ptr>(host_list[i])->p_cpu->getConstraint(),
+              sg_host_surfcpu(host_list[i])->getConstraint(),
                action->getVariable(), flops_amount[i]);
 
-  for (i = 0; i < host_nb; i++) {
-    for (j = 0; j < host_nb; j++) {
+  for (int i = 0; i < host_nb; i++) {
+    for (int j = 0; j < host_nb; j++) {
       void *_link;
-      LinkL07Ptr link;
 
       xbt_dynar_t route=NULL;
       if (bytes_amount[i * host_nb + j] == 0.0)
         continue;
 
-      routing_platf->getRouteAndLatency(static_cast<HostL07Ptr>(host_list[i])->p_netElm,
-                                        static_cast<HostL07Ptr>(host_list[j])->p_netElm,
+      routing_platf->getRouteAndLatency((*action->p_edgeList)[i], (*action->p_edgeList)[j],
                                            &route, NULL);
 
       xbt_dynar_foreach(route, cpt, _link) {
-        link = static_cast<LinkL07Ptr>(_link);
+        LinkL07 *link = static_cast<LinkL07*>(_link);
         lmm_expand_add(ptask_maxmin_system, link->getConstraint(),
                        action->getVariable(),
                        bytes_amount[i * host_nb + j]);
@@ -272,49 +266,51 @@ ActionPtr HostL07Model::executeParallelTask(int host_nb,
   return action;
 }
 
-HostPtr HostL07Model::createHost(const char *name)
+Host *HostL07Model::createHost(const char *name)
 {
-  HostL07Ptr wk = NULL;
-  xbt_assert(!surf_host_resource_priv(surf_host_resource_by_name(name)),
+  HostL07 *wk = NULL;
+  sg_host_t sg_host = sg_host_by_name(name);
+
+  xbt_assert(!surf_host_resource_priv(sg_host),
               "Host '%s' declared several times in the platform file.",
               name);
 
   wk = new HostL07(this, name, NULL,
-                                 static_cast<RoutingEdgePtr>(xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL)),
-                                 static_cast<CpuPtr>(xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL)));
+                                 sg_host_edge(sg_host),
+                                                 sg_host_surfcpu(sg_host));
 
   xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, wk);
 
-  return wk;//FIXME:xbt_lib_get_elm_or_null(host_lib, name);
+  return wk;
 }
 
-ActionPtr HostL07Model::communicate(HostPtr src, HostPtr dst,
+Action *NetworkL07Model::communicate(RoutingEdge *src, RoutingEdge *dst,
                                        double size, double rate)
 {
-  void **host_list = xbt_new0(void *, 2);
+  sg_host_t*host_list = xbt_new0(sg_host_t, 2);
   double *flops_amount = xbt_new0(double, 2);
   double *bytes_amount = xbt_new0(double, 4);
-  ActionPtr res = NULL;
+  Action *res = NULL;
 
-  host_list[0] = src;
-  host_list[1] = dst;
+  host_list[0] = sg_host_by_name(src->getName());
+  host_list[1] = sg_host_by_name(dst->getName());
   bytes_amount[1] = size;
 
-  res = executeParallelTask(2, host_list,
+  res = p_hostModel->executeParallelTask(2, host_list,
                                     flops_amount,
                                     bytes_amount, rate);
 
   return res;
 }
 
-xbt_dynar_t HostL07Model::getRoute(HostPtr src, HostPtr dst)
+xbt_dynar_t HostL07Model::getRoute(Host *src, Host *dst)
 {
   xbt_dynar_t route=NULL;
   routing_platf->getRouteAndLatency(src->p_netElm, dst->p_netElm, &route, NULL);
   return route;
 }
 
-CpuPtr CpuL07Model::createCpu(const char *name,  xbt_dynar_t powerPeak,
+Cpu *CpuL07Model::createCpu(const char *name,  xbt_dynar_t powerPeak,
                           int pstate, double power_scale,
                           tmgr_trace_t power_trace, int core,
                           e_surf_resource_state_t state_initial,
@@ -323,43 +319,39 @@ CpuPtr CpuL07Model::createCpu(const char *name,  xbt_dynar_t powerPeak,
 {
   double power_initial = xbt_dynar_get_as(powerPeak, pstate, double);
   xbt_dynar_free(&powerPeak);   // kill memory leak
+  sg_host_t sg_host = sg_host_by_name(name);
 
-  xbt_assert(!surf_host_resource_priv(surf_host_resource_by_name(name)),
+  xbt_assert(!surf_host_resource_priv(sg_host),
               "Host '%s' declared several times in the platform file.",
               name);
 
-  CpuL07Ptr cpu = new CpuL07(this, name, cpu_properties,
+  CpuL07 *cpu = new CpuL07(this, name, cpu_properties,
                                     power_initial, power_scale, power_trace,
                          core, state_initial, state_trace);
 
-  xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
+  sg_host_surfcpu_set(sg_host, cpu);
 
   return cpu;
 }
 
-NetworkLinkPtr NetworkL07Model::createNetworkLink(const char *name,
+Link* NetworkL07Model::createLink(const char *name,
                                  double bw_initial,
                                  tmgr_trace_t bw_trace,
                                  double lat_initial,
                                  tmgr_trace_t lat_trace,
-                                 e_surf_resource_state_t
-                                 state_initial,
+                                 e_surf_resource_state_t state_initial,
                                  tmgr_trace_t state_trace,
                                  e_surf_link_sharing_policy_t policy,
                                  xbt_dict_t properties)
 {
-  xbt_assert(!xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL),
-                     "Link '%s' declared several times in the platform file.",
-                     name);
-
-  LinkL07Ptr nw_link = new LinkL07(this, name, properties,
-                                      bw_initial, bw_trace,
-                                      lat_initial, lat_trace,
-                                      state_initial, state_trace,
-                                      policy);
+  xbt_assert(!Link::byName(name),
+                "Link '%s' declared several times in the platform file.", name);
 
-  xbt_lib_set(link_lib, name, SURF_LINK_LEVEL, nw_link);
-  return nw_link;
+  return new LinkL07(this, name, properties,
+                            bw_initial, bw_trace,
+                                        lat_initial, lat_trace,
+                                        state_initial, state_trace,
+                                        policy);
 }
 
 void HostL07Model::addTraces()
@@ -373,7 +365,7 @@ void HostL07Model::addTraces()
   /* Connect traces relative to cpu */
   xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    CpuL07Ptr host = static_cast<CpuL07Ptr>(surf_cpu_resource_priv(surf_cpu_resource_by_name(elm)));
+    CpuL07 *host = static_cast<CpuL07*>(sg_host_surfcpu(sg_host_by_name(elm)));
 
     xbt_assert(host, "Host %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -383,7 +375,7 @@ void HostL07Model::addTraces()
 
   xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    CpuL07Ptr host = static_cast<CpuL07Ptr>(surf_cpu_resource_priv(surf_cpu_resource_by_name(elm)));
+    CpuL07 *host = static_cast<CpuL07*>(sg_host_surfcpu(sg_host_by_name(elm)));
 
     xbt_assert(host, "Host %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -394,7 +386,7 @@ void HostL07Model::addTraces()
   /* Connect traces relative to network */
   xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    LinkL07Ptr link = static_cast<LinkL07Ptr>(xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL));
+    LinkL07 *link = static_cast<LinkL07*>(Link::byName(elm));
 
     xbt_assert(link, "Link %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -404,7 +396,7 @@ void HostL07Model::addTraces()
 
   xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    LinkL07Ptr link = static_cast<LinkL07Ptr>(xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL));
+    LinkL07 *link = static_cast<LinkL07*>(Link::byName(elm));
 
     xbt_assert(link, "Link %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -414,7 +406,7 @@ void HostL07Model::addTraces()
 
   xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    LinkL07Ptr link = static_cast<LinkL07Ptr>(xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL));
+    LinkL07 *link = static_cast<LinkL07*>(Link::byName(elm));
 
     xbt_assert(link, "Link %s undefined", elm);
     xbt_assert(trace, "Trace %s undefined", trace_name);
@@ -427,7 +419,7 @@ void HostL07Model::addTraces()
  * Resource *
  ************/
 
-HostL07::HostL07(HostModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu)
+HostL07::HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu)
   : Host(model, name, props, NULL, netElm, cpu)
 {
 }
@@ -457,7 +449,7 @@ double HostL07::getConsumedEnergy()
        THROW_UNIMPLEMENTED;
 }
 
-CpuL07::CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t props,
+CpuL07::CpuL07(CpuL07Model *model, const char* name, xbt_dict_t props,
                     double power_initial, double power_scale, tmgr_trace_t power_trace,
                           int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace)
  : Cpu(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, power_initial * power_scale),
@@ -475,7 +467,7 @@ CpuL07::CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t props,
        p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this);
 }
 
-LinkL07::LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
+LinkL07::LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
                         double bw_initial,
                         tmgr_trace_t bw_trace,
                         double lat_initial,
@@ -483,7 +475,7 @@ LinkL07::LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
                         e_surf_resource_state_t state_initial,
                         tmgr_trace_t state_trace,
                         e_surf_link_sharing_policy_t policy)
- : NetworkLink(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, bw_initial), history, state_trace)
+ : Link(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, bw_initial), history, state_trace)
 {
   m_bwCurrent = bw_initial;
   if (bw_trace)
@@ -528,7 +520,7 @@ void CpuL07::updateState(tmgr_trace_event_t event_type, double value, double /*d
   return;
 }
 
-void LinkL07::updateState(tmgr_trace_event_t event_type, double value, double date){
+void LinkL07::updateState(tmgr_trace_event_t event_type, double value, double date) {
   XBT_DEBUG("Updating link %s (%p) with value=%f for date=%g", getName(), this, value, date);
   if (event_type == p_bwEvent) {
     updateBandwidth(value, date);
@@ -552,33 +544,31 @@ void LinkL07::updateState(tmgr_trace_event_t event_type, double value, double da
   return;
 }
 
-e_surf_resource_state_t HostL07::getState()
-{
+e_surf_resource_state_t HostL07::getState() {
   return p_cpu->getState();
 }
 
-ActionPtr HostL07::execute(double size)
+Action *HostL07::execute(double size)
 {
-  void **host_list = xbt_new0(void *, 1);
+  sg_host_t*host_list = xbt_new0(sg_host_t, 1);
   double *flops_amount = xbt_new0(double, 1);
   double *bytes_amount = xbt_new0(double, 1);
 
-  host_list[0] = this;
-  bytes_amount[0] = 0.0;
+  host_list[0] = sg_host_by_name(getName());
   flops_amount[0] = size;
 
-  return static_cast<HostL07ModelPtr>(getModel())->executeParallelTask(1, host_list,
+  return static_cast<HostL07Model*>(getModel())->executeParallelTask(1, host_list,
                                              flops_amount,
                                      bytes_amount, -1);
 }
 
-ActionPtr HostL07::sleep(double duration)
+Action *HostL07::sleep(double duration)
 {
-  HostL07ActionPtr action = NULL;
+  L07Action *action = NULL;
 
   XBT_IN("(%s,%g)", getName(), duration);
 
-  action = static_cast<HostL07ActionPtr>(execute(1.0));
+  action = static_cast<L07Action*>(execute(1.0));
   action->m_maxDuration = duration;
   action->m_suspended = 2;
   lmm_update_variable_weight(ptask_maxmin_system, action->getVariable(), 0.0);
@@ -606,12 +596,12 @@ double LinkL07::getLatency()
 void LinkL07::updateLatency(double value, double date)
 {
   lmm_variable_t var = NULL;
-  HostL07ActionPtr action;
+  L07Action *action;
   lmm_element_t elem = NULL;
 
   m_latCurrent = value;
   while ((var = lmm_get_var_from_cnst(ptask_maxmin_system, getConstraint(), &elem))) {
-    action = (HostL07ActionPtr) lmm_variable_id(var);
+    action = static_cast<L07Action*>(lmm_variable_id(var));
     action->updateBound();
   }
 }
@@ -626,29 +616,29 @@ bool LinkL07::isShared()
  * Action *
  **********/
 
-HostL07Action::~HostL07Action(){
-  free(p_hostList);
+L07Action::~L07Action(){
   free(p_communicationAmount);
   free(p_computationAmount);
 }
 
-void HostL07Action::updateBound()
+void L07Action::updateBound()
 {
   double lat_current = 0.0;
   double lat_bound = -1.0;
   int i, j;
 
-  for (i = 0; i < m_hostNb; i++) {
-    for (j = 0; j < m_hostNb; j++) {
+  int hostNb = p_edgeList->size();
+
+  for (i = 0; i < hostNb; i++) {
+    for (j = 0; j < hostNb; j++) {
       xbt_dynar_t route=NULL;
 
-      if (p_communicationAmount[i * m_hostNb + j] > 0) {
+      if (p_communicationAmount[i * hostNb + j] > 0) {
         double lat = 0.0;
-        routing_platf->getRouteAndLatency(static_cast<HostL07Ptr>(((void**)p_hostList)[i])->p_netElm,
-                                          static_cast<HostL07Ptr>(((void**)p_hostList)[j])->p_netElm,
+        routing_platf->getRouteAndLatency((*p_edgeList)[i], (*p_edgeList)[j],
                                                          &route, &lat);
 
-        lat_current = MAX(lat_current, lat * p_communicationAmount[i * m_hostNb + j]);
+        lat_current = MAX(lat_current, lat * p_communicationAmount[i * hostNb + j]);
       }
     }
   }
@@ -662,7 +652,7 @@ void HostL07Action::updateBound()
   }
 }
 
-int HostL07Action::unref()
+int L07Action::unref()
 {
   m_refcount--;
   if (!m_refcount) {
@@ -676,13 +666,13 @@ int HostL07Action::unref()
   return 0;
 }
 
-void HostL07Action::cancel()
+void L07Action::cancel()
 {
   setState(SURF_ACTION_FAILED);
   return;
 }
 
-void HostL07Action::suspend()
+void L07Action::suspend()
 {
   XBT_IN("(%p))", this);
   if (m_suspended != 2) {
@@ -692,7 +682,7 @@ void HostL07Action::suspend()
   XBT_OUT();
 }
 
-void HostL07Action::resume()
+void L07Action::resume()
 {
   XBT_IN("(%p)", this);
   if (m_suspended != 2) {
@@ -702,26 +692,26 @@ void HostL07Action::resume()
   XBT_OUT();
 }
 
-bool HostL07Action::isSuspended()
+bool L07Action::isSuspended()
 {
   return m_suspended == 1;
 }
 
-void HostL07Action::setMaxDuration(double duration)
+void L07Action::setMaxDuration(double duration)
 {                               /* FIXME: should inherit */
   XBT_IN("(%p,%g)", this, duration);
   m_maxDuration = duration;
   XBT_OUT();
 }
 
-void HostL07Action::setPriority(double priority)
+void L07Action::setPriority(double priority)
 {                               /* FIXME: should inherit */
   XBT_IN("(%p,%g)", this, priority);
   m_priority = priority;
   XBT_OUT();
 }
 
-double HostL07Action::getRemains()
+double L07Action::getRemains()
 {
   XBT_IN("(%p)", this);
   XBT_OUT();
index c848b52..c265a52 100644 (file)
  ***********/
 
 class HostL07Model;
-typedef HostL07Model *HostL07ModelPtr;
-
 class CpuL07Model;
-typedef CpuL07Model *CpuL07ModelPtr;
-
 class NetworkL07Model;
-typedef NetworkL07Model *NetworkL07ModelPtr;
 
 class HostL07;
-typedef HostL07 *HostL07Ptr;
-
 class CpuL07;
-typedef CpuL07 *CpuL07Ptr;
-
 class LinkL07;
-typedef LinkL07 *LinkL07Ptr;
 
-class HostL07Action;
-typedef HostL07Action *HostL07ActionPtr;
+class L07Action;
 
 /*********
  * Tools *
@@ -48,23 +37,22 @@ public:
 
   double shareResources(double now);
   void updateActionsState(double now, double delta);
-  HostPtr createHost(const char *name);
-  ActionPtr executeParallelTask(int host_nb,
-                                        void **host_list,
-                                        double *flops_amount,
-                                        double *bytes_amount,
-                                        double rate);
-  xbt_dynar_t getRoute(HostPtr src, HostPtr dst);
-  ActionPtr communicate(HostPtr src, HostPtr dst, double size, double rate);
+  Host *createHost(const char *name);
+  Action *executeParallelTask(int host_nb,
+                              sg_host_t *host_list,
+                                                         double *flops_amount,
+                                                         double *bytes_amount,
+                                                         double rate);
+  xbt_dynar_t getRoute(Host *src, Host *dst);
   void addTraces();
-  NetworkModelPtr p_networkModel;
+  NetworkModel *p_networkModel;
 };
 
 class CpuL07Model : public CpuModel {
 public:
-  CpuL07Model() : CpuModel("cpuL07") {};
+  CpuL07Model() : CpuModel() {};
   ~CpuL07Model() {surf_cpu_model_pm = NULL;};
-  CpuPtr createCpu(const char *name,  xbt_dynar_t powerPeak,
+  Cpu *createCpu(const char *name,  xbt_dynar_t powerPeak,
                           int pstate, double power_scale,
                           tmgr_trace_t power_trace, int core,
                           e_surf_resource_state_t state_initial,
@@ -72,14 +60,14 @@ public:
                           xbt_dict_t cpu_properties);
   void addTraces() {DIE_IMPOSSIBLE;};
 
-  HostL07ModelPtr p_hostModel;
+  HostL07Model *p_hostModel;
 };
 
 class NetworkL07Model : public NetworkModel {
 public:
   NetworkL07Model() : NetworkModel() {};
   ~NetworkL07Model() {surf_network_model = NULL;};
-  NetworkLinkPtr createNetworkLink(const char *name,
+  Link* createLink(const char *name,
                                                   double bw_initial,
                                                   tmgr_trace_t bw_trace,
                                                   double lat_initial,
@@ -90,9 +78,11 @@ public:
                                                   e_surf_link_sharing_policy_t
                                                   policy, xbt_dict_t properties);
 
-  ActionPtr communicate(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, double /*size*/, double /*rate*/) {DIE_IMPOSSIBLE;};
+  Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
   void addTraces() {DIE_IMPOSSIBLE;};
-  HostL07ModelPtr p_hostModel;
+  bool shareResourcesIsIdempotent() {return true;}
+
+  HostL07Model *p_hostModel;
 };
 
 /************
@@ -101,12 +91,12 @@ public:
 
 class HostL07 : public Host {
 public:
-  HostL07(HostModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu);
+  HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu);
   //bool isUsed();
   bool isUsed() {DIE_IMPOSSIBLE;};
   void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
-  ActionPtr execute(double size);
-  ActionPtr sleep(double duration);
+  Action *execute(double size);
+  Action *sleep(double duration);
   e_surf_resource_state_t getState();
   double getPowerPeakAt(int pstate_index);
   int getNbPstates();
@@ -120,14 +110,14 @@ class CpuL07 : public Cpu {
   tmgr_trace_event_t p_stateEvent;
   tmgr_trace_event_t p_powerEvent;
 public:
-  CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties,
+  CpuL07(CpuL07Model *model, const char* name, xbt_dict_t properties,
                 double power_scale, double power_initial, tmgr_trace_t power_trace,
      int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
   bool isUsed();
   //bool isUsed() {DIE_IMPOSSIBLE;};
   void updateState(tmgr_trace_event_t event_type, double value, double date);
-  CpuActionPtr execute(double /*size*/) {DIE_IMPOSSIBLE;};
-  CpuActionPtr sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
+  CpuAction *execute(double /*size*/) {DIE_IMPOSSIBLE;};
+  CpuAction *sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
 
   double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
   double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
@@ -137,9 +127,9 @@ public:
   double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
 };
 
-class LinkL07 : public NetworkLink {
+class LinkL07 : public Link {
 public:
-  LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
+  LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
                  double bw_initial,
           tmgr_trace_t bw_trace,
           double lat_initial,
@@ -167,18 +157,18 @@ public:
 /**********
  * Action *
  **********/
-class HostL07Action : public HostAction {
-  friend ActionPtr HostL07::execute(double size);
-  friend ActionPtr HostL07::sleep(double duration);
-  friend ActionPtr HostL07Model::executeParallelTask(int host_nb,
-                                                     void **host_list,
+class L07Action : public HostAction {
+  friend Action *HostL07::execute(double size);
+  friend Action *HostL07::sleep(double duration);
+  friend Action *HostL07Model::executeParallelTask(int host_nb,
+                                                   sg_host_t*host_list,
                                                    double *flops_amount,
                                                                                                   double *bytes_amount,
                                                    double rate);
 public:
-  HostL07Action(ModelPtr model, double cost, bool failed)
+  L07Action(Model *model, double cost, bool failed)
   : HostAction(model, cost, failed) {};
- ~HostL07Action();
+ ~L07Action();
 
   void updateBound();
 
@@ -191,8 +181,7 @@ public:
   void setPriority(double priority);
   double getRemains();
 
-  int m_hostNb;
-  HostPtr *p_hostList;
+  vector<RoutingEdge*> * p_edgeList = new vector<RoutingEdge*>();
   double *p_computationAmount;
   double *p_communicationAmount;
   double m_latency;
index fc8b453..7152a9e 100644 (file)
@@ -48,7 +48,7 @@ lmm_system_t lmm_system_new(int selective_update)
   l->selective_update_active = selective_update;
   l->visited_counter = 1;
 
-  XBT_DEBUG("Setting selective_update_active flag to %d\n",
+  XBT_DEBUG("Setting selective_update_active flag to %d",
          l->selective_update_active);
 
   xbt_swag_init(&(l->variable_set),
@@ -676,7 +676,7 @@ void lmm_solve(lmm_system_t sys)
           cnst->usage = elem->value / elem->variable->weight;
 
         make_elem_active(elem);
-        ActionPtr action = static_cast<ActionPtr>(elem->variable->id);
+        Action *action = static_cast<Action*>(elem->variable->id);
         if (sys->keep_track && !action->is_linked())
           sys->keep_track->push_back(*action);
       }
index 37fc271..1ce6db8 100644 (file)
@@ -54,7 +54,7 @@ void surf_network_model_init_LegrandVelho(void)
 
   surf_network_model = new NetworkCm02Model();
   net_define_callbacks();
-  ModelPtr model = surf_network_model;
+  Model *model = surf_network_model;
   xbt_dynar_push(model_list, &model);
 
   xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",
@@ -83,7 +83,7 @@ void surf_network_model_init_CM02(void)
 
   surf_network_model = new NetworkCm02Model();
   net_define_callbacks();
-  ModelPtr model = surf_network_model;
+  Model *model = surf_network_model;
   xbt_dynar_push(model_list, &model);
 
   xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0);
@@ -109,7 +109,7 @@ void surf_network_model_init_Reno(void)
 
   surf_network_model = new NetworkCm02Model();
   net_define_callbacks();
-  ModelPtr model = surf_network_model;
+  Model *model = surf_network_model;
   xbt_dynar_push(model_list, &model);
   lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
                                     func_reno_fpi);
@@ -129,7 +129,7 @@ void surf_network_model_init_Reno2(void)
 
   surf_network_model = new NetworkCm02Model();
   net_define_callbacks();
-  ModelPtr model = surf_network_model;
+  Model *model = surf_network_model;
   xbt_dynar_push(model_list, &model);
   lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp,
                                     func_reno2_fpi);
@@ -149,7 +149,7 @@ void surf_network_model_init_Vegas(void)
 
   surf_network_model = new NetworkCm02Model();
   net_define_callbacks();
-  ModelPtr model = surf_network_model;
+  Model *model = surf_network_model;
   xbt_dynar_push(model_list, &model);
   lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
                                     func_vegas_fpi);
@@ -161,7 +161,8 @@ void surf_network_model_init_Vegas(void)
   xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775);
 }
 
-void NetworkCm02Model::initialize()
+NetworkCm02Model::NetworkCm02Model()
+       :NetworkModel()
 {
   char *optim = xbt_cfg_get_string(_sg_cfg_set, "network/optim");
   int select =
@@ -185,11 +186,10 @@ void NetworkCm02Model::initialize()
   if (!p_maxminSystem)
        p_maxminSystem = lmm_system_new(m_selectiveUpdate);
 
-  const char* lb_name = "__loopback__";
-  routing_model_create(createNetworkLink(lb_name,
-                                                  498000000, NULL, 0.000015, NULL,
-                                                  SURF_RESOURCE_ON, NULL,
-                                                  SURF_LINK_FATPIPE, NULL));
+  routing_model_create(createLink("__loopback__",
+                                     498000000, NULL, 0.000015, NULL,
+                                     SURF_RESOURCE_ON, NULL,
+                                     SURF_LINK_FATPIPE, NULL));
 
   if (p_updateMechanism == UM_LAZY) {
        p_actionHeap = xbt_heap_new(8, NULL);
@@ -201,7 +201,7 @@ void NetworkCm02Model::initialize()
   m_haveGap = false;
 }
 
-NetworkLinkPtr NetworkCm02Model::createNetworkLink(const char *name,
+Link* NetworkCm02Model::createLink(const char *name,
                                  double bw_initial,
                                  tmgr_trace_t bw_trace,
                                  double lat_initial,
@@ -211,27 +211,20 @@ NetworkLinkPtr NetworkCm02Model::createNetworkLink(const char *name,
                                  e_surf_link_sharing_policy_t policy,
                                  xbt_dict_t properties)
 {
-  xbt_assert(!xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL),
-             "Link '%s' declared several times in the platform file.",
+  xbt_assert(NULL == Link::byName(name),
+             "Link '%s' declared several times in the platform",
              name);
 
-  NetworkCm02LinkPtr nw_link =
-                 new NetworkCm02Link(this, name, properties, p_maxminSystem, sg_bandwidth_factor * bw_initial, history,
-                                                state_initial, state_trace, bw_initial, bw_trace, lat_initial, lat_trace, policy);
-
-
-  xbt_lib_set(link_lib, name, SURF_LINK_LEVEL, nw_link);
-  XBT_DEBUG("Create link '%s'",name);
-
-  return nw_link;
+  return new NetworkCm02Link(this, name, properties, p_maxminSystem, sg_bandwidth_factor * bw_initial, history,
+                                            state_initial, state_trace, bw_initial, bw_trace, lat_initial, lat_trace, policy);
 }
 
 void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
 {
-  NetworkCm02ActionPtr action;
+  NetworkCm02Action *action;
   while ((xbt_heap_size(p_actionHeap) > 0)
          && (double_equals(xbt_heap_maxkey(p_actionHeap), now, sg_surf_precision))) {
-    action = (NetworkCm02ActionPtr) xbt_heap_pop(p_actionHeap);
+    action = static_cast<NetworkCm02Action*> (xbt_heap_pop(p_actionHeap));
     XBT_DEBUG("Something happened to action %p", action);
     if (TRACE_is_enabled()) {
       int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->getVariable());
@@ -240,7 +233,7 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
         lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem,
                                                             action->getVariable(),
                                                             i);
-        NetworkCm02LinkPtr link = static_cast<NetworkCm02LinkPtr>(lmm_constraint_id(constraint));
+        NetworkCm02Link *link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
         TRACE_surf_link_set_utilization(link->getName(),
                                         action->getCategory(),
                                         (lmm_variable_getvalue(action->getVariable())*
@@ -279,14 +272,14 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
 
 void NetworkCm02Model::updateActionsStateFull(double now, double delta)
 {
-  NetworkCm02ActionPtr action;
-  ActionListPtr running_actions = getRunningActionSet();
+  NetworkCm02Action *action;
+  ActionList *running_actions = getRunningActionSet();
 
   for(ActionList::iterator it(running_actions->begin()), itNext=it, itend(running_actions->end())
      ; it != itend ; it=itNext) {
        ++itNext;
 
-    action = (NetworkCm02ActionPtr) &*it;
+    action = static_cast<NetworkCm02Action*> (&*it);
     XBT_DEBUG("Something happened to action %p", action);
       double deltap = delta;
       if (action->m_latency > 0) {
@@ -308,7 +301,7 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
           lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem,
                                                             action->getVariable(),
                                                             i);
-          NetworkCm02LinkPtr link = static_cast<NetworkCm02LinkPtr>(lmm_constraint_id(constraint));
+          NetworkCm02Link* link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
           TRACE_surf_link_set_utilization(link->getName(),
                                         action->getCategory(),
                                         (lmm_variable_getvalue(action->getVariable())*
@@ -347,20 +340,20 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
   return;
 }
 
-ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst,
                                                 double size, double rate)
 {
   unsigned int i;
   void *_link;
-  NetworkCm02LinkPtr link;
+  NetworkCm02Link *link;
   int failed = 0;
-  NetworkCm02ActionPtr action = NULL;
+  NetworkCm02Action *action = NULL;
   double bandwidth_bound;
   double latency = 0.0;
   xbt_dynar_t back_route = NULL;
   int constraints_per_variable = 0;
 
-  xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdgePtr), NULL);
+  xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdge*), NULL);
 
   XBT_IN("(%s,%s,%g,%g)", src->getName(), dst->getName(), size, rate);
 
@@ -370,7 +363,7 @@ ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
              src->getName(), dst->getName());
 
   xbt_dynar_foreach(route, i, _link) {
-       link = static_cast<NetworkCm02LinkPtr>(_link);
+       link = static_cast<NetworkCm02Link*>(_link);
     if (link->getState() == SURF_RESOURCE_OFF) {
       failed = 1;
       break;
@@ -379,7 +372,7 @@ ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
   if (sg_network_crosstraffic == 1) {
          routing_platf->getRouteAndLatency(dst, src, &back_route, NULL);
     xbt_dynar_foreach(back_route, i, _link) {
-      link = static_cast<NetworkCm02LinkPtr>(_link);
+      link = static_cast<NetworkCm02Link*>(_link);
       if (link->getState() == SURF_RESOURCE_OFF) {
         failed = 1;
         break;
@@ -403,12 +396,12 @@ ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
   bandwidth_bound = -1.0;
   if (sg_weight_S_parameter > 0) {
     xbt_dynar_foreach(route, i, _link) {
-      link = static_cast<NetworkCm02LinkPtr>(_link);
+      link = static_cast<NetworkCm02Link*>(_link);
       action->m_weight += sg_weight_S_parameter / link->getBandwidth();
     }
   }
   xbt_dynar_foreach(route, i, _link) {
-       link = static_cast<NetworkCm02LinkPtr>(_link);
+       link = static_cast<NetworkCm02Link*>(_link);
     double bb = bandwidthFactor(size) * link->getBandwidth(); //(link->p_power.peak * link->p_power.scale);
     bandwidth_bound =
         (bandwidth_bound < 0.0) ? bb : min(bandwidth_bound, bb);
@@ -421,7 +414,7 @@ ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
     xbt_assert(!xbt_dynar_is_empty(route),
                "Using a model with a gap (e.g., SMPI) with a platform without links (e.g. vivaldi)!!!");
 
-    link = *static_cast<NetworkCm02LinkPtr *>(xbt_dynar_get_ptr(route, 0));
+    link = *static_cast<NetworkCm02Link **>(xbt_dynar_get_ptr(route, 0));
     gapAppend(size, link, action);
     XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)",
               action, src->getName(), dst->getName(), action->m_senderGap,
@@ -451,14 +444,14 @@ ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
   }
 
   xbt_dynar_foreach(route, i, _link) {
-       link = static_cast<NetworkCm02LinkPtr>(_link);
+       link = static_cast<NetworkCm02Link*>(_link);
     lmm_expand(p_maxminSystem, link->getConstraint(), action->getVariable(), 1.0);
   }
 
   if (sg_network_crosstraffic == 1) {
     XBT_DEBUG("Fullduplex active adding backward flow using 5%%");
     xbt_dynar_foreach(back_route, i, _link) {
-      link = static_cast<NetworkCm02LinkPtr>(_link);
+      link = static_cast<NetworkCm02Link*>(_link);
       lmm_expand(p_maxminSystem, link->getConstraint(), action->getVariable(), .05);
     }
   }
@@ -482,8 +475,7 @@ void NetworkCm02Model::addTraces(){
   /* connect all traces relative to network */
   xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    NetworkCm02LinkPtr link = static_cast<NetworkCm02LinkPtr>(
-                            xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL));
+    NetworkCm02Link *link = static_cast<NetworkCm02Link*>( Link::byName(elm) );
 
     xbt_assert(link, "Cannot connect trace %s to link %s: link undefined",
                trace_name, elm);
@@ -496,8 +488,7 @@ void NetworkCm02Model::addTraces(){
 
   xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    NetworkCm02LinkPtr link = static_cast<NetworkCm02LinkPtr>(
-                                xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL));
+    NetworkCm02Link *link = static_cast<NetworkCm02Link*>( Link::byName(elm) );
 
     xbt_assert(link, "Cannot connect trace %s to link %s: link undefined",
                trace_name, elm);
@@ -510,8 +501,7 @@ void NetworkCm02Model::addTraces(){
 
   xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
-    NetworkCm02LinkPtr link = static_cast<NetworkCm02LinkPtr>(
-                            xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL));
+    NetworkCm02Link *link = static_cast<NetworkCm02Link*>(Link::byName(elm));;
 
     xbt_assert(link, "Cannot connect trace %s to link %s: link undefined",
                trace_name, elm);
@@ -526,7 +516,7 @@ void NetworkCm02Model::addTraces(){
 /************
  * Resource *
  ************/
-NetworkCm02Link::NetworkCm02Link(NetworkCm02ModelPtr model, const char *name, xbt_dict_t props,
+NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
                                   lmm_system_t system,
                                   double constraint_value,
                                   tmgr_history_t history,
@@ -537,7 +527,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02ModelPtr model, const char *name, xb
                                   double lat_initial,
                                   tmgr_trace_t lat_trace,
                                   e_surf_link_sharing_policy_t policy)
-: NetworkLink(model, name, props, lmm_constraint_new(system, this, constraint_value), history, state_trace)
+: Link(model, name, props, lmm_constraint_new(system, this, constraint_value), history, state_trace)
 {
   setState(state_init);
 
@@ -583,7 +573,7 @@ void NetworkCm02Link::updateState(tmgr_trace_event_t event_type,
 
       setState(SURF_RESOURCE_OFF);
       while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), cnst, &elem))) {
-        ActionPtr action = (ActionPtr) lmm_variable_id(var);
+        Action *action = static_cast<Action*>( lmm_variable_id(var) );
 
         if (action->getState() == SURF_ACTION_RUNNING ||
             action->getState() == SURF_ACTION_READY) {
@@ -613,7 +603,7 @@ void NetworkCm02Link::updateBandwidth(double value, double date){
   lmm_element_t nextelem = NULL;
   int numelem = 0;
 
-  NetworkCm02ActionPtr action = NULL;
+  NetworkCm02Action *action = NULL;
 
   p_power.peak = value;
   lmm_update_constraint_bound(getModel()->getMaxminSystem(),
@@ -623,7 +613,7 @@ void NetworkCm02Link::updateBandwidth(double value, double date){
   TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_power.peak * p_power.scale);
   if (sg_weight_S_parameter > 0) {
     while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
-      action = (NetworkCm02ActionPtr) lmm_variable_id(var);
+      action = (NetworkCm02Action*) lmm_variable_id(var);
       action->m_weight += delta;
       if (!action->isSuspended())
         lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
@@ -637,11 +627,11 @@ void NetworkCm02Link::updateLatency(double value, double date){
   lmm_element_t elem = NULL;
   lmm_element_t nextelem = NULL;
   int numelem = 0;
-  NetworkCm02ActionPtr action = NULL;
+  NetworkCm02Action *action = NULL;
 
   m_latCurrent = value;
   while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
-    action = (NetworkCm02ActionPtr) lmm_variable_id(var);
+    action = (NetworkCm02Action*) lmm_variable_id(var);
     action->m_latCurrent += delta;
     action->m_weight += delta;
     if (action->m_rate < 0)
@@ -700,8 +690,4 @@ void NetworkCm02Action::updateRemainingLazy(double now)
   m_lastUpdate = now;
   m_lastValue = lmm_variable_getvalue(getVariable());
 }
-void NetworkCm02Action::recycle()
-{
-  return;
-}
 
index 6eaa6a0..ff805e4 100644 (file)
  * Classes *
  ***********/
 class NetworkCm02Model;
-typedef NetworkCm02Model *NetworkCm02ModelPtr;
-
-class NetworkCm02Link;
-typedef NetworkCm02Link *NetworkCm02LinkPtr;
-
 class NetworkCm02Action;
-typedef NetworkCm02Action *NetworkCm02ActionPtr;
 
 /*********
  * Tools *
@@ -36,41 +30,37 @@ class NetworkCm02Model : public NetworkModel {
 private:
   void initialize();
 public:
-  NetworkCm02Model(int /*i*/) : NetworkModel("network") {
+  NetworkCm02Model(int /*i*/) : NetworkModel() {
        f_networkSolve = lmm_solve;
        m_haveGap = false;
   };//FIXME: add network clean interface
-  NetworkCm02Model(const char *name) : NetworkModel(name) {
-    this->initialize();
-  }
-  NetworkCm02Model() : NetworkModel("network") {
-    this->initialize();
-  }
+  NetworkCm02Model();
   ~NetworkCm02Model() {
   }
-  NetworkLinkPtr createNetworkLink(const char *name,
-                                   double bw_initial,
-                                   tmgr_trace_t bw_trace,
-                                   double lat_initial,
-                                   tmgr_trace_t lat_trace,
-                                   e_surf_resource_state_t state_initial,
-                                   tmgr_trace_t state_trace,
-                                   e_surf_link_sharing_policy_t policy,
-                                   xbt_dict_t properties);
+  Link* createLink(const char *name,
+                 double bw_initial,
+                 tmgr_trace_t bw_trace,
+                 double lat_initial,
+                 tmgr_trace_t lat_trace,
+                 e_surf_resource_state_t state_initial,
+                 tmgr_trace_t state_trace,
+                 e_surf_link_sharing_policy_t policy,
+                 xbt_dict_t properties);
   void addTraces();
   void updateActionsStateLazy(double now, double delta);
   void updateActionsStateFull(double now, double delta);
-  ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+  Action *communicate(RoutingEdge *src, RoutingEdge *dst,
                                           double size, double rate);
+  bool shareResourcesIsIdempotent() {return true;}
 };
 
 /************
  * Resource *
  ************/
 
-class NetworkCm02Link : public NetworkLink {
+class NetworkCm02Link : public Link {
 public:
-  NetworkCm02Link(NetworkCm02ModelPtr model, const char *name, xbt_dict_t props,
+  NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
                                   lmm_system_t system,
                                   double constraint_value,
                                   tmgr_history_t history,
@@ -92,13 +82,12 @@ public:
  **********/
 
 class NetworkCm02Action : public NetworkAction {
-  friend ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate);
+  friend Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
 
 public:
-  NetworkCm02Action(ModelPtr model, double cost, bool failed)
- : NetworkAction(model, cost, failed) {};
+  NetworkCm02Action(Model *model, double cost, bool failed)
    : NetworkAction(model, cost, failed) {};
   void updateRemainingLazy(double now);
-  void recycle();
 };
 
 #endif /* SURF_NETWORK_CM02_HPP_ */
index 06001ba..47f923f 100644 (file)
@@ -24,19 +24,19 @@ void surf_network_model_init_Constant()
 
   sg_platf_host_add_cb(netcste_count_hosts);
 
-  ModelPtr model = surf_network_model;
+  Model *model = surf_network_model;
   xbt_dynar_push(model_list, &model);
 }
 
 double NetworkConstantModel::shareResources(double /*now*/)
 {
-  NetworkConstantActionPtr action = NULL;
+  NetworkConstantAction *action = NULL;
   double min = -1.0;
 
-  ActionListPtr actionSet = getRunningActionSet();
+  ActionList *actionSet = getRunningActionSet();
   for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end())
         ; it != itend ; ++it) {
-       action = static_cast<NetworkConstantActionPtr>(&*it);
+       action = static_cast<NetworkConstantAction*>(&*it);
         if (action->m_latency > 0 && (min < 0 || action->m_latency < min))
             min = action->m_latency;
   }
@@ -46,12 +46,12 @@ double NetworkConstantModel::shareResources(double /*now*/)
 
 void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
 {
-  NetworkConstantActionPtr action = NULL;
-  ActionListPtr actionSet = getRunningActionSet();
+  NetworkConstantAction *action = NULL;
+  ActionList *actionSet = getRunningActionSet();
   for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
      ; it != itend ; it=itNext) {
     ++itNext;
-       action = static_cast<NetworkConstantActionPtr>(&*it);
+       action = static_cast<NetworkConstantAction*>(&*it);
     if (action->m_latency > 0) {
       if (action->m_latency > delta) {
         double_update(&(action->m_latency), delta, sg_surf_precision);
@@ -74,14 +74,14 @@ void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
   }
 }
 
-ActionPtr NetworkConstantModel::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+Action *NetworkConstantModel::communicate(RoutingEdge *src, RoutingEdge *dst,
                                         double size, double rate)
 {
   char *src_name = src->getName();
   char *dst_name = dst->getName();
 
   XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
-  NetworkConstantActionPtr action = new NetworkConstantAction(this, size, sg_latency_factor);
+  NetworkConstantAction *action = new NetworkConstantAction(this, size, sg_latency_factor);
   XBT_OUT();
 
   surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate);
@@ -157,11 +157,6 @@ void NetworkConstantAction::resume()
        m_suspended = false;
 }
 
-void NetworkConstantAction::recycle()
-{
-  return;
-}
-
 bool NetworkConstantAction::isSuspended()
 {
   return m_suspended;
index e793ac3..2b0f0e0 100644 (file)
  * Classes *
  ***********/
 class NetworkConstantModel;
-typedef NetworkConstantModel *NetworkConstantModelPtr;
-
-class NetworkConstantLink;
-typedef NetworkConstantLink *NetworkConstantLinkPtr;
-
 class NetworkConstantAction;
-typedef NetworkConstantAction *NetworkConstantActionPtr;
 
 /*********
  * Model *
@@ -27,15 +21,14 @@ typedef NetworkConstantAction *NetworkConstantActionPtr;
 class NetworkConstantModel : public NetworkCm02Model {
 public:
   NetworkConstantModel()
-  : NetworkCm02Model("constant time network")
+  : NetworkCm02Model()
   {
     p_updateMechanism = UM_UNDEFINED;
   };
   double shareResources(double now);
   void updateActionsState(double now, double delta);
-  ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
-                                          double size, double rate);
-  void gapRemove(ActionPtr action);
+  Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
+  void gapRemove(Action *action);
 };
 
 /************
@@ -43,7 +36,7 @@ public:
  ************/
 class NetworkConstantLink : public NetworkCm02Link {
 public:
-  NetworkConstantLink(NetworkCm02ModelPtr model, const char* name, xbt_dict_t properties);
+  NetworkConstantLink(NetworkCm02Model *model, const char* name, xbt_dict_t properties);
   bool isUsed();
   void updateState(tmgr_trace_event_t event_type, double value, double date);
   double getBandwidth();
@@ -56,7 +49,7 @@ public:
  **********/
 class NetworkConstantAction : public NetworkCm02Action {
 public:
-  NetworkConstantAction(NetworkConstantModelPtr model_, double size, double latency)
+  NetworkConstantAction(NetworkConstantModel *model_, double size, double latency)
   : NetworkCm02Action(model_, size, false)
   , m_latInit(latency)
   {
@@ -68,7 +61,6 @@ public:
        p_variable = NULL;
   };
   int unref();
-  void recycle();
   void cancel();
   void setCategory(const char *category);
   void suspend();
index 894feae..d6a35e3 100644 (file)
@@ -24,7 +24,7 @@ void newRoute(int src_id, int dst_id,
                      xbt_dynar_t links, int nb_link)
 {
   void *_link;
-  NetworkGTNetsLinkPtr link;
+  NetworkGTNetsLink *link;
   unsigned int cursor;
   int i = 0;
   int *gtnets_links;
@@ -36,7 +36,7 @@ void newRoute(int src_id, int dst_id,
   gtnets_links = xbt_new0(int, nb_link);
   i = 0;
   xbt_dynar_foreach(links, cursor, _link) {
-       link = (NetworkGTNetsLinkPtr) _link;
+       link = (NetworkGTNetsLink*) _link;
     gtnets_links[i++] = link->m_id;
   }
 
@@ -47,7 +47,7 @@ void newRoute(int src_id, int dst_id,
 }
 
 void newRouteOnehop(int src_id, int dst_id,
-                    NetworkGTNetsLinkPtr link)
+                    NetworkGTNetsLink *link)
 {
   if (gtnets_add_onehop_route(src_id, dst_id, link->m_id)) {
     xbt_die("Cannot create GTNetS route");
index 7cc1c5a..7f320f4 100644 (file)
@@ -4,7 +4,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "network.hpp"
+#include "network_cm02.hpp"
 
 #ifndef NETWORK_GTNETS_HPP_
 #define NETWORK_GTNETS_HPP_
@@ -21,6 +21,7 @@
 #include "event.h"
 #include "routing-manual.h"
 #include "red.h"
+#include "surf/gtnets/gtnets_topology.h"
 
 xbt_dict_t network_card_ids;
 
@@ -30,9 +31,6 @@ xbt_dict_t network_card_ids;
 class NetworkGTNetsModel;
 typedef NetworkGTNetsModel *NetworkGTNetsModelPtr;
 
-class NetworkGTNetsLink;
-typedef NetworkGTNetsLink *NetworkGTNetsLinkPtr;
-
 class NetworkGTNetsAction;
 typedef NetworkGTNetsAction *NetworkGTNetsActionPtr;
 
@@ -79,7 +77,7 @@ private:
 
    map<int, TCPServer*> p_gtnetsServers;
    map<int, TCPSend*> p_gtnetsClients;
-   map<int, Linkp2p*> p_gtnetsLinks_;
+   map<int, GTLinkp2p*> p_gtnetsLinks_;
    map<int, Node*> p_gtnetsNodes;
    map<void*, int> p_gtnetsActionToFlow;
 
index 9c9854c..cecdfc8 100644 (file)
@@ -24,7 +24,7 @@ static void IB_create_host_callback(sg_platf_host_cbarg_t t){
  
 }
 
-static void IB_action_state_changed_callback(NetworkActionPtr action, e_surf_action_state_t statein, e_surf_action_state_t stateout){
+static void IB_action_state_changed_callback(NetworkAction *action, e_surf_action_state_t statein, e_surf_action_state_t stateout){
  if(statein!=SURF_ACTION_RUNNING|| stateout!=SURF_ACTION_DONE)
     return;
   std::pair<IBNode*,IBNode*> pair = ((NetworkIBModel*)surf_network_model)->active_comms[action];
@@ -37,7 +37,7 @@ static void IB_action_state_changed_callback(NetworkActionPtr action, e_surf_act
 }
 
 
-static void IB_action_init_callback(NetworkActionPtr action,RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate){
+static void IB_action_init_callback(NetworkAction *action,RoutingEdge *src, RoutingEdge *dst, double size, double rate){
   if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL)
     xbt_die("IB comm added, without any node connected !");
   
@@ -184,7 +184,7 @@ void NetworkIBModel::updateIBfactors_rec(IBNode *root, bool* updatedlist) {
 }
 
 
-void NetworkIBModel::updateIBfactors(NetworkActionPtr action, IBNode *from, IBNode * to, int remove) {
+void NetworkIBModel::updateIBfactors(NetworkAction *action, IBNode *from, IBNode * to, int remove) {
   if (from == to)//disregard local comms (should use loopback)
     return;
   
index 7328b97..77e361e 100644 (file)
@@ -15,7 +15,7 @@ class ActiveComm{
 public :
   //IBNode* origin;
   IBNode* destination;
-  NetworkActionPtr action;
+  NetworkAction *action;
   double init_rate;
   ActiveComm() : destination(NULL),action(NULL),init_rate(-1){};
   ~ActiveComm(){};
@@ -42,10 +42,10 @@ public:
   NetworkIBModel();
   NetworkIBModel(const char *name);
   ~NetworkIBModel();
-  void updateIBfactors(NetworkActionPtr action, IBNode *from, IBNode * to, int remove);
+  void updateIBfactors(NetworkAction *action, IBNode *from, IBNode * to, int remove);
   
   xbt_dict_t active_nodes;
-  std::map<NetworkActionPtr , std::pair<IBNode*,IBNode*> > active_comms;
+  std::map<NetworkAction *, std::pair<IBNode*,IBNode*> > active_comms;
   
   double Bs;
   double Be;
index 63f1356..37ee98e 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf,
                                 "Logging specific to the SURF network module");
 
+/*********
+ * C API *
+ *********/
+SG_BEGIN_DECL()
+const char* sg_link_name(Link *link) {
+  return link->getName();
+}
+Link * sg_link_by_name(const char* name) {
+  return Link::byName(name);
+}
+
+int sg_link_is_shared(Link *link){
+  return link->isShared();
+}
+double sg_link_bandwidth(Link *link){
+  return link->getBandwidth();
+}
+double sg_link_latency(Link *link){
+  return link->getLatency();
+}
+void* sg_link_data(Link *link) {
+       return link->getData();
+}
+void sg_link_data_set(Link *link,void *data) {
+       link->setData(data);
+}
+int sg_link_amount(void) {
+       return Link::linksAmount();
+}
+Link** sg_link_list(void) {
+       return Link::linksList();
+}
+void sg_link_exit(void) {
+       Link::linksExit();
+}
+SG_END_DECL()
+/*****************
+ * List of links *
+ *****************/
+
+boost::unordered_map<std::string,Link *> *Link::links = new boost::unordered_map<std::string,Link *>();
+Link *Link::byName(const char* name) {
+         Link * res = NULL;
+         try {
+                 res = links->at(name);
+         } catch (std::out_of_range& e) {}
+
+         return res;
+}
+/** @brief Returns the amount of links in the platform */
+int Link::linksAmount() {
+         return links->size();
+}
+/** @brief Returns a list of all existing links */
+Link **Link::linksList() {
+         Link **res = xbt_new(Link*, (int)links->size());
+         int i=0;
+         for (auto kv : *links) {
+                 res[i++] = kv.second;
+         }
+         return res;
+}
+/** @brief destructor of the static data */
+void Link::linksExit() {
+       for (auto kv : *links)
+               delete (kv.second);
+}
 /*************
  * Callbacks *
  *************/
 
-surf_callback(void, NetworkLinkPtr) networkLinkCreatedCallbacks;
-surf_callback(void, NetworkLinkPtr) networkLinkDestructedCallbacks;
-surf_callback(void, NetworkLinkPtr, e_surf_resource_state_t, e_surf_resource_state_t) networkLinkStateChangedCallbacks;
-surf_callback(void, NetworkActionPtr, e_surf_action_state_t, e_surf_action_state_t) networkActionStateChangedCallbacks;
-surf_callback(void, NetworkActionPtr, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate) networkCommunicateCallbacks;
+surf_callback(void, Link*) networkLinkCreatedCallbacks;
+surf_callback(void, Link*) networkLinkDestructedCallbacks;
+surf_callback(void, Link*, e_surf_resource_state_t, e_surf_resource_state_t) networkLinkStateChangedCallbacks;
+surf_callback(void, NetworkAction*, e_surf_action_state_t, e_surf_action_state_t) networkActionStateChangedCallbacks;
+surf_callback(void, NetworkAction*, RoutingEdge *src, RoutingEdge *dst, double size, double rate) networkCommunicateCallbacks;
 
 void netlink_parse_init(sg_platf_link_cbarg_t link){
   if (link->policy == SURF_LINK_FULLDUPLEX) {
     char *link_id;
     link_id = bprintf("%s_UP", link->id);
-    surf_network_model->createNetworkLink(link_id,
+    surf_network_model->createLink(link_id,
                       link->bandwidth,
                       link->bandwidth_trace,
                       link->latency,
@@ -36,7 +103,7 @@ void netlink_parse_init(sg_platf_link_cbarg_t link){
                       link->state_trace, link->policy, link->properties);
     xbt_free(link_id);
     link_id = bprintf("%s_DOWN", link->id);
-    surf_network_model->createNetworkLink(link_id,
+    surf_network_model->createLink(link_id,
                       link->bandwidth,
                       link->bandwidth_trace,
                       link->latency,
@@ -45,13 +112,13 @@ void netlink_parse_init(sg_platf_link_cbarg_t link){
                       link->state_trace, link->policy, link->properties);
     xbt_free(link_id);
   } else {
-  surf_network_model->createNetworkLink(link->id,
-                      link->bandwidth,
-                      link->bandwidth_trace,
-                      link->latency,
-                      link->latency_trace,
-                      link->state,
-                      link->state_trace, link->policy, link->properties);
+         surf_network_model->createLink(link->id,
+                         link->bandwidth,
+                         link->bandwidth_trace,
+                         link->latency,
+                         link->latency_trace,
+                         link->state,
+                         link->state_trace, link->policy, link->properties);
   }
 }
 
@@ -63,7 +130,7 @@ void net_add_traces(){
  * Model *
  *********/
 
-NetworkModelPtr surf_network_model = NULL;
+NetworkModel *surf_network_model = NULL;
 
 double NetworkModel::latencyFactor(double /*size*/) {
   return sg_latency_factor;
@@ -79,15 +146,15 @@ double NetworkModel::bandwidthConstraint(double rate, double /*bound*/, double /
 
 double NetworkModel::shareResourcesFull(double now)
 {
-  NetworkActionPtr action = NULL;
-  ActionListPtr runningActions = surf_network_model->getRunningActionSet();
+  NetworkAction *action = NULL;
+  ActionList *runningActions = surf_network_model->getRunningActionSet();
   double minRes;
 
   minRes = shareResourcesMaxMin(runningActions, surf_network_model->p_maxminSystem, surf_network_model->f_networkSolve);
 
   for(ActionList::iterator it(runningActions->begin()), itend(runningActions->end())
        ; it != itend ; ++it) {
-      action = static_cast<NetworkActionPtr>(&*it);
+      action = static_cast<NetworkAction*>(&*it);
 #ifdef HAVE_LATENCY_BOUND_TRACKING
     if (lmm_is_variable_limited_by_latency(action->getVariable())) {
       action->m_latencyLimited = 1;
@@ -109,14 +176,17 @@ double NetworkModel::shareResourcesFull(double now)
  * Resource *
  ************/
 
-NetworkLink::NetworkLink(NetworkModelPtr model, const char *name, xbt_dict_t props)
+Link::Link(NetworkModel *model, const char *name, xbt_dict_t props)
 : Resource(model, name, props)
 , p_latEvent(NULL)
 {
   surf_callback_emit(networkLinkCreatedCallbacks, this);
+  links->insert({name, this});
+
+  XBT_DEBUG("Create link '%s'",name);
 }
 
-NetworkLink::NetworkLink(NetworkModelPtr model, const char *name, xbt_dict_t props,
+Link::Link(NetworkModel *model, const char *name, xbt_dict_t props,
                                 lmm_constraint_t constraint,
                             tmgr_history_t history,
                             tmgr_trace_t state_trace)
@@ -126,39 +196,45 @@ NetworkLink::NetworkLink(NetworkModelPtr model, const char *name, xbt_dict_t pro
   surf_callback_emit(networkLinkCreatedCallbacks, this);
   if (state_trace)
     p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this);
+
+  links->insert({name, this});
+  XBT_DEBUG("Create link '%s'",name);
+
 }
 
-NetworkLink::~NetworkLink()
+Link::~Link()
 {
   surf_callback_emit(networkLinkDestructedCallbacks, this);
 }
 
-bool NetworkLink::isUsed()
+bool Link::isUsed()
 {
   return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint());
 }
 
-double NetworkLink::getLatency()
+double Link::getLatency()
 {
   return m_latCurrent;
 }
 
-double NetworkLink::getBandwidth()
+double Link::getBandwidth()
 {
   return p_power.peak * p_power.scale;
 }
 
-bool NetworkLink::isShared()
+bool Link::isShared()
 {
   return lmm_constraint_is_shared(getConstraint());
 }
 
-void NetworkLink::setState(e_surf_resource_state_t state){
+void Link::setState(e_surf_resource_state_t state){
   e_surf_resource_state_t old = Resource::getState();
   Resource::setState(state);
   surf_callback_emit(networkLinkStateChangedCallbacks, this, old, state);
 }
 
+
+
 /**********
  * Action *
  **********/
index 1db3ddc..1709450 100644 (file)
@@ -3,10 +3,15 @@
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <boost/unordered_map.hpp>
+
 #include "xbt/fifo.h"
 #include "surf_interface.hpp"
 #include "surf_routing.hpp"
 
+#include "simgrid/link.h"
+
 #ifndef SURF_NETWORK_INTERFACE_HPP_
 #define SURF_NETWORK_INTERFACE_HPP_
 
  * Classes *
  ***********/
 class NetworkModel;
-typedef NetworkModel *NetworkModelPtr;
-
-class NetworkLink;
-typedef NetworkLink *NetworkLinkPtr;
-
 class NetworkAction;
-typedef NetworkAction *NetworkActionPtr;
 
 /*************
  * Callbacks *
  *************/
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emits the callbacks after NetworkLink creation
- * @details Callback functions have the following signature: `void(NetworkLinkPtr)`
+ * @brief Callbacks handler which emits the callbacks after Link creation
+ * @details Callback functions have the following signature: `void(Link*)`
  */
-XBT_PUBLIC_DATA( surf_callback(void, NetworkLinkPtr)) networkLinkCreatedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, Link*)) networkLinkCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emits the callbacks after NetworkLink destruction
- * @details Callback functions have the following signature: `void(NetworkLinkPtr)`
+ * @brief Callbacks handler which emits the callbacks after Link destruction
+ * @details Callback functions have the following signature: `void(Link*)`
  */
-XBT_PUBLIC_DATA( surf_callback(void, NetworkLinkPtr)) networkLinkDestructedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, Link*)) networkLinkDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emits the callbacks after NetworkLink State changed
- * @details Callback functions have the following signature: `void(NetworkLinkActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
+ * @brief Callbacks handler which emits the callbacks after Link State changed
+ * @details Callback functions have the following signature: `void(LinkAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
  */
-XBT_PUBLIC_DATA( surf_callback(void, NetworkLinkPtr, e_surf_resource_state_t, e_surf_resource_state_t)) networkLinkStateChangedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, Link*, e_surf_resource_state_t, e_surf_resource_state_t)) networkLinkStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emits the callbacks after NetworkAction State changed
- * @details Callback functions have the following signature: `void(NetworkActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
+ * @details Callback functions have the following signature: `void(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
  */
-XBT_PUBLIC_DATA( surf_callback(void, NetworkActionPtr, e_surf_action_state_t, e_surf_action_state_t)) networkActionStateChangedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, NetworkAction*, e_surf_action_state_t, e_surf_action_state_t)) networkActionStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emits the callbacks after communication created
- * @details Callback functions have the following signature: `void(NetworkActionPtr action, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate)`
+ * @details Callback functions have the following signature: `void(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate)`
  */
-XBT_PUBLIC_DATA( surf_callback(void, NetworkActionPtr, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate)) networkCommunicateCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, NetworkAction*, RoutingEdge *src, RoutingEdge *dst, double size, double rate)) networkCommunicateCallbacks;
 
 /*********
  * Tools *
@@ -72,26 +71,10 @@ XBT_PUBLIC(void) net_add_traces();
  */
 class NetworkModel : public Model {
 public:
-  /**
-   * @brief NetworkModel constructor
-   */
-  NetworkModel() : Model("network") {
-    f_networkSolve = lmm_solve;
-  };
+  /** @brief Constructor */
+  NetworkModel() : Model() { }
 
-  /**
-   * @brief NetworkModel constructor
-   *
-   * @param name The name of the NetworkModel
-   */
-  NetworkModel(const char *name) : Model(name) {
-       f_networkSolve = lmm_solve;
-       m_haveGap = false;
-  };
-
-  /**
-   * @brief The destructor of the NetworkModel
-   */
+  /** @brief Destructor */
   ~NetworkModel() {
        if (p_maxminSystem)
          lmm_system_free(p_maxminSystem);
@@ -102,20 +85,20 @@ public:
   }
 
   /**
-   * @brief Create a NetworkLink
+   * @brief Create a Link
    *
-   * @param name The name of the NetworkLink
-   * @param bw_initial The initial bandwidth of the NetworkLink in bytes per second
-   * @param bw_trace The trace associated to the NetworkLink bandwidth
-   * @param lat_initial The initial latency of the NetworkLink in seconds
-   * @param lat_trace The trace associated to the NetworkLink latency
-   * @param state_initial The initial NetworkLink (state)[e_surf_resource_state_t]
-   * @param state_trace The trace associated to the NetworkLink (state)[e_surf_resource_state_t]
-   * @param policy The sharing policy of the NetworkLink
+   * @param name The name of the Link
+   * @param bw_initial The initial bandwidth of the Link in bytes per second
+   * @param bw_trace The trace associated to the Link bandwidth
+   * @param lat_initial The initial latency of the Link in seconds
+   * @param lat_trace The trace associated to the Link latency
+   * @param state_initial The initial Link (state)[e_surf_resource_state_t]
+   * @param state_trace The trace associated to the Link (state)[e_surf_resource_state_t]
+   * @param policy The sharing policy of the Link
    * @param properties Dictionary of properties associated to this Resource
-   * @return The created NetworkLink
+   * @return The created Link
    */
-  virtual NetworkLinkPtr createNetworkLink(const char *name,
+  virtual Link* createLink(const char *name,
                                    double bw_initial,
                                    tmgr_trace_t bw_trace,
                                    double lat_initial,
@@ -125,7 +108,7 @@ public:
                                    e_surf_link_sharing_policy_t policy,
                                    xbt_dict_t properties)=0;
 
-  virtual void gapAppend(double /*size*/, const NetworkLinkPtr /*link*/, NetworkActionPtr /*action*/) {};
+  virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction */*action*/) {};
 
   /**
    * @brief Create a communication between two hosts.
@@ -139,15 +122,14 @@ public:
    * unlimited.
    * @return The action representing the communication
    */
-  virtual ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+  virtual Action *communicate(RoutingEdge *src, RoutingEdge *dst,
                                           double size, double rate)=0;
 
-  /**
-   * @brief Function pointer to the function to use to solve the lmm_system_t
+  /** @brief Function pointer to the function to use to solve the lmm_system_t
    *
    * @param system The lmm_system_t to solve
    */
-  void (*f_networkSolve)(lmm_system_t);
+  void (*f_networkSolve)(lmm_system_t) = lmm_solve;
 
   /**
    * @brief Get the right multiplicative factor for the latency.
@@ -184,7 +166,7 @@ public:
    */
   virtual double bandwidthConstraint(double rate, double bound, double size);
   double shareResourcesFull(double now);
-  bool m_haveGap;
+  bool m_haveGap = false;
 };
 
 /************
@@ -192,75 +174,57 @@ public:
  ************/
  /** @ingroup SURF_network_interface
   * @brief SURF network link interface class
-  * @details A NetworkLink represents the link between two [hosts](\ref Host)
+  * @details A Link represents the link between two [hosts](\ref Host)
   */
-class NetworkLink : public Resource {
+class Link : public Resource {
 public:
   /**
-   * @brief NetworkLink constructor
+   * @brief Link constructor
    *
-   * @param model The NetworkModel associated to this NetworkLink
-   * @param name The name of the NetworkLink
-   * @param props Dictionary of properties associated to this NetworkLink
+   * @param model The NetworkModel associated to this Link
+   * @param name The name of the Link
+   * @param props Dictionary of properties associated to this Link
    */
-  NetworkLink(NetworkModelPtr model, const char *name, xbt_dict_t props);
+  Link(NetworkModel *model, const char *name, xbt_dict_t props);
 
   /**
-   * @brief NetworkLink constructor
+   * @brief Link constructor
    *
-   * @param model The NetworkModel associated to this NetworkLink
-   * @param name The name of the NetworkLink
-   * @param props Dictionary of properties associated to this NetworkLink
+   * @param model The NetworkModel associated to this Link
+   * @param name The name of the Link
+   * @param props Dictionary of properties associated to this Link
    * @param constraint The lmm constraint associated to this Cpu if it is part of a LMM component
    * @param history [TODO]
    * @param state_trace [TODO]
    */
-  NetworkLink(NetworkModelPtr model, const char *name, xbt_dict_t props,
+  Link(NetworkModel *model, const char *name, xbt_dict_t props,
               lmm_constraint_t constraint,
               tmgr_history_t history,
               tmgr_trace_t state_trace);
 
-  /**
-   * @brief NetworkLink destructor
-   */
-  ~NetworkLink();
+  /** @brief Link destructor */
+  ~Link();
 
-  /**
-   * @brief Get the bandwidth in bytes per second of current NetworkLink
-   *
-   * @return The bandwith in bytes per second of the current NetworkLink
-   */
+  /** @brief Get the bandwidth in bytes per second of current Link */
   virtual double getBandwidth();
 
-  /**
-   * @brief Update the bandwidth in bytes per second of current NetworkLink
-   */
+  /** @brief Update the bandwidth in bytes per second of current Link */
   virtual void updateBandwidth(double value, double date=surf_get_clock())=0;
 
-  /**
-   * @brief Get the latency in seconds of current NetworkLink
-   *
-   * @return The latency in seconds of the current NetworkLink
-   */
+  /** @brief Get the latency in seconds of current Link */
   virtual double getLatency();
 
-  /**
-   * @brief Update the latency in seconds of current NetworkLink
-   */
+  /** @brief Update the latency in seconds of current Link */
   virtual void updateLatency(double value, double date=surf_get_clock())=0;
 
   /**
-   * @brief Check if the NetworkLink is shared
+   * @brief Check if the Link is shared
    *
    * @return true if the current NetwokrLink is shared, false otherwise
    */
   virtual bool isShared();
 
-  /**
-   * @brief Check if the NetworkLink is used
-   *
-   * @return true if the current NetwokrLink is used, false otherwise
-   */
+  /** @brief Check if the Link is used */
   bool isUsed();
 
   void setState(e_surf_resource_state_t state);
@@ -271,8 +235,24 @@ public:
   tmgr_trace_event_t p_latEvent;
 
   /* LMM */
-  tmgr_trace_event_t p_stateEvent;
+  tmgr_trace_event_t p_stateEvent = NULL;
   s_surf_metric_t p_power;
+
+  /* User data */
+public:
+  void *getData()        { return userData;}
+  void  setData(void *d) { userData=d;}
+private:
+  void *userData = NULL;
+
+  /* List of all links */
+private:
+  static boost::unordered_map<std::string, Link *> *links;
+public:
+  static Link *byName(const char* name);
+  static int linksAmount();
+  static Link **linksList();
+  static void linksExit();
 };
 
 /**********
@@ -280,19 +260,17 @@ public:
  **********/
 /** @ingroup SURF_network_interface
  * @brief SURF network action interface class
- * @details A NetworkAction represents a communication between two
- * [hosts](\ref Host)
+ * @details A NetworkAction represents a communication between two [hosts](\ref Host)
  */
 class NetworkAction : public Action {
 public:
-  /**
-   * @brief NetworkAction constructor
+  /** @brief Constructor
    *
    * @param model The NetworkModel associated to this NetworkAction
    * @param cost The cost of this  NetworkAction in [TODO]
    * @param failed [description]
    */
-  NetworkAction(ModelPtr model, double cost, bool failed)
+  NetworkAction(Model *model, double cost, bool failed)
   : Action(model, cost, failed) {}
 
   /**
@@ -304,7 +282,7 @@ public:
    * @param var The lmm variable associated to this Action if it is part of a
    * LMM component
    */
-  NetworkAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
+  NetworkAction(Model *model, double cost, bool failed, lmm_variable_t var)
   : Action(model, cost, failed, var) {};
 
   void setState(e_surf_action_state_t state);
index 75effec..1de003d 100644 (file)
@@ -8,11 +8,9 @@
 #include "surf_private.h"
 #include "simgrid/sg_config.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_ns3, surf,
-                                "Logging specific to the SURF network NS3 module");
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ns3);
 
 extern xbt_lib_t host_lib;
-extern xbt_lib_t link_lib;
 extern xbt_lib_t as_router_lib;
 
 extern xbt_dict_t dict_socket;
@@ -57,7 +55,7 @@ static void parse_ns3_add_link(sg_platf_link_cbarg_t link)
 
   if(!IPV4addr) IPV4addr = xbt_dynar_new(sizeof(char*),free);
 
-  NetworkLinkPtr net_link = surf_network_model->createNetworkLink(link->id,
+  surf_network_model->createLink(link->id,
                                      link->bandwidth,
                                      link->bandwidth_trace,
                                      link->latency,
@@ -66,8 +64,6 @@ static void parse_ns3_add_link(sg_platf_link_cbarg_t link)
                                      link->state_trace,
                                      link->policy,
                                      link->properties);
-
-  xbt_lib_set(link_lib, link->id, SURF_LINK_LEVEL, net_link);
 }
 
 static void parse_ns3_add_router(sg_platf_router_cbarg_t router)
@@ -202,12 +198,12 @@ static void create_ns3_topology(void)
     xbt_die("There is no routes!");
   XBT_DEBUG("Have get_onelink_routes, found %ld routes",onelink_routes->used);
   //save them in trace file
-  OnelinkPtr onelink;
+  Onelink *onelink;
   unsigned int iter;
   xbt_dynar_foreach(onelink_routes, iter, onelink) {
     char *src = onelink->p_src->getName();
     char *dst = onelink->p_dst->getName();
-    NetworkNS3LinkPtr link = static_cast<NetworkNS3LinkPtr>(onelink->p_link);
+    NetworkNS3Link *link = static_cast<NetworkNS3Link *>(onelink->p_link);
 
     if (strcmp(src,dst) && link->m_created){
       XBT_DEBUG("Route from '%s' to '%s' with link '%s'", src, dst, link->getName());
@@ -258,7 +254,7 @@ static void define_callbacks_ns3(void)
  *********/
 static void free_ns3_link(void * elmts)
 {
-  delete static_cast<NetworkNS3LinkPtr>(elmts);
+  delete static_cast<NetworkNS3Link*>(elmts);
 }
 
 static void free_ns3_host(void * elmts)
@@ -277,7 +273,7 @@ void surf_network_model_init_NS3()
   xbt_dynar_push(model_list, &surf_network_model);
 }
 
-NetworkNS3Model::NetworkNS3Model() : NetworkModel("network NS3") {
+NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
   if (ns3_initialize(xbt_cfg_get_string(_sg_cfg_set, "ns3/TcpModel"))) {
     xbt_die("Impossible to initialize NS3 interface");
   }
@@ -294,7 +290,7 @@ NetworkNS3Model::~NetworkNS3Model() {
   xbt_dict_free(&dict_socket);
 }
 
-NetworkLinkPtr NetworkNS3Model::createNetworkLink(const char *name,
+Link* NetworkNS3Model::createLink(const char *name,
                                         double bw_initial,
                                         tmgr_trace_t bw_trace,
                                         double lat_initial,
@@ -312,7 +308,7 @@ NetworkLinkPtr NetworkNS3Model::createNetworkLink(const char *name,
   return new NetworkNS3Link(this, name, properties, bw_initial, lat_initial);
 }
 
-xbt_dynar_t NetworkNS3Model::getRoute(RoutingEdgePtr src, RoutingEdgePtr dst)
+xbt_dynar_t NetworkNS3Model::getRoute(RoutingEdge *src, RoutingEdge *dst)
 {
   xbt_dynar_t route = NULL;
   routing_get_route_and_latency(src, dst, &route, NULL);
@@ -320,11 +316,11 @@ xbt_dynar_t NetworkNS3Model::getRoute(RoutingEdgePtr src, RoutingEdgePtr dst)
   return route;
 }
 
-ActionPtr NetworkNS3Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+Action *NetworkNS3Model::communicate(RoutingEdge *src, RoutingEdge *dst,
                                               double size, double rate)
 {
   XBT_DEBUG("Communicate from %s to %s", src->getName(), dst->getName());
-  NetworkNS3ActionPtr action = new NetworkNS3Action(this, size, 0);
+  NetworkNS3Action *action = new NetworkNS3Action(this, size, 0);
 
   ns3_create_flow(src->getName(), dst->getName(), surf_get_clock(), size, action);
 
@@ -374,9 +370,9 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
     return;
   }
 
-  NetworkNS3ActionPtr action;
+  NetworkNS3Action *action;
   xbt_dict_foreach(dict_socket,cursor,key,data){
-    action = static_cast<NetworkNS3ActionPtr>(ns3_get_socket_action(data));
+    action = static_cast<NetworkNS3Action*>(ns3_get_socket_action(data));
     XBT_DEBUG("Processing socket %p (action %p)",data,action);
     action->setRemains(action->getCost() - ns3_get_socket_sent(data));
 
@@ -390,7 +386,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
        routing_get_route_and_latency (action->p_srcElm, action->p_dstElm, &route, NULL);
        unsigned int i;
        for (i = 0; i < xbt_dynar_length (route); i++){
-               NetworkNS3LinkPtr link = ((NetworkNS3LinkPtr)xbt_dynar_get_ptr (route, i));
+               NetworkNS3Link* link = ((NetworkNS3Link*)xbt_dynar_get_ptr(route, i));
                TRACE_surf_link_set_utilization (link->getName(),
                                action->getCategory(),
                                        (data_delta_sent)/delta,
@@ -412,7 +408,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
     xbt_dynar_pop(socket_to_destroy,&key);
 
     void *data = xbt_dict_get (dict_socket, key);
-    action = static_cast<NetworkNS3ActionPtr>(ns3_get_socket_action(data));
+    action = static_cast<NetworkNS3Action*>(ns3_get_socket_action(data));
     XBT_DEBUG ("Removing socket %p of action %p", key, action);
     xbt_dict_remove(dict_socket, key);
   }
@@ -423,9 +419,9 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
  * Resource *
  ************/
 
-NetworkNS3Link::NetworkNS3Link(NetworkNS3ModelPtr model, const char *name, xbt_dict_t props,
+NetworkNS3Link::NetworkNS3Link(NetworkNS3Model *model, const char *name, xbt_dict_t props,
                                       double bw_initial, double lat_initial)
- : NetworkLink(model, name, props)
+ : Link(model, name, props)
  , p_lat(bprintf("%f", lat_initial))
  , p_bdw(bprintf("%f", bw_initial))
  , m_created(1)
@@ -445,7 +441,7 @@ void NetworkNS3Link::updateState(tmgr_trace_event_t event_type, double value, do
  * Action *
  **********/
 
-NetworkNS3Action::NetworkNS3Action(ModelPtr model, double cost, bool failed)
+NetworkNS3Action::NetworkNS3Action(Model *model, double cost, bool failed)
 : NetworkAction(model, cost, failed)
 {}
 
index 8a29dfd..82bcc7e 100644 (file)
  * Classes *
  ***********/
 class NetworkNS3Model;
-typedef NetworkNS3Model *NetworkNS3ModelPtr;
-
-class NetworkNS3Link;
-typedef NetworkNS3Link *NetworkNS3LinkPtr;
-
 class NetworkNS3Action;
-typedef NetworkNS3Action *NetworkNS3ActionPtr;
 
 /*********
  * Tools *
@@ -37,7 +31,7 @@ public:
   NetworkNS3Model();
 
   ~NetworkNS3Model();
-  NetworkLinkPtr createNetworkLink(const char *name,
+  Link* createLink(const char *name,
                                         double bw_initial,
                                         tmgr_trace_t bw_trace,
                                         double lat_initial,
@@ -46,20 +40,21 @@ public:
                                         tmgr_trace_t state_trace,
                                         e_surf_link_sharing_policy_t policy,
                                         xbt_dict_t properties);
-  xbt_dynar_t getRoute(RoutingEdgePtr src, RoutingEdgePtr dst);
-  ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+  xbt_dynar_t getRoute(RoutingEdge *src, RoutingEdge *dst);
+  Action *communicate(RoutingEdge *src, RoutingEdge *dst,
                                           double size, double rate);
   double shareResources(double now);
   void updateActionsState(double now, double delta);
   void addTraces(){DIE_IMPOSSIBLE;}
+  bool shareResourcesIsIdempotent() {return false;}
 };
 
 /************
  * Resource *
  ************/
-class NetworkNS3Link : public NetworkLink {
+class NetworkNS3Link : public Link {
 public:
-  NetworkNS3Link(NetworkNS3ModelPtr model, const char *name, xbt_dict_t props,
+  NetworkNS3Link(NetworkNS3Model *model, const char *name, xbt_dict_t props,
                         double bw_initial, double lat_initial);
   ~NetworkNS3Link();
 
@@ -81,7 +76,7 @@ public:
  **********/
 class NetworkNS3Action : public NetworkAction {
 public:
-  NetworkNS3Action(ModelPtr model, double cost, bool failed);
+  NetworkNS3Action(Model *model, double cost, bool failed);
 
 #ifdef HAVE_LATENCY_BOUND_TRACKING
   int getLatencyLimited();
@@ -94,8 +89,8 @@ void resume();
 
 //private:
   double m_lastSent;
-  RoutingEdgePtr p_srcElm;
-  RoutingEdgePtr p_dstElm;
+  RoutingEdge *p_srcElm;
+  RoutingEdge *p_dstElm;
 };
 
 
index e5967be..da20927 100644 (file)
@@ -104,12 +104,10 @@ NetworkSmpiModel::~NetworkSmpiModel(){
   }
 }
 
-void NetworkSmpiModel::gapAppend(double size, const NetworkLinkPtr link, NetworkActionPtr action)
+void NetworkSmpiModel::gapAppend(double size, Link* link, NetworkAction *action)
 {
   const char *src = link->getName();
   xbt_fifo_t fifo;
-  //surf_action_network_CM02_t last_action;
-  //double bw;
 
   if (sg_sender_gap > 0.0) {
     if (!gap_lookup) {
@@ -141,11 +139,11 @@ void NetworkSmpiModel::gapAppend(double size, const NetworkLinkPtr link, Network
   }
 }
 
-void NetworkSmpiModel::gapRemove(ActionPtr lmm_action)
+void NetworkSmpiModel::gapRemove(Action *lmm_action)
 {
   xbt_fifo_t fifo;
   size_t size;
-  NetworkCm02ActionPtr action = static_cast<NetworkCm02ActionPtr>(lmm_action);
+  NetworkCm02Action *action = static_cast<NetworkCm02Action*>(lmm_action);
 
   if (sg_sender_gap > 0.0 && action->p_senderLinkName
       && action->p_senderFifoItem) {
index a27ef04..6d7bd44 100644 (file)
@@ -11,7 +11,6 @@
  ***********/
 
 class NetworkSmpiModel;
-typedef NetworkSmpiModel *NetworkSmpiModelPtr;
 
 /*********
  * Tools *
@@ -26,8 +25,8 @@ public:
   NetworkSmpiModel();
   ~NetworkSmpiModel();
 
-  void gapAppend(double size, const NetworkLinkPtr link, NetworkActionPtr action);
-  void gapRemove(ActionPtr action);
+  void gapAppend(double size, Link* link, NetworkAction *action);
+  void gapRemove(Action *action);
   double latencyFactor(double size);
   double bandwidthFactor(double size);
   double bandwidthConstraint(double rate, double bound, double size);
index b5a80b8..7ac53db 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 #include <ns3/abort.h>
-#include "ns3/log.h"
 #include "ns3/simulator.h"
 #include "ns3/point-to-point-net-device.h"
 #include "ns3/point-to-point-channel.h"
@@ -40,7 +39,9 @@
 #include "ns3/trace-helper.h"
 #include "my-point-to-point-helper.h"
 
-NS_LOG_COMPONENT_DEFINE ("MyPointToPointHelper");
+#include "xbt/log.h"
+
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ns3);
 
 ///> RED Parameters  see src/node/red-queue.* for details
 //.AddAttribute ("Mode",
@@ -163,7 +164,7 @@ MyPointToPointHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd,
   Ptr<PointToPointNetDevice> device = nd->GetObject<PointToPointNetDevice> ();
   if (device == 0)
     {
-      NS_LOG_INFO ("MyPointToPointHelper::EnablePcapInternal(): Device " << device << " not of type ns3::PointToPointNetDevice");
+      XBT_INFO ("MyPointToPointHelper::EnablePcapInternal(): Device not of type ns3::PointToPointNetDevice");
       return;
     }
 
@@ -199,8 +200,7 @@ MyPointToPointHelper::EnableAsciiInternal (
   Ptr<PointToPointNetDevice> device = nd->GetObject<PointToPointNetDevice> ();
   if (device == 0)
     {
-      NS_LOG_INFO ("MyPointToPointHelper::EnableAsciiInternal(): Device " << device <<
-                   " not of type ns3::PointToPointNetDevice");
+      XBT_INFO ("MyPointToPointHelper::EnableAsciiInternal(): Device not of type ns3::PointToPointNetDevice");
       return;
     }
 
index 900f77b..0b9b1a3 100644 (file)
@@ -17,7 +17,7 @@ extern xbt_lib_t host_lib;
 extern int NS3_HOST_LEVEL;             //host node for ns3
 extern xbt_dynar_t IPV4addr;
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(interface_ns3, surf,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ns3, surf,
                                 "Logging specific to the SURF network NS3 module");
 
 InternetStackHelper stack;
index 4ad133e..7898de3 100644 (file)
@@ -24,8 +24,7 @@ static void StartFlow(Ptr<Socket> sock,
     const char *to,
     uint16_t port_number);
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simulator_ns3, surf,
-                                "Logging specific to the SURF network NS3 module");
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ns3);
 
 // Constructor.
 NS3Sim::NS3Sim(){
index 116c74b..a0fa181 100644 (file)
 #include "ns3/core-module.h"
 #include "my-point-to-point-helper.h"
 
-#ifdef _NS3_3_10
-  /*NS3 3.10*/
-  #include "ns3/helper-module.h"
-  #include "ns3/simulator-module.h"
-  #include "ns3/node-module.h"
-  #include "ns3/helper-module.h"
-  #include "ns3/global-routing-module.h"
-  #include "ns3/tcp-socket-factory.h"
-#else
-  /*NS3 3.12*/
-  #include "ns3/node.h"
-  #include "ns3/global-route-manager.h"
-  #include "ns3/csma-helper.h"
-  #include "ns3/internet-stack-helper.h"
-  #include "ns3/ipv4-address-helper.h"
-  #include "ns3/point-to-point-helper.h"
-  #include "ns3/packet-sink-helper.h"
-  #include "ns3/inet-socket-address.h"
-  #include "ns3/tcp-socket-factory.h"
-#endif
+#include "ns3/node.h"
+#include "ns3/global-route-manager.h"
+#include "ns3/csma-helper.h"
+#include "ns3/internet-stack-helper.h"
+#include "ns3/ipv4-address-helper.h"
+#include "ns3/point-to-point-helper.h"
+#include "ns3/packet-sink-helper.h"
+#include "ns3/inet-socket-address.h"
+#include "ns3/tcp-socket-factory.h"
 
 using namespace ns3;
 using namespace std;
index 3be1e16..fa38df2 100644 (file)
  *
  */
 
-#include "ns3/log.h"
 #include "ns3/enum.h"
 #include "ns3/uinteger.h"
 #include "ns3/double.h"
 #include "red-queue.h"
 #include "ns3/simulator.h"
 #include "ns3/nstime.h"
-#include "ns3/random-variable.h"
 
 #include <cstdlib>
 
-NS_LOG_COMPONENT_DEFINE ("red");
-
 #define RED_STATS_TABLE_SIZE 256
 #define RED_STATS_MASK (RED_STATS_TABLE_SIZE - 1)
 
@@ -46,7 +42,7 @@ NS_OBJECT_ENSURE_REGISTERED (RedQueue);
 
 TypeId RedQueue::GetTypeId (void)
 {
-  ///< Note: these paramemters must be worked out beforehand for RED to work correctly
+  ///< Note: these parameters must be worked out beforehand for RED to work correctly
   ///< How these parameters are set up can affect RED performance greatly
   static TypeId tid = TypeId ("ns3::RedQueue")
                       .SetParent<Queue> ()
@@ -123,13 +119,11 @@ RedQueue::RedQueue ()
 
 RedQueue::~RedQueue ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
 }
 
 void
 RedQueue::SetMode (enum Mode mode)
 {
-  NS_LOG_FUNCTION (mode);
   m_mode = mode;
 }
 
@@ -162,7 +156,6 @@ RedQueue::GetAverageQueueSize (void)
 uint32_t
 RedQueue::evalEwma (uint32_t minTh, uint32_t burst, uint32_t avpkt)
 {
-  NS_LOG_FUNCTION (this);
   uint32_t wlog = 1;
 
 
@@ -174,11 +167,9 @@ RedQueue::evalEwma (uint32_t minTh, uint32_t burst, uint32_t avpkt)
   ///< Note: bursts must be larger than minTh/avpkt for it to work
   temp = (double)burst + 1 - (double)minTh / avpkt;
 
-  NS_LOG_DEBUG ( "\t temp =" << temp);
 
   if (temp < 1.0)
     {
-      NS_LOG_DEBUG ("\tFailed to calculate EWMA constant");
       return -1;
     }
 
@@ -198,12 +189,10 @@ RedQueue::evalEwma (uint32_t minTh, uint32_t burst, uint32_t avpkt)
     {
       if (temp <= (1 - pow (1 - W, burst)) / W )
         {
-          NS_LOG_DEBUG ("\t wlog=" << wlog);
           return wlog;
         }
     }
 
-  NS_LOG_DEBUG ("\tFailed to calculate EWMA constant");
   return -1;
 }
 
@@ -222,13 +211,11 @@ RedQueue::evalEwma (uint32_t minTh, uint32_t burst, uint32_t avpkt)
 uint32_t
 RedQueue::evalP (uint32_t minTh, uint32_t maxTh, double prob)
 {
-  NS_LOG_FUNCTION (this);
 
   uint32_t i = maxTh - minTh ;
 
   if (i <= 0)
     {
-      NS_LOG_DEBUG ("maxTh - minTh = 0");
       return -1;
     }
 
@@ -247,11 +234,11 @@ RedQueue::evalP (uint32_t minTh, uint32_t maxTh, double prob)
   ///< Error checking
   if (i >= 32 )
     {
-      NS_LOG_DEBUG ("i >= 32, this shouldn't happen");
+      //NS_LOG_DEBUG ("i >= 32, this shouldn't happen");
       return -1;
     }
 
-  NS_LOG_DEBUG ("\t i(makes C1 power of two)=" << i);
+  //NS_LOG_DEBUG ("\t i(makes C1 power of two)=" << i);
   return i;
 }
 
@@ -269,7 +256,6 @@ RedQueue::evalP (uint32_t minTh, uint32_t maxTh, double prob)
 uint32_t
 RedQueue::evalIdleDamping (uint32_t wLog, uint32_t avpkt, uint32_t bps)
 {
-  NS_LOG_FUNCTION (this);
 
   ///> in microsecond ticks: 1 sec = 1000000 microsecond ticks
   double xmitTime =  ((double) avpkt / bps) * 1000000;
@@ -282,8 +268,8 @@ RedQueue::evalIdleDamping (uint32_t wLog, uint32_t avpkt, uint32_t bps)
   ///> the maximum allow idle time
   double maxTime = 31 / wLogTemp;
 
-  NS_LOG_DEBUG ("\t xmitTime=" << xmitTime << " wLogTemp=" << wLogTemp
-                               << " maxTime=" << maxTime);
+  //NS_LOG_DEBUG ("\t xmitTime=" << xmitTime << " wLogTemp=" << wLogTemp
+  //                             << " maxTime=" << maxTime);
 
 
   uint32_t cLog, i;
@@ -320,7 +306,7 @@ RedQueue::evalIdleDamping (uint32_t wLog, uint32_t avpkt, uint32_t bps)
 
   m_sTable[255] = 31;
 
-  NS_LOG_DEBUG ("\t cLog=" << cLog);
+  //NS_LOG_DEBUG ("\t cLog=" << cLog);
   return cLog;
 }
 
@@ -340,7 +326,6 @@ void
 RedQueue::SetParams (uint32_t minTh, uint32_t maxTh,
                      uint32_t wLog, uint32_t pLog, uint64_t scellLog)
 {
-  NS_LOG_FUNCTION (this);
 
   m_qavg = 0;
   m_count = -1;
@@ -352,20 +337,18 @@ RedQueue::SetParams (uint32_t minTh, uint32_t maxTh,
   m_scellLog = scellLog;
   m_scellMax = (255 << m_scellLog);
 
-  NS_LOG_DEBUG ("\t m_wLog" << m_wLog << " m_pLog" << m_pLog << " m_scellLog" << m_scellLog
-                            << " m_minTh" << m_minTh << " m_maxTh" << m_maxTh
-                            << " rmask=" << m_rmask << " m_scellMax=" << m_scellMax);
+  //NS_LOG_DEBUG ("\t m_wLog" << m_wLog << " m_pLog" << m_pLog << " m_scellLog" << m_scellLog
+  //                          << " m_minTh" << m_minTh << " m_maxTh" << m_maxTh
+  //                          << " rmask=" << m_rmask << " m_scellMax=" << m_scellMax);
 }
 
 int
 RedQueue::IsIdling ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
-
   //use IsZero instead
   if ( m_idleStart.GetNanoSeconds () != 0)
     {
-      NS_LOG_DEBUG ("\t IsIdling");
+      //NS_LOG_DEBUG ("\t IsIdling");
     }
 
   return m_idleStart.GetNanoSeconds () != 0;
@@ -373,23 +356,17 @@ RedQueue::IsIdling ()
 void
 RedQueue::StartIdlePeriod ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
-
   m_idleStart = Simulator::Now ();
 }
 void
 RedQueue::EndIdlePeriod ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
-
   m_idleStart = NanoSeconds (0);
 }
 void
 RedQueue::Restart ()
 {
 
-  NS_LOG_FUNCTION_NOARGS ();
-
   EndIdlePeriod ();
   m_qavg = 0;
   m_count = -1;
@@ -413,8 +390,6 @@ RedQueue::Restart ()
 uint64_t
 RedQueue::AvgFromIdleTime ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
-
   uint64_t idleTime;
   int shift;
 
@@ -426,7 +401,7 @@ RedQueue::AvgFromIdleTime ()
       idleTime = m_scellMax;
     }
 
-  NS_LOG_DEBUG ("\t idleTime=" << idleTime);
+  //NS_LOG_DEBUG ("\t idleTime=" << idleTime);
   //PrintTable ();
 
   shift = m_sTable [(idleTime >>  m_scellLog) & RED_STATS_MASK];
@@ -441,7 +416,7 @@ RedQueue::AvgFromIdleTime ()
       idleTime = (m_qavg * idleTime) >> m_scellLog;
 
 
-      NS_LOG_DEBUG ("\t idleus=" << idleTime);
+     // NS_LOG_DEBUG ("\t idleus=" << idleTime);
 
       if (idleTime < (m_qavg / 2))
         {
@@ -459,10 +434,10 @@ RedQueue::AvgFromIdleTime ()
 uint64_t
 RedQueue::AvgFromNonIdleTime (uint32_t backlog)
 {
-  NS_LOG_FUNCTION (this << backlog);
+  //NS_LOG_FUNCTION (this << backlog);
 
-  NS_LOG_DEBUG ("qavg " << m_qavg);
-  NS_LOG_DEBUG ("backlog" << backlog);
+  //NS_LOG_DEBUG ("qavg " << m_qavg);
+  //NS_LOG_DEBUG ("backlog" << backlog);
 
  /**
   * This is basically EWMA
@@ -476,21 +451,21 @@ RedQueue::AvgFromNonIdleTime (uint32_t backlog)
 uint64_t
 RedQueue::AvgCalc (uint32_t backlog)
 {
-  NS_LOG_FUNCTION (this << backlog);
+  //NS_LOG_FUNCTION (this << backlog);
 
   uint64_t qtemp;
 
   if ( !IsIdling ())
     {
       qtemp = AvgFromNonIdleTime (backlog);
-      NS_LOG_DEBUG ("NonIdle Avg " << qtemp);
+      //NS_LOG_DEBUG ("NonIdle Avg " << qtemp);
       //std::cout <<"n "<< qtemp << std::endl;
       return qtemp;
     }
   else
     {
       qtemp = AvgFromIdleTime ();
-      NS_LOG_DEBUG ("Idle Avg" << qtemp);
+      //NS_LOG_DEBUG ("Idle Avg" << qtemp);
       //std::cout <<"i "<< qtemp << std::endl;
       return qtemp;
     }
@@ -500,8 +475,8 @@ int
 RedQueue::CheckThresh (uint64_t avg)
 {
 
-  NS_LOG_FUNCTION (this << avg);
-  NS_LOG_DEBUG ("\t check threshold: min " << m_minTh << " max" << m_maxTh);
+  //NS_LOG_FUNCTION (this << avg);
+  //NS_LOG_DEBUG ("\t check threshold: min " << m_minTh << " max" << m_maxTh);
 
   if (avg < m_minTh)
     {
@@ -519,7 +494,7 @@ RedQueue::CheckThresh (uint64_t avg)
 uint32_t
 RedQueue::RedRandom ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  //NS_LOG_FUNCTION_NOARGS ();
 
   ///> obtain a random u32 number
   ///> return m_rmask & ran.GetInteger ();
@@ -529,10 +504,10 @@ RedQueue::RedRandom ()
 int
 RedQueue::MarkProbability (uint64_t avg)
 {
-  NS_LOG_FUNCTION (this << avg);
-  NS_LOG_DEBUG ("\t m_randNum " << m_randNum);
-  NS_LOG_DEBUG ("\t right\t" << m_randNum);
-  NS_LOG_DEBUG ("\t left\t" << ((avg - m_minTh)*m_count));
+  //NS_LOG_FUNCTION (this << avg);
+  //NS_LOG_DEBUG ("\t m_randNum " << m_randNum);
+  //NS_LOG_DEBUG ("\t right\t" << m_randNum);
+  //NS_LOG_DEBUG ("\t left\t" << ((avg - m_minTh)*m_count));
 
   ///> max_P* (qavg - qth_min)/(qth_max-qth_min) < rnd/qcount
   //return !((avg - m_minTh ) * m_count < m_randNum);
@@ -544,32 +519,32 @@ int
 RedQueue::Processing (uint64_t qavg)
 {
 
-  NS_LOG_FUNCTION (this << "qavg" << qavg << " m_minTh" << m_minTh << " m_maxTh" << m_maxTh);
+  //NS_LOG_FUNCTION (this << "qavg" << qavg << " m_minTh" << m_minTh << " m_maxTh" << m_maxTh);
 
   switch (CheckThresh (qavg))
     {
     case BELOW_MIN_THRESH:
-      NS_LOG_DEBUG ("\t below threshold ");
+      //NS_LOG_DEBUG ("\t below threshold ");
 
       m_count = -1;
       return DONT_MARK;
 
     case BETWEEN_THRESH:
-      NS_LOG_DEBUG ("\t between threshold ");
+      //NS_LOG_DEBUG ("\t between threshold ");
 
       if (++m_count)
         {
-          NS_LOG_DEBUG ("\t check Mark Prob");
+          //NS_LOG_DEBUG ("\t check Mark Prob");
           if (MarkProbability (qavg))
             {
               m_count = 0;
               m_randNum = RedRandom ();
 
-              NS_LOG_DEBUG ("\t Marked Will Drop " << m_qavg);
+              //NS_LOG_DEBUG ("\t Marked Will Drop " << m_qavg);
 
               return PROB_MARK;
             }
-          NS_LOG_DEBUG ("\t Marked Will Save " << m_qavg);
+          //NS_LOG_DEBUG ("\t Marked Will Save " << m_qavg);
         }
       else
         {
@@ -579,13 +554,13 @@ RedQueue::Processing (uint64_t qavg)
 
     case ABOVE_MAX_THRESH:
 
-      NS_LOG_DEBUG ("\t above threshold ");
+      //NS_LOG_DEBUG ("\t above threshold ");
 
       m_count = -1;
       return HARD_MARK;
     }
 
-  NS_LOG_DEBUG ("BUG HERE\n");
+  //NS_LOG_DEBUG ("BUG HERE\n");
   return DONT_MARK;
 }
 
@@ -593,18 +568,18 @@ RedQueue::Processing (uint64_t qavg)
 bool
 RedQueue::DoEnqueue (Ptr<Packet> p)
 {
-  NS_LOG_FUNCTION (this << p);
+  //NS_LOG_FUNCTION (this << p);
 
   if (m_mode == PACKETS && (m_packets.size () >= m_maxPackets))
     {
-      NS_LOG_LOGIC ("Queue full (at max packets) -- droppping pkt");
+      //NS_LOG_LOGIC ("Queue full (at max packets) -- droppping pkt");
       Drop (p);
       return false;
     }
 
   if (m_mode == BYTES && (m_bytesInQueue + p->GetSize () >= m_maxBytes))
     {
-      NS_LOG_LOGIC ("Queue full (packet would exceed max bytes) -- droppping pkt");
+      //NS_LOG_LOGIC ("Queue full (packet would exceed max bytes) -- droppping pkt");
       Drop (p);
       return false;
     }
@@ -612,11 +587,11 @@ RedQueue::DoEnqueue (Ptr<Packet> p)
   if (!m_initialized)
     {
       // making sure all the variables are initialized ok
-      NS_LOG_DEBUG ("\t m_maxPackets" << m_maxPackets
-                                      << " m_maxBytes" << m_maxBytes
-                                      << " m_burst" << m_burst << " m_avPkt" << m_avPkt
-                                      << " m_minTh" << m_minTh << " m_maxTh" << m_maxTh
-                                      << " m_rate" << m_rate <<  " m_prob" << m_prob);
+      //NS_LOG_DEBUG ("\t m_maxPackets" << m_maxPackets
+      //                                << " m_maxBytes" << m_maxBytes
+      //                                << " m_burst" << m_burst << " m_avPkt" << m_avPkt
+      //                                << " m_minTh" << m_minTh << " m_maxTh" << m_maxTh
+      //                                << " m_rate" << m_rate <<  " m_prob" << m_prob);
 
       m_wLog = evalEwma (m_minTh, m_burst, m_avPkt);
       m_pLog = evalP (m_minTh, m_maxTh, m_prob);
@@ -640,8 +615,8 @@ RedQueue::DoEnqueue (Ptr<Packet> p)
 //      m_qavg = AvgCalc (m_packets.size ());
     }
 
-  NS_LOG_DEBUG ("\t bytesInQueue  " << m_bytesInQueue << "\tQavg " << m_qavg);
-  NS_LOG_DEBUG ("\t packetsInQueue  " << m_packets.size () << "\tQavg " << m_qavg);
+  //NS_LOG_DEBUG ("\t bytesInQueue  " << m_bytesInQueue << "\tQavg " << m_qavg);
+  //NS_LOG_DEBUG ("\t packetsInQueue  " << m_packets.size () << "\tQavg " << m_qavg);
 
 
   if (IsIdling ())
@@ -655,14 +630,14 @@ RedQueue::DoEnqueue (Ptr<Packet> p)
       break;
 
     case PROB_MARK:
-      NS_LOG_DEBUG ("\t Dropping due to Prob Mark " << m_qavg);
+      //NS_LOG_DEBUG ("\t Dropping due to Prob Mark " << m_qavg);
       m_stats.probDrop++;
       m_stats.probMark++;
       Drop (p);
       return false;
 
     case HARD_MARK:
-      NS_LOG_DEBUG ("\t Dropping due to Hard Mark " << m_qavg);
+      //NS_LOG_DEBUG ("\t Dropping due to Hard Mark " << m_qavg);
       m_stats.forcedMark++;
       m_stats.probDrop++;
       Drop (p);
@@ -673,8 +648,8 @@ RedQueue::DoEnqueue (Ptr<Packet> p)
   m_bytesInQueue += p->GetSize ();
   m_packets.push_back (p);
 
-  NS_LOG_LOGIC ("Number packets " << m_packets.size ());
-  NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue);
+  //NS_LOG_LOGIC ("Number packets " << m_packets.size ());
+  //NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue);
 
   return true;
 }
@@ -682,11 +657,11 @@ RedQueue::DoEnqueue (Ptr<Packet> p)
 Ptr<Packet>
 RedQueue::DoDequeue (void)
 {
-  NS_LOG_FUNCTION (this);
+  //NS_LOG_FUNCTION (this);
 
   if (m_packets.empty ())
     {
-      NS_LOG_LOGIC ("Queue empty");
+      //NS_LOG_LOGIC ("Queue empty");
       return 0;
     }
 
@@ -694,10 +669,10 @@ RedQueue::DoDequeue (void)
   m_packets.pop_front ();
   m_bytesInQueue -= p->GetSize ();
 
-  NS_LOG_LOGIC ("Popped " << p);
+  //NS_LOG_LOGIC ("Popped " << p);
 
-  NS_LOG_LOGIC ("Number packets " << m_packets.size ());
-  NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue);
+  //NS_LOG_LOGIC ("Number packets " << m_packets.size ());
+  //NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue);
 
   if (m_bytesInQueue <= 0 && !IsIdling ())
     {
@@ -713,9 +688,9 @@ int
 RedQueue::DropPacket (Ptr<Packet> p)
 {
 
-  NS_LOG_FUNCTION (this << p);
+  //NS_LOG_FUNCTION (this << p);
 
-  NS_LOG_DEBUG ("\t Dropping Packet p");
+  //NS_LOG_DEBUG ("\t Dropping Packet p");
 
   std::list<Ptr<Packet> >::iterator iter;
   uint32_t packetSize;
@@ -742,18 +717,18 @@ RedQueue::DropPacket (Ptr<Packet> p)
 Ptr<const Packet>
 RedQueue::DoPeek (void) const
 {
-  NS_LOG_FUNCTION (this);
+  //NS_LOG_FUNCTION (this);
 
   if (m_packets.empty ())
     {
-      NS_LOG_LOGIC ("Queue empty");
+      //NS_LOG_LOGIC ("Queue empty");
       return NULL;
     }
 
   Ptr<Packet> p = m_packets.front ();
 
-  NS_LOG_LOGIC ("Number packets " << m_packets.size ());
-  NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue);
+  //NS_LOG_LOGIC ("Number packets " << m_packets.size ());
+  //NS_LOG_LOGIC ("Number bytes " << m_bytesInQueue);
 
   return p;
 }
@@ -761,7 +736,7 @@ RedQueue::DoPeek (void) const
 void
 RedQueue::PrintTable ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  //NS_LOG_FUNCTION_NOARGS ();
 
   for (uint32_t i = 0; i < RED_STATS_TABLE_SIZE; i++)
     {
index 627ad9b..8be8068 100644 (file)
@@ -50,13 +50,13 @@ XBT_LOG_EXTERNAL_CATEGORY(surf_kernel);
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_energy, surf,
                                 "Logging specific to the SURF energy plugin");
 
-std::map<CpuPtr, CpuEnergyPtr> *surf_energy=NULL;
+std::map<Cpu*, CpuEnergy*> *surf_energy=NULL;
 
-static void energyCpuCreatedCallback(CpuPtr cpu){
+static void energyCpuCreatedCallback(Cpu *cpu){
   (*surf_energy)[cpu] = new CpuEnergy(cpu);
 }
 
-static void update_consumption_running(CpuPtr cpu, CpuEnergyPtr cpu_energy) {
+static void update_consumption_running(Cpu *cpu, CpuEnergy *cpu_energy) {
        double cpu_load = lmm_constraint_get_usage(cpu->getConstraint()) / cpu->m_powerPeak;
        double start_time = cpu_energy->last_updated;
        double finish_time = surf_get_clock();
@@ -70,7 +70,7 @@ static void update_consumption_running(CpuPtr cpu, CpuEnergyPtr cpu_energy) {
        XBT_DEBUG("[cpu_update_energy] period=[%.2f-%.2f]; current power peak=%.0E flop/s; consumption change: %.2f J -> %.2f J",
                  start_time, finish_time, cpu->m_powerPeak, previous_energy, energy_this_step);
 }
-static void update_consumption_off(CpuPtr cpu, CpuEnergyPtr cpu_energy) {
+static void update_consumption_off(Cpu *cpu, CpuEnergy *cpu_energy) {
        double start_time = cpu_energy->last_updated;
        double finish_time = surf_get_clock();
 
@@ -84,11 +84,11 @@ static void update_consumption_off(CpuPtr cpu, CpuEnergyPtr cpu_energy) {
                  start_time, finish_time, previous_energy, energy_this_step);
 }
 
-static void energyCpuDestructedCallback(CpuPtr cpu){
-  std::map<CpuPtr, CpuEnergyPtr>::iterator cpu_energy_it = surf_energy->find(cpu);
+static void energyCpuDestructedCallback(Cpu *cpu){
+  std::map<Cpu*, CpuEnergy*>::iterator cpu_energy_it = surf_energy->find(cpu);
   xbt_assert(cpu_energy_it != surf_energy->end(), "The cpu is not in surf_energy.");
 
-  CpuEnergyPtr cpu_energy = cpu_energy_it->second;
+  CpuEnergy *cpu_energy = cpu_energy_it->second;
   if (cpu->getState() == SURF_RESOURCE_OFF)
          update_consumption_off(cpu, cpu_energy);
   else
@@ -99,17 +99,17 @@ static void energyCpuDestructedCallback(CpuPtr cpu){
   surf_energy->erase(cpu_energy_it);
 }
 
-static void energyCpuActionStateChangedCallback(CpuActionPtr action, e_surf_action_state_t old, e_surf_action_state_t cur){
-  CpuPtr cpu  = getActionCpu(action);
-  CpuEnergyPtr cpu_energy = (*surf_energy)[cpu];
+static void energyCpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t cur){
+  Cpu *cpu  = getActionCpu(action);
+  CpuEnergy *cpu_energy = (*surf_energy)[cpu];
 
   if(cpu_energy->last_updated < surf_get_clock()) {
          update_consumption_running(cpu, cpu_energy);
   }
 }
 
-static void energyStateChangedCallback(CpuPtr cpu, e_surf_resource_state_t oldState, e_surf_resource_state_t newState){
-  CpuEnergyPtr cpu_energy = (*surf_energy)[cpu];
+static void energyStateChangedCallback(Cpu *cpu, e_surf_resource_state_t oldState, e_surf_resource_state_t newState){
+  CpuEnergy *cpu_energy = (*surf_energy)[cpu];
 
   if(cpu_energy->last_updated < surf_get_clock()) {
          if (oldState == SURF_RESOURCE_OFF)
@@ -131,7 +131,7 @@ static void sg_energy_plugin_exit()
  */
 void sg_energy_plugin_init() {
   if (surf_energy == NULL) {
-    surf_energy = new std::map<CpuPtr, CpuEnergyPtr>();
+    surf_energy = new std::map<Cpu*, CpuEnergy*>();
     surf_callback_connect(cpuCreatedCallbacks, energyCpuCreatedCallback);
     surf_callback_connect(cpuDestructedCallbacks, energyCpuDestructedCallback);
     surf_callback_connect(cpuActionStateChangedCallbacks, energyCpuActionStateChangedCallback);
@@ -143,7 +143,7 @@ void sg_energy_plugin_init() {
 /**
  *
  */
-CpuEnergy::CpuEnergy(CpuPtr ptr)
+CpuEnergy::CpuEnergy(Cpu *ptr)
  : cpu(ptr)
 {
   total_energy = 0;
@@ -172,14 +172,14 @@ CpuEnergy::~CpuEnergy(){
 double CpuEnergy::getWattMinAt(int pstate) {
   xbt_dynar_t power_range_list = power_range_watts_list;
   xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
-  xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->getPState(), xbt_dynar_t);
+  xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01*>(cpu)->getPState(), xbt_dynar_t);
   double min_power = xbt_dynar_get_as(current_power_values, 0, double);
   return min_power;
 }
 double CpuEnergy::getWattMaxAt(int pstate) {
   xbt_dynar_t power_range_list = power_range_watts_list;
   xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
-  xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->getPState(), xbt_dynar_t);
+  xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01*>(cpu)->getPState(), xbt_dynar_t);
   double max_power = xbt_dynar_get_as(current_power_values, 1, double);
   return max_power;
 }
@@ -194,7 +194,7 @@ double CpuEnergy::getCurrentWattsValue(double cpu_load)
        xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
 
     /* retrieve the power values associated with the current pstate */
-    xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->getPState(), xbt_dynar_t);
+    xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01*>(cpu)->getPState(), xbt_dynar_t);
 
     /* min_power corresponds to the idle power (cpu load = 0) */
     /* max_power is the power consumed at 100% cpu load       */
index 9b776be..7185b57 100644 (file)
 #define CALLBACK_HPP_
 
 class CpuEnergy;
-typedef CpuEnergy *CpuEnergyPtr;
 
-extern std::map<CpuPtr, CpuEnergyPtr> *surf_energy;
+extern std::map<Cpu*, CpuEnergy*> *surf_energy;
 
 class CpuEnergy {
 public:
-  CpuEnergy(CpuPtr ptr);
+  CpuEnergy(Cpu *ptr);
   ~CpuEnergy();
 
   double getCurrentWattsValue(double cpu_load);
@@ -30,7 +29,7 @@ public:
   double watts_off;                      /*< Consumption when the machine is turned off (shutdown) */
   double total_energy;                                 /*< Total energy consumed by the host */
   double last_updated;                                 /*< Timestamp of the last energy update event*/
-  CpuPtr cpu;
+  Cpu *cpu;
 };
 
 #endif /* CALLBACK_HPP_ */
index 7d6a8b7..d0078f1 100644 (file)
@@ -18,22 +18,24 @@ int SURF_STORAGE_LEVEL;
 xbt_lib_t storage_type_lib;
 int ROUTING_STORAGE_TYPE_LEVEL; //Routing for storage_type level
 xbt_dynar_t mount_list = NULL;
-StorageModelPtr surf_storage_model = NULL;
+StorageModel *surf_storage_model = NULL;
 
 /*************
  * Callbacks *
  *************/
 
-surf_callback(void, StoragePtr) storageCreatedCallbacks;
-surf_callback(void, StoragePtr) storageDestructedCallbacks;
-surf_callback(void, StoragePtr, e_surf_resource_state_t, e_surf_resource_state_t) storageStateChangedCallbacks;
-surf_callback(void, StorageActionPtr, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks;
+surf_callback(void, Storage*) storageCreatedCallbacks;
+surf_callback(void, Storage*) storageDestructedCallbacks;
+surf_callback(void, Storage*, e_surf_resource_state_t, e_surf_resource_state_t) storageStateChangedCallbacks;
+surf_callback(void, StorageAction*, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks;
 
 /*********
  * Model *
  *********/
 
-StorageModel::StorageModel() : Model("Storage") {
+StorageModel::StorageModel()
+       : Model()
+{
   p_storageList = NULL;
 }
 
@@ -49,21 +51,21 @@ StorageModel::~StorageModel(){
  * Resource *
  ************/
 
-Storage::Storage(ModelPtr model, const char *name, xbt_dict_t props,
+Storage::Storage(Model *model, const char *name, xbt_dict_t props,
                  const char* type_id, char *content_name, char *content_type,
                  sg_size_t size)
  : Resource(model, name, props)
  , p_contentType(content_type)
  , m_size(size), m_usedSize(0)
  , p_typeId(xbt_strdup(type_id))
- , p_writeActions(xbt_dynar_new(sizeof(ActionPtr),NULL))
+ , p_writeActions(xbt_dynar_new(sizeof(Action*),NULL))
 {
   surf_callback_emit(storageCreatedCallbacks, this);
   p_content = parseContent(content_name);
   setState(SURF_RESOURCE_ON);
 }
 
-Storage::Storage(ModelPtr model, const char *name, xbt_dict_t props,
+Storage::Storage(Model *model, const char *name, xbt_dict_t props,
                  lmm_system_t maxminSystem, double bread, double bwrite,
                  double bconnection, const char* type_id, char *content_name,
                  char *content_type, sg_size_t size, char *attach)
@@ -71,7 +73,7 @@ Storage::Storage(ModelPtr model, const char *name, xbt_dict_t props,
  , p_contentType(content_type)
  , m_size(size), m_usedSize(0)
  , p_typeId(xbt_strdup(type_id))
- , p_writeActions(xbt_dynar_new(sizeof(ActionPtr),NULL)) {
+ , p_writeActions(xbt_dynar_new(sizeof(Action*),NULL)) {
   surf_callback_emit(storageCreatedCallbacks, this);
   p_content = parseContent(content_name);
   p_attach = xbt_strdup(attach);
@@ -175,15 +177,15 @@ sg_size_t Storage::getUsedSize(){
 /**********
  * Action *
  **********/
-StorageAction::StorageAction(ModelPtr model, double cost, bool failed,
-                             StoragePtr storage, e_surf_action_storage_type_t type)
+StorageAction::StorageAction(Model *model, double cost, bool failed,
+                             Storage *storage, e_surf_action_storage_type_t type)
 : Action(model, cost, failed)
 , m_type(type), p_storage(storage), p_file(NULL){
   progress = 0;
 };
 
-StorageAction::StorageAction(ModelPtr model, double cost, bool failed, lmm_variable_t var,
-                             StoragePtr storage, e_surf_action_storage_type_t type)
+StorageAction::StorageAction(Model *model, double cost, bool failed, lmm_variable_t var,
+                             Storage *storage, e_surf_action_storage_type_t type)
   : Action(model, cost, failed, var)
   , m_type(type), p_storage(storage), p_file(NULL){
   progress = 0;
index 56cd226..9e0e442 100644 (file)
@@ -16,13 +16,8 @@ extern xbt_dynar_t mount_list;
  ***********/
 
 class StorageModel;
-typedef StorageModel *StorageModelPtr;
-
 class Storage;
-typedef Storage *StoragePtr;
-
 class StorageAction;
-typedef StorageAction *StorageActionPtr;
 
 /*************
  * Callbacks *
@@ -30,27 +25,27 @@ typedef StorageAction *StorageActionPtr;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Storage creation *
- * @details Callback functions have the following signature: `void(StoragePtr)`
+ * @details Callback functions have the following signature: `void(Storage*)`
  */
-XBT_PUBLIC_DATA(surf_callback(void, StoragePtr)) storageCreatedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Storage*)) storageCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Storage destruction *
  * @details Callback functions have the following signature: `void(StoragePtr)`
  */
-XBT_PUBLIC_DATA(surf_callback(void, StoragePtr)) storageDestructedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Storage*)) storageDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Storage State changed *
- * @details Callback functions have the following signature: `void(StorageActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
+ * @details Callback functions have the following signature: `void(StorageAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
  */
-XBT_PUBLIC_DATA(surf_callback(void, StoragePtr, e_surf_resource_state_t, e_surf_resource_state_t)) storageStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Storage*, e_surf_resource_state_t, e_surf_resource_state_t)) storageStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after StorageAction State changed *
- * @details Callback functions have the following signature: `void(StorageActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
+ * @details Callback functions have the following signature: `void(StorageAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
  */
-XBT_PUBLIC_DATA(surf_callback(void, StorageActionPtr, e_surf_action_state_t, e_surf_action_state_t)) storageActionStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, StorageAction*, e_surf_action_state_t, e_surf_action_state_t)) storageActionStateChangedCallbacks;
 
 /*********
  * Model *
@@ -82,13 +77,15 @@ public:
    * @param attach [description]
    * @return The created Storage
    */
-  virtual StoragePtr createStorage(const char* id,
+  virtual Storage *createStorage(const char* id,
                                     const char* type_id,
                                     const char* content_name,
                                     const char* content_type,
                                     xbt_dict_t properties,
                                     const char *attach) = 0;
 
+  bool shareResourcesIsIdempotent() {return true;}
+
   xbt_dynar_t p_storageList;
 };
 
@@ -112,7 +109,7 @@ public:
    * @param content_type [description]
    * @param size [description]
    */
-  Storage(ModelPtr model, const char *name, xbt_dict_t props,
+  Storage(Model *model, const char *name, xbt_dict_t props,
           const char* type_id, char *content_name, char *content_type,
           sg_size_t size);
 
@@ -132,7 +129,7 @@ public:
    * @param size [description]
    * @param attach [description]
    */
-  Storage(ModelPtr model, const char *name, xbt_dict_t props,
+  Storage(Model *model, const char *name, xbt_dict_t props,
           lmm_system_t maxminSystem, double bread, double bwrite,
           double bconnection,
           const char* type_id, char *content_name, char *content_type,
@@ -176,7 +173,7 @@ public:
    *
    * @return The StorageAction corresponding to the opening
    */
-  virtual StorageActionPtr open(const char* mount, const char* path)=0;
+  virtual StorageAction *open(const char* mount, const char* path)=0;
 
   /**
    * @brief Close a file
@@ -184,7 +181,7 @@ public:
    * @param fd The file descriptor to close
    * @return The StorageAction corresponding to the closing
    */
-  virtual StorageActionPtr close(surf_file_t fd)=0;
+  virtual StorageAction *close(surf_file_t fd)=0;
 
   /**
    * @brief Read a file
@@ -193,7 +190,7 @@ public:
    * @param size The size in bytes to read
    * @return The StorageAction corresponding to the reading
    */
-  virtual StorageActionPtr read(surf_file_t fd, sg_size_t size)=0;
+  virtual StorageAction *read(surf_file_t fd, sg_size_t size)=0;
 
   /**
    * @brief Write a file
@@ -202,7 +199,7 @@ public:
    * @param size The size in bytes to write
    * @return The StorageAction corresponding to the writing
    */
-  virtual StorageActionPtr write(surf_file_t fd, sg_size_t size)=0;
+  virtual StorageAction *write(surf_file_t fd, sg_size_t size)=0;
 
   /**
    * @brief Get the content of the current Storage
@@ -270,7 +267,7 @@ public:
    * @param storage The Storage associated to this StorageAction
    * @param type [description]
    */
-  StorageAction(ModelPtr model, double cost, bool failed, StoragePtr storage,
+  StorageAction(Model *model, double cost, bool failed, Storage *storage,
       e_surf_action_storage_type_t type);
 
     /**
@@ -283,13 +280,13 @@ public:
    * @param storage The Storage associated to this StorageAction
    * @param type [description]
    */
-  StorageAction(ModelPtr model, double cost, bool failed, lmm_variable_t var,
-      StoragePtr storage, e_surf_action_storage_type_t type);
+  StorageAction(Model *model, double cost, bool failed, lmm_variable_t var,
+      Storage *storage, e_surf_action_storage_type_t type);
 
   void setState(e_surf_action_state_t state);
 
   e_surf_action_storage_type_t m_type;
-  StoragePtr p_storage;
+  Storage *p_storage;
   surf_file_t p_file;
   double progress;
 };
index e1dc8f1..3b914b9 100644 (file)
@@ -31,7 +31,7 @@ static XBT_INLINE void routing_storage_type_free(void *r)
 static XBT_INLINE void surf_storage_resource_free(void *r)
 {
   // specific to storage
-  StoragePtr storage = static_cast<StoragePtr>(r);
+  Storage *storage = static_cast<Storage*>(r);
   // generic resource
   delete storage;
 }
@@ -218,7 +218,7 @@ void surf_storage_model_init_default(void)
 }
 
 StorageN11Model::StorageN11Model() : StorageModel() {
-  ActionPtr action = NULL;
+  Action *action = NULL;
 
   XBT_DEBUG("surf_storage_model_init_internal");
 
@@ -234,7 +234,7 @@ StorageN11Model::~StorageN11Model(){
   storage_running_action_set_that_does_not_need_being_checked = NULL;
 }
 
-StoragePtr StorageN11Model::createStorage(const char* id, const char* type_id,
+Storage *StorageN11Model::createStorage(const char* id, const char* type_id,
     const char* content_name, const char* content_type, xbt_dict_t properties,
     const char* attach)
 {
@@ -249,7 +249,7 @@ StoragePtr StorageN11Model::createStorage(const char* id, const char* type_id,
   double Bwrite = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bwrite"));
   double Bconnection   = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection"));
 
-  StoragePtr storage = new StorageN11(this, id, properties, p_maxminSystem,
+  Storage *storage = new StorageN11(this, id, properties, p_maxminSystem,
       Bread, Bwrite, Bconnection, type_id, (char *)content_name,
       xbt_strdup(content_type), storage_type->size, (char *) attach);
 
@@ -272,9 +272,9 @@ double StorageN11Model::shareResources(double now)
 {
   XBT_DEBUG("storage_share_resources %f", now);
   unsigned int i, j;
-  StoragePtr storage;
+  Storage *storage;
   void *_write_action;
-  StorageActionPtr write_action;
+  StorageAction *write_action;
 
   double min_completion = shareResourcesMaxMin(getRunningActionSet(),
       p_maxminSystem, lmm_solve);
@@ -287,7 +287,7 @@ double StorageN11Model::shareResources(double now)
     // Foreach write action on disk
     xbt_dynar_foreach(storage->p_writeActions, j, _write_action)
     {
-      write_action = static_cast<StorageActionPtr>(_write_action);
+      write_action = static_cast<StorageAction*>(_write_action);
       rate += lmm_variable_getvalue(write_action->getVariable());
     }
     if(rate > 0)
@@ -299,13 +299,13 @@ double StorageN11Model::shareResources(double now)
 
 void StorageN11Model::updateActionsState(double /*now*/, double delta)
 {
-  StorageActionPtr action = NULL;
+  StorageAction *action = NULL;
 
-  ActionListPtr actionSet = getRunningActionSet();
+  ActionList *actionSet = getRunningActionSet();
   for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
      ; it != itend ; it=itNext) {
     ++itNext;
-    action = static_cast<StorageActionPtr>(&*it);
+    action = static_cast<StorageAction*>(&*it);
 
     if(action->m_type == WRITE)
     {
@@ -371,7 +371,7 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
  * Resource *
  ************/
 
-StorageN11::StorageN11(StorageModelPtr model, const char* name,
+StorageN11::StorageN11(StorageModel *model, const char* name,
     xbt_dict_t properties, lmm_system_t maxminSystem, double bread,
     double bwrite, double bconnection, const char* type_id, char *content_name,
     char *content_type, sg_size_t size, char *attach)
@@ -380,7 +380,7 @@ StorageN11::StorageN11(StorageModelPtr model, const char* name,
   XBT_DEBUG("Create resource with Bconnection '%f' Bread '%f' Bwrite '%f' and Size '%llu'", bconnection, bread, bwrite, size);
 }
 
-StorageActionPtr StorageN11::open(const char* mount, const char* path)
+StorageAction *StorageN11::open(const char* mount, const char* path)
 {
   XBT_DEBUG("\tOpen file '%s'",path);
 
@@ -402,22 +402,22 @@ StorageActionPtr StorageN11::open(const char* mount, const char* path)
   file->mount = xbt_strdup(mount);
   file->current_position = 0;
 
-  StorageActionPtr action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, OPEN);
+  StorageAction *action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, OPEN);
   action->p_file = file;
 
   return action;
 }
 
-StorageActionPtr StorageN11::close(surf_file_t fd)
+StorageAction *StorageN11::close(surf_file_t fd)
 {
   char *filename = fd->name;
   XBT_DEBUG("\tClose file '%s' size '%llu'", filename, fd->size);
   // unref write actions from storage
   void *_write_action;
-  StorageActionPtr write_action;
+  StorageAction *write_action;
   unsigned int i;
   xbt_dynar_foreach(p_writeActions, i, _write_action) {
-       write_action = static_cast<StorageActionPtr>(_write_action);
+       write_action = static_cast<StorageAction*>(_write_action);
     if ((write_action->p_file) == fd) {
       xbt_dynar_cursor_rm(p_writeActions, &i);
       write_action->unref();
@@ -426,11 +426,11 @@ StorageActionPtr StorageN11::close(surf_file_t fd)
   free(fd->name);
   free(fd->mount);
   xbt_free(fd);
-  StorageActionPtr action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, CLOSE);
+  StorageAction *action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, CLOSE);
   return action;
 }
 
-StorageActionPtr StorageN11::read(surf_file_t fd, sg_size_t size)
+StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size)
 {
   if(fd->current_position + size > fd->size){
     size = fd->size - fd->current_position;
@@ -439,16 +439,16 @@ StorageActionPtr StorageN11::read(surf_file_t fd, sg_size_t size)
   else
     fd->current_position += size;
 
-  StorageActionPtr action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, READ);
+  StorageAction *action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, READ);
   return action;
 }
 
-StorageActionPtr StorageN11::write(surf_file_t fd, sg_size_t size)
+StorageAction *StorageN11::write(surf_file_t fd, sg_size_t size)
 {
   char *filename = fd->name;
   XBT_DEBUG("\tWrite file '%s' size '%llu/%llu'",filename,size,fd->size);
 
-  StorageActionPtr action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, WRITE);
+  StorageAction *action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, WRITE);
   action->p_file = fd;
   /* Substract the part of the file that might disappear from the used sized on
    * the storage element */
@@ -464,7 +464,7 @@ StorageActionPtr StorageN11::write(surf_file_t fd, sg_size_t size)
  * Action *
  **********/
 
-StorageN11Action::StorageN11Action(ModelPtr model, double cost, bool failed, StoragePtr storage, e_surf_action_storage_type_t type)
+StorageN11Action::StorageN11Action(Model *model, double cost, bool failed, Storage *storage, e_surf_action_storage_type_t type)
   : StorageAction(model, cost, failed,
                      lmm_variable_new(model->getMaxminSystem(), this, 1.0, -1.0 , 3),
                      storage, type) {
@@ -486,7 +486,7 @@ StorageN11Action::StorageN11Action(ModelPtr model, double cost, bool failed, Sto
                getVariable(), 1.0);
 
 //TODO there is something annoying with what's below. Have to sort it out...
-//    ActionPtr action = this;
+//    Action *action = this;
 //    xbt_dynar_push(storage->p_writeActions, &action);
 //    ref();
     break;
index 2ec1123..d9d3941 100644 (file)
  ***********/
 
 class StorageN11Model;
-typedef StorageN11Model *StorageN11ModelPtr;
-
-class StorageN11;
-typedef StorageN11 *StorageN11Ptr;
-
 class StorageN11;
-typedef StorageN11 *StorageN11Ptr;
-
 class StorageN11Action;
-typedef StorageN11Action *StorageN11ActionPtr;
-
-class StorageN11Action;
-typedef StorageN11Action *StorageN11ActionPtr;
-
 
 /*********
  * Model *
@@ -37,7 +25,7 @@ class StorageN11Model : public StorageModel {
 public:
   StorageN11Model();
   ~StorageN11Model();
-  StoragePtr createStorage(const char* id, const char* type_id,
+  Storage *createStorage(const char* id, const char* type_id,
                   const char* content_name, const char* content_type, xbt_dict_t properties, const char* attach);
   void addTraces(){DIE_IMPOSSIBLE;}
   double shareResources(double now);
@@ -50,15 +38,15 @@ public:
 
 class StorageN11 : public Storage {
 public:
-  StorageN11(StorageModelPtr model, const char* name, xbt_dict_t properties,
+  StorageN11(StorageModel *model, const char* name, xbt_dict_t properties,
                     lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
                     const char* type_id, char *content_name, char *content_type, sg_size_t size, char *attach);
 
-  StorageActionPtr open(const char* mount, const char* path);
-  StorageActionPtr close(surf_file_t fd);
-  StorageActionPtr ls(const char *path);
-  StorageActionPtr read(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param ptr ??
-  StorageActionPtr write(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param ptr ??
+  StorageAction *open(const char* mount, const char* path);
+  StorageAction *close(surf_file_t fd);
+  StorageAction *ls(const char *path);
+  StorageAction *read(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param  *??
+  StorageAction *write(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param  *??
   void rename(const char *src, const char *dest);
 
   lmm_constraint_t p_constraintWrite;    /* Constraint for maximum write bandwidth*/
@@ -71,11 +59,10 @@ public:
 
 class StorageN11Action : public StorageAction {
 public:
-  StorageN11Action(ModelPtr model, double cost, bool failed, StoragePtr storage, e_surf_action_storage_type_t type);
+  StorageN11Action(Model *model, double cost, bool failed, Storage *storage, e_surf_action_storage_type_t type);
   void suspend();
   int unref();
   void cancel();
-  //FIXME:??void recycle();
   void resume();
   bool isSuspended();
   void setMaxDuration(double duration);
index cdfef8c..a149c66 100644 (file)
@@ -18,46 +18,27 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_kernel);
  * TOOLS *
  *********/
 
-static CpuPtr get_casted_cpu(surf_resource_t resource){
-  return static_cast<CpuPtr>(surf_cpu_resource_priv(resource));
+static Host *get_casted_host(surf_resource_t resource){
+  return static_cast<Host*>(surf_host_resource_priv(resource));
 }
 
-static HostPtr get_casted_host(surf_resource_t resource){
-  return static_cast<HostPtr>(surf_host_resource_priv(resource));
+static VM *get_casted_vm(surf_resource_t resource){
+  return static_cast<VM*>(surf_host_resource_priv(resource));
 }
 
-static RoutingEdgePtr get_casted_routing(surf_resource_t resource){
-  return static_cast<RoutingEdgePtr>(surf_routing_resource_priv(resource));
-}
-
-static VMPtr get_casted_vm(surf_resource_t resource){
-  return static_cast<VMPtr>(surf_host_resource_priv(resource));
-}
-
-char *surf_routing_edge_name(sg_routing_edge_t edge){
-  return edge->getName();
-}
-
-#ifdef CONTEXT_THREADS
-//FIXME:keeporremove static xbt_parmap_t surf_parmap = NULL; /* parallel map on models */
-#endif
-
 extern double NOW;
-extern double *surf_mins; /* return value of share_resources for each model */
-extern int surf_min_index;       /* current index in surf_mins */
-extern double surf_min;               /* duration determined by surf_solve */
 
 void surf_presolve(void)
 {
   double next_event_date = -1.0;
   tmgr_trace_event_t event = NULL;
   double value = -1.0;
-  ResourcePtr resource = NULL;
-  ModelPtr model = NULL;
+  Resource *resource = NULL;
+  Model *model = NULL;
   unsigned int iter;
 
-  XBT_DEBUG
-      ("First Run! Let's \"purge\" events and put models in the right state");
+  XBT_DEBUG ("First Run! Let's \"purge\" events and put models in the right state");
+
   while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
     if (next_event_date > NOW)
       break;
@@ -74,44 +55,14 @@ void surf_presolve(void)
       model->updateActionsState(NOW, 0.0);
 }
 
-/**
- * Computes when the next action executed in a
- * specific model terminates; this is important,
- * because we can safely skip the amount of time
- * in which no model (read: not even a single one)
- * changes its state; so, if for instance network,
- * cpu, storage don't change (and if we assume they're
- * the only models we use... simple example here :) )
- * for 2s, 1s, 3s then we can skip 1s as after this
- * amount of time the new state needs to be considered.
- *
- */
-static void surf_share_resources(surf_model_t model)
-{
-  double next_action_end = -1.0;
-  int i = __sync_fetch_and_add(&surf_min_index, 1);
-  if (strcmp(model->getName(), "network NS3")) {
-    XBT_DEBUG("Running for Resource [%s]", model->getName());
-    next_action_end = model->shareResources(NOW);
-    XBT_DEBUG("Resource [%s] : next action end = %f",
-        model->getName(), next_action_end);
-  }
-  surf_mins[i] = next_action_end;
-}
-
-static void surf_update_actions_state(surf_model_t model)
-{
-  model->updateActionsState(NOW, surf_min);
-}
-
 double surf_solve(double max_date)
 {
-  surf_min = -1.0; /* duration */
+  double surf_min = -1.0; /* duration */
   double next_event_date = -1.0;
   double model_next_action_end = -1.0;
   double value = -1.0;
-  ResourcePtr resource = NULL;
-  ModelPtr model = NULL;
+  Resource *resource = NULL;
+  Model *model = NULL;
   tmgr_trace_event_t event = NULL;
   unsigned int iter;
 
@@ -123,23 +74,18 @@ double surf_solve(double max_date)
   }
 
   XBT_DEBUG("Looking for next action end for all models except NS3");
-
-  if (surf_mins == NULL) {
-    surf_mins = xbt_new(double, xbt_dynar_length(model_list_invoke));
-  }
-  surf_min_index = 0;
-
-  /* sequential version */
   xbt_dynar_foreach(model_list_invoke, iter, model) {
-    surf_share_resources(static_cast<ModelPtr>(model));
-  }
-
-  unsigned i;
-  for (i = 0; i < xbt_dynar_length(model_list_invoke); i++) {
-    if ((surf_min < 0.0 || surf_mins[i] < surf_min)
-        && surf_mins[i] >= 0.0) {
-      surf_min = surf_mins[i];
-    }
+         double next_action_end = -1.0;
+         if (model->shareResourcesIsIdempotent()) {
+           XBT_DEBUG("Running for Resource [%s]", typeid(model).name());
+           next_action_end = model->shareResources(NOW);
+           XBT_DEBUG("Resource [%s] : next action end = %f",
+               typeid(model).name(), next_action_end);
+         }
+         if ((surf_min < 0.0 || next_action_end < surf_min)
+                         && next_action_end >= 0.0) {
+                 surf_min = next_action_end;
+         }
   }
 
   XBT_DEBUG("Min for resources (remember that NS3 don't update that value) : %f", surf_min);
@@ -151,7 +97,7 @@ double surf_solve(double max_date)
 
     next_event_date = tmgr_history_next_date(history);
 
-    if(!strcmp(surf_network_model->getName(), "network NS3")){
+    if(! surf_network_model->shareResourcesIsIdempotent()){ // NS3, I see you
       if(next_event_date!=-1.0 && surf_min!=-1.0) {
         surf_min = MIN(next_event_date - NOW, surf_min);
       } else{
@@ -207,7 +153,7 @@ double surf_solve(double max_date)
   /* FIXME: model_list or model_list_invoke? revisit here later */
   /* sequential version */
   xbt_dynar_foreach(model_list, iter, model) {
-    surf_update_actions_state(model);
+         model->updateActionsState(NOW, surf_min);
   }
 
   TRACE_paje_dump_buffer (0);
@@ -227,20 +173,20 @@ void routing_get_route_and_latency(sg_routing_edge_t src, sg_routing_edge_t dst,
 surf_model_t surf_resource_model(const void *host, int level) {
   /* If level is SURF_WKS_LEVEL, ws is a host_CLM03 object. It has
    * surf_resource at the generic_resource field. */
-  ResourcePtr ws = static_cast<ResourcePtr>(xbt_lib_get_level((xbt_dictelm_t) host, level));
+  Resource *ws = static_cast<Resource*>(xbt_lib_get_level((xbt_dictelm_t) host, level));
   return ws->getModel();
 }
 
 void *surf_as_cluster_get_backbone(AS_t as){
-  return static_cast<AsClusterPtr>(as)->p_backbone;
+  return static_cast<AsCluster*>(as)->p_backbone;
 }
 
 void surf_as_cluster_set_backbone(AS_t as, void* backbone){
-  static_cast<AsClusterPtr>(as)->p_backbone = static_cast<NetworkLinkPtr>(backbone);
+  static_cast<AsCluster*>(as)->p_backbone = static_cast<Link*>(backbone);
 }
 
 const char *surf_model_name(surf_model_t model){
-  return model->getName();
+  return typeid(model).name();
 }
 
 surf_action_t surf_model_extract_done_action_set(surf_model_t model){
@@ -281,15 +227,11 @@ int surf_model_running_action_set_size(surf_model_t model){
 
 surf_action_t surf_host_model_execute_parallel_task(surf_host_model_t model,
                                                    int host_nb,
-                                            void **host_list,
+                                            sg_host_t *host_list,
                                             double *flops_amount,
                                             double *bytes_amount,
                                             double rate){
-  return static_cast<ActionPtr>(model->executeParallelTask(host_nb, host_list, flops_amount, bytes_amount, rate));
-}
-
-surf_action_t surf_host_model_communicate(surf_host_model_t model, surf_resource_t src, surf_resource_t dst, double size, double rate){
-  return model->communicate(get_casted_host(src), get_casted_host(dst), size, rate);
+  return static_cast<Action*>(model->executeParallelTask(host_nb, host_list, flops_amount, bytes_amount, rate));
 }
 
 xbt_dynar_t surf_host_model_get_route(surf_host_model_t /*model*/,
@@ -304,8 +246,8 @@ void surf_vm_model_create(const char *name, surf_resource_t ind_phys_host){
   surf_vm_model->createVM(name, ind_phys_host);
 }
 
-surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_routing_edge_t src, sg_routing_edge_t dst, double size, double rate){
-  return model->communicate(src, dst, size, rate);
+surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_host_t src, sg_host_t dst, double size, double rate){
+  return model->communicate(sg_host_edge(src), sg_host_edge(dst), size, rate);
 }
 
 const char *surf_resource_name(surf_cpp_resource_t resource){
@@ -324,58 +266,58 @@ void surf_resource_set_state(surf_cpp_resource_t resource, e_surf_resource_state
   resource->setState(state);
 }
 
-surf_action_t surf_host_sleep(surf_resource_t resource, double duration){
-  return get_casted_host(resource)->sleep(duration);
+surf_action_t surf_host_sleep(surf_resource_t host, double duration){
+  return get_casted_host(host)->sleep(duration);
 }
 
-double surf_host_get_speed(surf_resource_t resource, double load){
-  return get_casted_host(resource)->getSpeed(load);
+double surf_host_get_speed(surf_resource_t host, double load){
+  return sg_host_surfcpu(host)->getSpeed(load);
 }
 
-double surf_host_get_available_speed(surf_resource_t resource){
-  return get_casted_host(resource)->getAvailableSpeed();
+double surf_host_get_available_speed(surf_resource_t host){
+  return sg_host_surfcpu(host)->getAvailableSpeed();
 }
 
-int surf_host_get_core(surf_resource_t resource){
-  return get_casted_host(resource)->getCore();
+int surf_host_get_core(surf_resource_t host){
+  return sg_host_surfcpu(host)->getCore();
 }
 
-surf_action_t surf_host_execute(surf_resource_t resource, double size){
-  return get_casted_host(resource)->execute(size);
+surf_action_t surf_host_execute(surf_resource_t host, double size){
+  return get_casted_host(host)->execute(size);
 }
 
-double surf_host_get_current_power_peak(surf_resource_t resource){
-  return get_casted_host(resource)->getCurrentPowerPeak();
+double surf_host_get_current_power_peak(surf_resource_t host){
+  return sg_host_surfcpu(host)->getCurrentPowerPeak();
 }
 
-double surf_host_get_power_peak_at(surf_resource_t resource, int pstate_index){
-  return get_casted_host(resource)->getPowerPeakAt(pstate_index);
+double surf_host_get_power_peak_at(surf_resource_t host, int pstate_index){
+  return sg_host_surfcpu(host)->getPowerPeakAt(pstate_index);
 }
 
-int surf_host_get_nb_pstates(surf_resource_t resource){
-  return get_casted_host(resource)->getNbPstates();
+int surf_host_get_nb_pstates(surf_resource_t host){
+  return sg_host_surfcpu(host)->getNbPstates();
 }
 
-void surf_host_set_pstate(surf_resource_t resource, int pstate_index){
-  get_casted_host(resource)->setPstate(pstate_index);
+void surf_host_set_pstate(surf_resource_t host, int pstate_index){
+       sg_host_surfcpu(host)->setPstate(pstate_index);
 }
-int surf_host_get_pstate(surf_resource_t resource){
-  return get_casted_host(resource)->getPstate();
+int surf_host_get_pstate(surf_resource_t host){
+  return sg_host_surfcpu(host)->getPstate();
 }
 double surf_host_get_wattmin_at(surf_resource_t resource, int pstate){
   xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
-  std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
+  std::map<Cpu*, CpuEnergy*>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
   return cpuIt->second->getWattMinAt(pstate);
 }
 double surf_host_get_wattmax_at(surf_resource_t resource, int pstate){
   xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
-  std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
+  std::map<Cpu*, CpuEnergy*>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
   return cpuIt->second->getWattMaxAt(pstate);
 }
 
 double surf_host_get_consumed_energy(surf_resource_t resource){
   xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
-  std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
+  std::map<Cpu*, CpuEnergy*>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
   return cpuIt->second->getConsumedEnergy();
 }
 
@@ -430,30 +372,28 @@ int surf_host_file_move(surf_resource_t host, surf_file_t fd, const char* fullpa
 
 xbt_dynar_t surf_host_get_vms(surf_resource_t host){
   xbt_dynar_t vms = get_casted_host(host)->getVms();
-  xbt_dynar_t vms_ = xbt_dynar_new(sizeof(smx_host_t), NULL);
+  xbt_dynar_t vms_ = xbt_dynar_new(sizeof(sg_host_t), NULL);
   unsigned int cpt;
-  VMPtr vm;
+  VM *vm;
   xbt_dynar_foreach(vms, cpt, vm) {
-    smx_host_t vm_ = xbt_lib_get_elm_or_null(host_lib, vm->getName());
+    sg_host_t vm_ = xbt_lib_get_elm_or_null(host_lib, vm->getName());
     xbt_dynar_push(vms_, &vm_);
   }
   xbt_dynar_free(&vms);
   return vms_;
 }
 
-void surf_host_get_params(surf_resource_t host, ws_params_t params){
+void surf_host_get_params(surf_resource_t host, vm_params_t params){
   get_casted_host(host)->getParams(params);
 }
 
-void surf_host_set_params(surf_resource_t host, ws_params_t params){
+void surf_host_set_params(surf_resource_t host, vm_params_t params){
   get_casted_host(host)->setParams(params);
 }
 
 void surf_vm_destroy(surf_resource_t resource){
   /* Before clearing the entries in host_lib, we have to pick up resources. */
-  CpuPtr cpu = get_casted_cpu(resource);
-  VMPtr vm = get_casted_vm(resource);
-  RoutingEdgePtr routing = get_casted_routing(resource);
+  VM *vm = get_casted_vm(resource);
   char* name = xbt_dict_get_elm_key(resource);
   /* We deregister objects from host_lib, without invoking the freeing callback
    * of each level.
@@ -461,16 +401,14 @@ void surf_vm_destroy(surf_resource_t resource){
    * Do not call xbt_lib_remove() here. It deletes all levels of the key,
    * including MSG_HOST_LEVEL and others. We should unregister only what we know.
    */
-  xbt_lib_unset(host_lib, name, SURF_CPU_LEVEL, 0);
-  xbt_lib_unset(host_lib, name, ROUTING_HOST_LEVEL, 0);
+  sg_host_surfcpu_destroy((sg_host_t)resource);
+  sg_host_edge_destroy((sg_host_t)resource,1);
   xbt_lib_unset(host_lib, name, SURF_HOST_LEVEL, 0);
 
   /* TODO: comment out when VM storage is implemented. */
   // xbt_lib_unset(host_lib, name, SURF_STORAGE_LEVEL, 0);
 
-  delete cpu;
   delete vm;
-  delete routing;
 }
 
 void surf_vm_suspend(surf_resource_t vm){
@@ -502,47 +440,35 @@ void surf_vm_set_bound(surf_resource_t vm, double bound){
 }
 
 void surf_vm_set_affinity(surf_resource_t vm, surf_resource_t cpu, unsigned long mask){
-  return get_casted_vm(vm)->setAffinity(get_casted_cpu(cpu), mask);
-}
-
-int surf_network_link_is_shared(surf_cpp_resource_t link){
-  return static_cast<NetworkLinkPtr>(link)->isShared();
-}
-
-double surf_network_link_get_bandwidth(surf_cpp_resource_t link){
-  return static_cast<NetworkLinkPtr>(link)->getBandwidth();
-}
-
-double surf_network_link_get_latency(surf_cpp_resource_t link){
-  return static_cast<NetworkLinkPtr>(link)->getLatency();
+  return get_casted_vm(vm)->setAffinity(sg_host_surfcpu(cpu), mask);
 }
 
 xbt_dict_t surf_storage_get_content(surf_resource_t resource){
-  return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getContent();
+  return static_cast<Storage*>(surf_storage_resource_priv(resource))->getContent();
 }
 
 sg_size_t surf_storage_get_size(surf_resource_t resource){
-  return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getSize();
+  return static_cast<Storage*>(surf_storage_resource_priv(resource))->getSize();
 }
 
 sg_size_t surf_storage_get_free_size(surf_resource_t resource){
-  return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getFreeSize();
+  return static_cast<Storage*>(surf_storage_resource_priv(resource))->getFreeSize();
 }
 
 sg_size_t surf_storage_get_used_size(surf_resource_t resource){
-  return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getUsedSize();
+  return static_cast<Storage*>(surf_storage_resource_priv(resource))->getUsedSize();
 }
 
 const char* surf_storage_get_host(surf_resource_t resource){
-  return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->p_attach;
+  return static_cast<Storage*>(surf_storage_resource_priv(resource))->p_attach;
 }
 
 surf_action_t surf_cpu_execute(surf_resource_t cpu, double size){
-  return get_casted_cpu(cpu)->execute(size);
+  return sg_host_surfcpu(cpu)->execute(size);
 }
 
 surf_action_t surf_cpu_sleep(surf_resource_t cpu, double duration){
-  return get_casted_cpu(cpu)->sleep(duration);
+  return sg_host_surfcpu(cpu)->sleep(duration);
 }
 
 double surf_action_get_start_time(surf_action_t action){
@@ -598,11 +524,11 @@ double surf_action_get_cost(surf_action_t action){
 }
 
 void surf_cpu_action_set_affinity(surf_action_t action, surf_resource_t cpu, unsigned long mask) {
-  static_cast<CpuActionPtr>(action)->setAffinity(get_casted_cpu(cpu), mask);
+  static_cast<CpuAction*>(action)->setAffinity(sg_host_surfcpu(cpu), mask);
 }
 
 void surf_cpu_action_set_bound(surf_action_t action, double bound) {
-  static_cast<CpuActionPtr>(action)->setBound(bound);
+  static_cast<CpuAction*>(action)->setBound(bound);
 }
 
 #ifdef HAVE_LATENCY_BOUND_TRACKING
@@ -612,5 +538,5 @@ double surf_network_action_get_latency_limited(surf_action_t action) {
 #endif
 
 surf_file_t surf_storage_action_get_file(surf_action_t action){
-  return static_cast<StorageActionPtr>(action)->p_file;
+  return static_cast<StorageAction*>(action)->p_file;
 }
index 3b34cc7..8fdc1db 100644 (file)
@@ -194,9 +194,6 @@ static xbt_parmap_t surf_parmap = NULL; /* parallel map on models */
 #endif
 
 double NOW = 0;
-double *surf_mins = NULL; /* return value of share_resources for each model */
-int surf_min_index;       /* current index in surf_mins */
-double surf_min;               /* duration determined by surf_solve */
 
 double surf_get_clock(void)
 {
@@ -233,40 +230,12 @@ FILE *surf_fopen(const char *name, const char *mode)
   return NULL;
 }
 
-
-#ifndef MAX_DRIVE
-#define MAX_DRIVE 26
-#endif
-
 #ifdef _XBT_WIN32
 #include <windows.h>
+#define MAX_DRIVE 26
 static const char *disk_drives_letter_table[MAX_DRIVE] = {
-  "A:\\",
-  "B:\\",
-  "C:\\",
-  "D:\\",
-  "E:\\",
-  "F:\\",
-  "G:\\",
-  "H:\\",
-  "I:\\",
-  "J:\\",
-  "K:\\",
-  "L:\\",
-  "M:\\",
-  "N:\\",
-  "O:\\",
-  "P:\\",
-  "Q:\\",
-  "R:\\",
-  "S:\\",
-  "T:\\",
-  "U:\\",
-  "V:\\",
-  "W:\\",
-  "X:\\",
-  "Y:\\",
-  "Z:\\"
+  "A:\\","B:\\","C:\\","D:\\","E:\\","F:\\","G:\\","H:\\","I:\\","J:\\","K:\\","L:\\","M:\\",
+  "N:\\","O:\\","P:\\","Q:\\","R:\\","S:\\","T:\\","U:\\","V:\\","W:\\","X:\\","Y:\\","Z:\\"
 };
 #endif
 
@@ -354,37 +323,39 @@ int find_model_description(s_surf_model_description_t * table,
   return -1;
 }
 
-static XBT_INLINE void routing_asr_host_free(void *p)
-{
-  delete ((RoutingEdgePtr) p);
-}
-
 static XBT_INLINE void routing_asr_prop_free(void *p)
 {
-  xbt_dict_t elm = (xbt_dict_t) p;
-  xbt_dict_free(&elm);
-}
-
-static XBT_INLINE void surf_cpu_free(void *r)
-{
-  delete static_cast<CpuPtr>(r);
-}
-
-static XBT_INLINE void surf_link_free(void *r)
-{
-  delete static_cast<NetworkLinkPtr>(r);
+  //xbt_dict_t elm = (xbt_dict_t) p;
+  //xbt_dict_free(&elm); FIXME: leaking in some case? That's a sometimes double-free with AsCluster::~AsCluster
 }
 
 static XBT_INLINE void surf_host_free(void *r)
 {
-  delete static_cast<HostPtr>(r);
+  delete static_cast<Host*>(r);
 }
 
 static XBT_INLINE void surf_storage_free(void *r)
 {
-  delete static_cast<StoragePtr>(r);
+  delete static_cast<Storage*>(r);
 }
 
+void sg_version_check(int lib_version_major,int lib_version_minor,int lib_version_patch) {
+    if ((lib_version_major != SIMGRID_VERSION_MAJOR) || (lib_version_minor != SIMGRID_VERSION_MINOR)) {
+      fprintf(stderr,
+                 "FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, "
+                 "and then linked against SimGrid %d.%d.%d. Please fix this.\n",
+              SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,
+                         lib_version_major,lib_version_minor,lib_version_patch);
+      abort();
+    }
+    if (lib_version_patch != SIMGRID_VERSION_PATCH) {
+        fprintf(stderr,
+                 "Warning: Your program was compiled with SimGrid version %d.%d.%d, "
+                 "and then linked against SimGrid %d.%d.%d. Proceeding anyway.\n",
+                SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,
+                         lib_version_major,lib_version_minor,lib_version_patch);
+    }
+}
 
 void sg_version(int *ver_major,int *ver_minor,int *ver_patch) {
   *ver_major = SIMGRID_VERSION_MAJOR;
@@ -396,29 +367,26 @@ void surf_init(int *argc, char **argv)
 {
   XBT_DEBUG("Create all Libs");
   host_lib = xbt_lib_new();
-  link_lib = xbt_lib_new();
   as_router_lib = xbt_lib_new();
   storage_lib = xbt_lib_new();
   storage_type_lib = xbt_lib_new();
   file_lib = xbt_lib_new();
   watched_hosts_lib = xbt_dict_new_homogeneous(NULL);
 
+  sg_host_init();
+
   XBT_DEBUG("Add routing levels");
-  ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,routing_asr_host_free);
-  ROUTING_ASR_LEVEL  = xbt_lib_add_level(as_router_lib,routing_asr_host_free);
   ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib,routing_asr_prop_free);
 
   XBT_DEBUG("Add SURF levels");
-  SURF_CPU_LEVEL = xbt_lib_add_level(host_lib,surf_cpu_free);
   SURF_HOST_LEVEL = xbt_lib_add_level(host_lib,surf_host_free);
-  SURF_LINK_LEVEL = xbt_lib_add_level(link_lib,surf_link_free);
   SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,surf_storage_free);
 
   xbt_init(argc, argv);
   if (!model_list)
-    model_list = xbt_dynar_new(sizeof(ModelPtr), NULL);
+    model_list = xbt_dynar_new(sizeof(Model*), NULL);
   if (!model_list_invoke)
-    model_list_invoke = xbt_dynar_new(sizeof(ModelPtr), NULL);
+    model_list_invoke = xbt_dynar_new(sizeof(Model*), NULL);
   if (!history)
     history = tmgr_history_new();
 
@@ -434,7 +402,7 @@ void surf_init(int *argc, char **argv)
 void surf_exit(void)
 {
   unsigned int iter;
-  ModelPtr model = NULL;
+  Model *model = NULL;
 
   TRACE_end();                  /* Just in case it was not called by the upper
                                  * layer (or there is no upper layer) */
@@ -445,9 +413,9 @@ void surf_exit(void)
   xbt_dynar_free(&surf_path);
 
   xbt_lib_free(&host_lib);
-  xbt_lib_free(&link_lib);
   xbt_lib_free(&as_router_lib);
   xbt_lib_free(&storage_lib);
+  sg_link_exit();
   xbt_lib_free(&storage_type_lib);
   xbt_lib_free(&file_lib);
   xbt_dict_free(&watched_hosts_lib);
@@ -473,9 +441,6 @@ void surf_exit(void)
   xbt_parmap_destroy(surf_parmap);
 #endif
 
-  xbt_free(surf_mins);
-  surf_mins = NULL;
-
   tmgr_finalize();
   surf_parse_lex_destroy();
   surf_parse_free_callbacks();
@@ -487,9 +452,8 @@ void surf_exit(void)
  * Model *
  *********/
 
-Model::Model(const char *name)
+Model::Model()
   : p_maxminSystem(NULL)
-  , p_name(name)
 {
   p_readyActionSet = new ActionList();
   p_runningActionSet = new ActionList();
@@ -522,7 +486,7 @@ double Model::shareResources(double now)
 
 double Model::shareResourcesLazy(double now)
 {
-  ActionPtr action = NULL;
+  Action *action = NULL;
   double min = -1;
   double share;
 
@@ -601,11 +565,11 @@ double Model::shareResourcesFull(double /*now*/) {
   THROW_UNIMPLEMENTED;
 }
 
-double Model::shareResourcesMaxMin(ActionListPtr running_actions,
+double Model::shareResourcesMaxMin(ActionList *running_actions,
                           lmm_system_t sys,
                           void (*solve) (lmm_system_t))
 {
-  ActionPtr action = NULL;
+  Action *action = NULL;
   double min = -1;
   double value = -1;
 
@@ -684,17 +648,17 @@ Resource::Resource()
 : p_name(NULL), p_properties(NULL), p_model(NULL)
 {}
 
-Resource::Resource(ModelPtr model, const char *name, xbt_dict_t props)
+Resource::Resource(Model *model, const char *name, xbt_dict_t props)
   : p_name(xbt_strdup(name)), p_properties(props), p_model(model)
   , m_running(true), m_stateCurrent(SURF_RESOURCE_ON)
 {}
 
-Resource::Resource(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
+Resource::Resource(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
   : p_name(xbt_strdup(name)), p_properties(props), p_model(model)
   , m_running(true), m_stateCurrent(SURF_RESOURCE_ON), p_constraint(constraint)
 {}
 
-Resource::Resource(ModelPtr model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit)
+Resource::Resource(Model *model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit)
   : p_name(xbt_strdup(name)), p_properties(props), p_model(model)
   , m_running(true), m_stateCurrent(stateInit)
 {}
@@ -733,7 +697,7 @@ void Resource::turnOff()
   }
 }
 
-ModelPtr Resource::getModel() {
+Model *Resource::getModel() {
   return p_model;
 }
 
@@ -764,7 +728,7 @@ const char *surf_action_state_names[6] = {
   "SURF_ACTION_NOT_IN_THE_SYSTEM"
 };
 
-void Action::initialize(ModelPtr model, double cost, bool failed,
+void Action::initialize(Model *model, double cost, bool failed,
                         lmm_variable_t var)
 {
   m_priority = 1.0;
@@ -772,7 +736,6 @@ void Action::initialize(ModelPtr model, double cost, bool failed,
   m_remains = cost;
   m_maxDuration = NO_MAX_DURATION;
   m_finish = -1.0;
-  m_failed = failed;
   m_start = surf_get_clock();
   m_cost = cost;
   p_model = model;
@@ -782,11 +745,6 @@ void Action::initialize(ModelPtr model, double cost, bool failed,
   m_lastUpdate = 0;
   m_suspended = false;
   m_hat = NOTSET;
-}
-
-Action::Action(ModelPtr model, double cost, bool failed)
-{
-  initialize(model, cost, failed);
   p_category = NULL;
   p_stateHookup.prev = 0;
   p_stateHookup.next = 0;
@@ -798,18 +756,14 @@ Action::Action(ModelPtr model, double cost, bool failed)
   p_stateSet->push_back(*this);
 }
 
-Action::Action(ModelPtr model, double cost, bool failed, lmm_variable_t var)
+Action::Action(Model *model, double cost, bool failed)
 {
-  initialize(model, cost, failed, var);
-  p_category = NULL;
-  p_stateHookup.prev = 0;
-  p_stateHookup.next = 0;
-  if (failed)
-    p_stateSet = getModel()->getFailedActionSet();
-  else
-    p_stateSet = getModel()->getRunningActionSet();
+  initialize(model, cost, failed);
+}
 
-  p_stateSet->push_back(*this);
+Action::Action(Model *model, double cost, bool failed, lmm_variable_t var)
+{
+  initialize(model, cost, failed, var);
 }
 
 Action::~Action() {
@@ -1008,7 +962,7 @@ void Action::heapUpdate(xbt_heap_t heap, double key, enum heap_action_type hat)
 
 /* added to manage the communication action's heap */
 void surf_action_lmm_update_index_heap(void *action, int i) {
-  ((ActionPtr)action)->updateIndexHeap(i);
+  static_cast<Action*>(action)->updateIndexHeap(i);
 }
 
 void Action::updateIndexHeap(int i) {
@@ -1057,7 +1011,7 @@ void Action::updateRemainingLazy(double now)
     double_update(&m_remains, m_lastValue * delta, sg_surf_precision*sg_maxmin_precision);
 
     if (getModel() == surf_cpu_model_pm && TRACE_is_enabled()) {
-      ResourcePtr cpu = static_cast<ResourcePtr>(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0)));
+      Resource *cpu = static_cast<Resource*>(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0)));
       TRACE_surf_host_set_utilization(cpu->getName(), getCategory(), m_lastValue, m_lastUpdate, now - m_lastUpdate);
     }
     XBT_DEBUG("Updating action(%p): remains is now %f", this, m_remains);
index 8b61329..11d53f0 100644 (file)
@@ -60,7 +60,6 @@ XBT_PUBLIC(double) surf_get_clock(void);
 }
 
 extern double sg_sender_gap;
-XBT_PUBLIC_DATA(int)  SURF_CPU_LEVEL;    //Surf cpu level
 
 extern surf_callback(void, void) surfExitCallbacks;
 
@@ -69,15 +68,6 @@ int __surf_is_absolute_file_path(const char *file_path);
 /***********
  * Classes *
  ***********/
-//class Model;
-typedef Model* ModelPtr;
-
-//class Resource;
-typedef Resource* ResourcePtr;
-
-//class Action;
-typedef Action* ActionPtr;
-
 typedef boost::intrusive::list<Action> ActionList;
 typedef ActionList* ActionListPtr;
 typedef boost::intrusive::list_base_hook<> actionHook;
@@ -117,27 +107,13 @@ XBT_PUBLIC_DATA(xbt_dynar_t) model_list;
  */
 XBT_PUBLIC_CLASS Model {
 public:
-  /**
-   * @brief Model constructor
-   *
-   * @param name the name of the model
-   */
-  Model(const char *name);
-
-  /**
-   * @brief Model destructor
-   */
+  /** @brief Constructor */
+  Model();
+  /** @brief Destructor */
   virtual ~Model();
 
   virtual void addTraces() =0;
 
-  /**
-   * @brief Get the name of the current Model
-   *
-   * @return The name of the current Model
-   */
-  const char *getName() {return p_name;}
-
   /**
    * @brief Get the set of [actions](@ref Action) in *ready* state
    *
@@ -221,6 +197,13 @@ public:
   virtual void updateActionsStateLazy(double now, double delta);
   virtual void updateActionsStateFull(double now, double delta);
 
+  /** @brief Returns whether this model have an idempotent shareResource()
+   *
+   * The only model that is not is NS3: computing the next timestamp moves the model up to that point,
+   * so we need to call it only when the next timestamp of other sources is computed.
+   */
+  virtual bool shareResourcesIsIdempotent()=0;
+
 protected:
   ActionLmmListPtr p_modifiedSet;
   lmm_system_t p_maxminSystem;
@@ -229,8 +212,6 @@ protected:
   xbt_heap_t p_actionHeap;
 
 private:
-  const char *p_name;
-
   ActionListPtr p_readyActionSet; /**< Actions in state SURF_ACTION_READY */
   ActionListPtr p_runningActionSet; /**< Actions in state SURF_ACTION_RUNNING */
   ActionListPtr p_failedActionSet; /**< Actions in state SURF_ACTION_FAILED */
@@ -268,7 +249,7 @@ public:
    * @param name The name of the Resource
    * @param props Dictionary of properties associated to this Resource
    */
-  Resource(ModelPtr model, const char *name, xbt_dict_t props);
+  Resource(Model *model, const char *name, xbt_dict_t props);
 
   /**
    * @brief Resource constructor
@@ -278,7 +259,7 @@ public:
    * @param props Dictionary of properties associated to this Resource
    * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
    */
-  Resource(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint);
+  Resource(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint);
   /**
    * @brief Resource constructor
    *
@@ -287,7 +268,7 @@ public:
    * @param props Dictionary of properties associated to this Resource
    * @param stateInit the initial state of the Resource
    */
-  Resource(ModelPtr model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit);
+  Resource(Model *model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit);
 
   /**
    * @brief Resource destructor
@@ -299,7 +280,7 @@ public:
    *
    * @return The Model of the current Resource
    */
-  ModelPtr getModel();
+  Model *getModel();
 
   /**
    * @brief Get the name of the current Resource
@@ -365,7 +346,7 @@ public:
 private:
   const char *p_name;
   xbt_dict_t p_properties;
-  ModelPtr p_model;
+  Model *p_model;
   bool m_running;
   e_surf_resource_state_t m_stateCurrent;
 
@@ -395,7 +376,7 @@ private:
   /**
    * @brief Common initializations for the constructors
    */
-  void initialize(ModelPtr model, double cost, bool failed,
+  void initialize(Model *model, double cost, bool failed,
                   lmm_variable_t var = NULL);
 
 public:
@@ -406,7 +387,7 @@ public:
    * @param cost The cost of the Action
    * @param failed If the action is impossible (e.g.: execute something on a switched off host)
    */
-  Action(ModelPtr model, double cost, bool failed);
+  Action(Model *model, double cost, bool failed);
 
   /**
    * @brief Action constructor
@@ -416,222 +397,97 @@ public:
    * @param failed If the action is impossible (e.g.: execute something on a switched off host)
    * @param var The lmm variable associated to this Action if it is part of a LMM component
    */
-  Action(ModelPtr model, double cost, bool failed, lmm_variable_t var);
+  Action(Model *model, double cost, bool failed, lmm_variable_t var);
 
-  /**
-   * @brief Action destructor
-   */
+  /** @brief Destructor */
   virtual ~Action();
 
-  /**
-   * @brief Finish the action
-   */
+  /** @brief Mark that the action is now finished */
   void finish();
 
-  /**
-   * @brief Get the [state](\ref e_surf_action_state_t) of the current Action
-   *
-   * @return The state of the current Action
-   */
+  /** @brief Get the [state](\ref e_surf_action_state_t) of the current Action */
   e_surf_action_state_t getState(); /**< get the state*/
-
-  /**
-   * @brief Set the [state](\ref e_surf_action_state_t) of the current Action
-   *
-   * @param state The new state of the current Action
-   */
+  /** @brief Set the [state](\ref e_surf_action_state_t) of the current Action */
   virtual void setState(e_surf_action_state_t state);
 
-  /**
-   * @brief Get the bound of the current Action
-   *
-   * @return The bound of the current Action
-   */
+  /** @brief Get the bound of the current Action */
   double getBound();
-
-  /**
-   * @brief Set the bound of the current Action
-   *
-   * @param bound The new bound of the current Action
-   */
+  /** @brief Set the bound of the current Action */
   void setBound(double bound);
 
-  /**
-   * @brief Get the start time of the current action
-   *
-   * @return The start time of the current action
-   */
+  /** @brief Get the start time of the current action */
   double getStartTime();
-
-  /**
-   * @brief Get the finish time of the current action
-   *
-   * @return The finish time of the current action
-   */
+  /** @brief Get the finish time of the current action */
   double getFinishTime();
 
-  /**
-   * @brief Get the data associated to the current action
-   *
-   * @return The data associated to the current action
-   */
+  /** @brief Get the user data associated to the current action */
   void *getData() {return p_data;}
-
-  /**
-   * @brief Set the data associated to the current action
-   *
-   * @param data The new data associated to the current action
-   */
+  /** @brief Set the user data associated to the current action */
   void setData(void* data);
 
-  /**
-   * @brief Get the maximum duration of the current action
-   *
-   * @return The maximum duration of the current action
-   */
-  double getMaxDuration() {return m_maxDuration;}
-
-  /**
-   * @brief Get the category associated to the current action
-   *
-   * @return The category associated to the current action
-   */
-  char *getCategory() {return p_category;}
-
-  /**
-   * @brief Get the cost of the current action
-   *
-   * @return The cost of the current action
-   */
+  /** @brief Get the cost of the current action */
   double getCost() {return m_cost;}
-
-  /**
-   * @brief Set the cost of the current action
-   *
-   * @param cost The new cost of the current action
-   */
+  /** @brief Set the cost of the current action */
   void setCost(double cost) {m_cost = cost;}
 
-  /**
-   * @brief Update the maximum duration of the current action
-   *
-   * @param delta [TODO]
-   */
+  /** @brief Update the maximum duration of the current action
+   *  @param delta Amount to remove from the MaxDuration */
   void updateMaxDuration(double delta) {double_update(&m_maxDuration, delta,sg_surf_precision);}
 
-  /**
-   * @brief Update the remaining time of the current action
-   *
-   * @param delta [TODO]
-   */
+  /** @brief Update the remaining time of the current action
+   *  @param delta Amount to remove from the remaining time */
   void updateRemains(double delta) {double_update(&m_remains, delta, sg_maxmin_precision*sg_surf_precision);}
 
-  /**
-   * @brief Set the remaining time of the current action
-   *
-   * @param value The new remaining time of the current action
-   */
+  /** @brief Set the remaining time of the current action */
   void setRemains(double value) {m_remains = value;}
+  /** @brief Get the remaining time of the current action after updating the resource */
+  virtual double getRemains();
+  /** @brief Get the remaining time of the current action without updating the resource */
+  double getRemainsNoUpdate();
 
-  /**
-   * @brief Set the finish time of the current action
-   *
-   * @param value The new Finush time of the current action
-   */
+  /** @brief Set the finish time of the current action */
   void setFinishTime(double value) {m_finish = value;}
 
-  /**
-   * @brief Add a reference to the current action
-   */
+  /**@brief Add a reference to the current action (refcounting) */
   void ref();
-
-  /**
-   * @brief Remove a reference to the current action
-   * @details If the Action has no more reference, we destroy it
-   *
-   * @return true if the action was destroyed and false if someone still has references on it
+  /** @brief Unref that action (and destroy it if refcount reaches 0)
+   *  @return true if the action was destroyed and false if someone still has references on it
    */
   virtual int unref();
 
-  /**
-   * @brief Cancel the current Action if running
-   */
+  /** @brief Cancel the current Action if running */
   virtual void cancel();
 
-  /**
-   * @brief Recycle an Action
-   */
-  virtual void recycle(){};
-
-  /**
-   * @brief Suspend the current Action
-   */
+  /** @brief Suspend the current Action */
   virtual void suspend();
 
-  /**
-   * @brief Resume the current Action
-   */
+  /** @brief Resume the current Action */
   virtual void resume();
 
-  /**
-   * @brief Check if the current action is running
-   *
-   * @return true if the current Action is suspended, false otherwise
-   */
+  /** @brief Returns true if the current action is running */
   virtual bool isSuspended();
 
-  /**
-   * @brief Set the maximum duration of the current Action
-   *
-   * @param duration The new maximum duration of the current Action
-   */
+  /** @brief Get the maximum duration of the current action */
+  double getMaxDuration() {return m_maxDuration;}
+  /** @brief Set the maximum duration of the current Action */
   virtual void setMaxDuration(double duration);
 
-  /**
-   * @brief Set the priority of the current Action
-   *
-   * @param priority The new priority of the current Action
-   */
-  virtual void setPriority(double priority);
-
-  /**
-   * @brief Set the category of the current Action
-   *
-   * @param category The new category of the current Action
-   */
+  /** @brief Get the tracing category associated to the current action */
+  char *getCategory() {return p_category;}
+  /** @brief Set the tracing category of the current Action */
   void setCategory(const char *category);
 
-  /**
-   * @brief Get the remaining time of the current action after updating the resource
-   *
-   * @return The remaining time
-   */
-  virtual double getRemains();
-
-  /**
-   * @brief Get the remaining time of the current action without updating the resource
-   *
-   * @return The remaining time
-   */
-  double getRemainsNoUpdate();
-
-  /**
-   * @brief Get the priority of the current Action
-   *
-   * @return The priority of the current Action
-   */
+  /** @brief Get the priority of the current Action */
   double getPriority() {return m_priority;};
+  /** @brief Set the priority of the current Action */
+  virtual void setPriority(double priority);
 
-  /**
-   * @brief Get the state set in which the action is
-   *
-   * @return The state set in which the action is
-   */
+  /** @brief Get the state set in which the action is */
   ActionListPtr getStateSet() {return p_stateSet;};
 
   s_xbt_swag_hookup_t p_stateHookup;
 
-  ModelPtr getModel() {return p_model;}
+  Model *getModel() {return p_model;}
 
 protected:
   ActionListPtr p_stateSet;
@@ -642,7 +498,6 @@ protected:
   double m_finish; /**< finish time : this is modified during the run and fluctuates until the task is completed */
 
 private:
-  bool m_failed;
   double m_start; /**< start time  */
   char *p_category;               /**< tracing category for categorized resource utilization monitoring */
 
@@ -650,7 +505,7 @@ private:
   int m_latencyLimited;               /**< Set to 1 if is limited by latency, 0 otherwise */
   #endif
   double    m_cost;
-  ModelPtr p_model;
+  Model *p_model;
   void *p_data; /**< for your convenience */
 
   /* LMM */
index 67ec97d..23fd809 100644 (file)
  */
 xbt_lib_t host_lib;
 
-int ROUTING_HOST_LEVEL;         //Routing level
-int SURF_CPU_LEVEL;             //Surf cpu level
 int SURF_HOST_LEVEL;            //Surf host level
-int SIMIX_HOST_LEVEL;           //Simix host level
-int SIMIX_STORAGE_LEVEL;        //Simix storage level
-int MSG_HOST_LEVEL;             //Msg host level
-int MSG_STORAGE_LEVEL;          //Msg storage level
-int MSG_FILE_LEVEL;             //Msg file level
-int SD_HOST_LEVEL;              //Simdag host level
-int SD_STORAGE_LEVEL;           //Simdag storage level
 int COORD_HOST_LEVEL=0;         //Coordinates level
 int NS3_HOST_LEVEL;             //host node for ns3
 
-/**
- * @ingroup SURF_build_api
- * @brief A library containing all known links
- */
-xbt_lib_t link_lib;
-int SD_LINK_LEVEL;              //Simdag level
-int SURF_LINK_LEVEL;            //Surf level
+int MSG_FILE_LEVEL;             //Msg file level
+
+int SIMIX_STORAGE_LEVEL;        //Simix storage level
+int MSG_STORAGE_LEVEL;          //Msg storage level
+int SD_STORAGE_LEVEL;           //Simdag storage level
 
 xbt_lib_t as_router_lib;
 int ROUTING_ASR_LEVEL;          //Routing level
@@ -57,16 +46,17 @@ static xbt_dict_t random_value = NULL;
  *
  * Routing edges are either host and routers, whatever
  */
-RoutingEdgePtr sg_routing_edge_by_name_or_null(const char *name) {
-  RoutingEdgePtr net_elm = (RoutingEdgePtr) xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL);
+RoutingEdge *sg_routing_edge_by_name_or_null(const char *name) {
+  sg_host_t h = sg_host_by_name(name);
+  RoutingEdge *net_elm = h==NULL?NULL: sg_host_edge(h);
   if (!net_elm)
-       net_elm = (RoutingEdgePtr) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
+       net_elm = (RoutingEdge*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
   return net_elm;
 }
 
 /* Global vars */
-RoutingPlatfPtr routing_platf = NULL;
-AsPtr current_routing = NULL;
+RoutingPlatf *routing_platf = NULL;
+As *current_routing = NULL;
 
 /* global parse functions */
 extern xbt_dynar_t mount_list;
@@ -122,15 +112,15 @@ struct s_model_type routing_models[] = {
  */
 static void parse_S_host_link(sg_platf_host_link_cbarg_t host)
 {
-  RoutingEdgePtr info = static_cast<RoutingEdgePtr>(xbt_lib_get_or_null(host_lib, host->id, ROUTING_HOST_LEVEL));
+  RoutingEdge *info = sg_host_edge(sg_host_by_name(host->id));
   xbt_assert(info, "Host '%s' not found!", host->id);
   xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER] ||
       current_routing->p_modelDesc == &routing_models[SURF_MODEL_VIVALDI],
       "You have to be in model Cluster to use tag host_link!");
 
   s_surf_parsing_link_up_down_t link_up_down;
-  link_up_down.link_up = xbt_lib_get_or_null(link_lib, host->link_up, SURF_LINK_LEVEL);
-  link_up_down.link_down = xbt_lib_get_or_null(link_lib, host->link_down, SURF_LINK_LEVEL);
+  link_up_down.link_up = Link::byName(host->link_up);
+  link_up_down.link_down = Link::byName(host->link_down);
 
   xbt_assert(link_up_down.link_up, "Link '%s' not found!",host->link_up);
   xbt_assert(link_up_down.link_down, "Link '%s' not found!",host->link_down);
@@ -154,15 +144,15 @@ static void parse_S_host(sg_platf_host_cbarg_t host)
 {
   if (current_routing->p_hierarchy == SURF_ROUTING_NULL)
     current_routing->p_hierarchy = SURF_ROUTING_BASE;
-  xbt_assert(!xbt_lib_get_or_null(host_lib, host->id, ROUTING_HOST_LEVEL),
-             "Reading a host, processing unit \"%s\" already exists", host->id);
+  xbt_assert(!sg_host_by_name(host->id),
+                    "Reading a host, processing unit \"%s\" already exists", host->id);
 
-  RoutingEdgePtr info = new RoutingEdgeImpl(xbt_strdup(host->id),
+  RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(host->id),
                                                    -1,
                                                    SURF_NETWORK_ELEMENT_HOST,
                                                    current_routing);
   info->setId(current_routing->parsePU(info));
-  xbt_lib_set(host_lib, host->id, ROUTING_HOST_LEVEL, (void *) info);
+  sg_host_edge_set(sg_host_by_name_or_create(host->id), info);
   XBT_DEBUG("Having set name '%s' id '%d'", host->id, info->getId());
 
   if(mount_list){
@@ -201,7 +191,7 @@ static void parse_S_router(sg_platf_router_cbarg_t router)
              "Reading a router, processing unit \"%s\" already exists",
              router->id);
 
-  RoutingEdgePtr info = new RoutingEdgeImpl(xbt_strdup(router->id),
+  RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(router->id),
                                             -1,
                                             SURF_NETWORK_ELEMENT_ROUTER,
                                             current_routing);
@@ -371,13 +361,13 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
   }
 
   /* make a new routing component */
-  AsPtr new_as = model->create();
+  As *new_as = model->create();
 
   new_as->p_modelDesc = model;
   new_as->p_hierarchy = SURF_ROUTING_NULL;
   new_as->p_name = xbt_strdup(AS->id);
 
-  RoutingEdgePtr info = new RoutingEdgeImpl(xbt_strdup(new_as->p_name),
+  RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(new_as->p_name),
                                             -1,
                                             SURF_NETWORK_ELEMENT_AS,
                                             current_routing);
@@ -457,15 +447,15 @@ static void elements_father(sg_routing_edge_t src, sg_routing_edge_t dst,
 {
   xbt_assert(src && dst, "bad parameters for \"elements_father\" method");
 #define ELEMENTS_FATHER_MAXDEPTH 16     /* increase if it is not enough */
-  AsPtr src_as, dst_as;
-  AsPtr path_src[ELEMENTS_FATHER_MAXDEPTH];
-  AsPtr path_dst[ELEMENTS_FATHER_MAXDEPTH];
+  As *src_as, *dst_as;
+  As *path_src[ELEMENTS_FATHER_MAXDEPTH];
+  As *path_dst[ELEMENTS_FATHER_MAXDEPTH];
   int index_src = 0;
   int index_dst = 0;
-  AsPtr current;
-  AsPtr current_src;
-  AsPtr current_dst;
-  AsPtr father;
+  As *current;
+  As *current_src;
+  As *current_dst;
+  As *father;
 
   /* (1) find the as where the src and dst are located */
   sg_routing_edge_t src_data = src;
@@ -525,7 +515,7 @@ static void elements_father(sg_routing_edge_t src, sg_routing_edge_t dst,
  * This function is called by "get_route" and "get_latency". It allows to walk
  * recursively through the ASes tree.
  */
-static void _get_route_and_latency(RoutingEdgePtr src, RoutingEdgePtr dst,
+static void _get_route_and_latency(RoutingEdge *src, RoutingEdge *dst,
                                    xbt_dynar_t * links, double *latency)
 {
   s_sg_platf_route_cbarg_t route = SG_PLATF_ROUTE_INITIALIZER;
@@ -535,7 +525,7 @@ static void _get_route_and_latency(RoutingEdgePtr src, RoutingEdgePtr dst,
   XBT_DEBUG("Solve route/latency  \"%s\" to \"%s\"", src->getName(), dst->getName());
 
   /* Find how src and dst are interconnected */
-  AsPtr common_father, src_father, dst_father;
+  As *common_father, *src_father, *dst_father;
   elements_father(src, dst, &common_father, &src_father, &dst_father);
   XBT_DEBUG("elements_father: common father '%s' src_father '%s' dst_father '%s'",
       common_father->p_name, src_father->p_name, dst_father->p_name);
@@ -565,8 +555,8 @@ static void _get_route_and_latency(RoutingEdgePtr src, RoutingEdgePtr dst,
 
   route.link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
   // Find the net_card corresponding to father
-  RoutingEdgePtr src_father_net_elm = src_father->p_netElem;
-  RoutingEdgePtr dst_father_net_elm = dst_father->p_netElem;
+  RoutingEdge *src_father_net_elm = src_father->p_netElem;
+  RoutingEdge *dst_father_net_elm = dst_father->p_netElem;
 
   common_father->getRouteAndLatency(src_father_net_elm, dst_father_net_elm,
                                     &route, latency);
@@ -612,7 +602,7 @@ e_surf_network_element_type_t surf_routing_edge_get_rc_type(sg_routing_edge_t ed
  * walk through the routing components tree and find a route between hosts
  * by calling the differents "get_route" functions in each routing component.
  */
-void RoutingPlatf::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst,
+void RoutingPlatf::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst,
                                    xbt_dynar_t* route, double *latency)
 {
   XBT_DEBUG("routing_get_route_and_latency from %s to %s", src->getName(), dst->getName());
@@ -631,9 +621,9 @@ xbt_dynar_t RoutingPlatf::getOneLinkRoutes(){
   return recursiveGetOneLinkRoutes(p_root);
 }
 
-xbt_dynar_t RoutingPlatf::recursiveGetOneLinkRoutes(AsPtr rc)
+xbt_dynar_t RoutingPlatf::recursiveGetOneLinkRoutes(As *rc)
 {
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
+  xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
 
   //adding my one link routes
   xbt_dynar_t onelink_mine = rc->getOneLinkRoutes();
@@ -654,7 +644,7 @@ xbt_dynar_t RoutingPlatf::recursiveGetOneLinkRoutes(AsPtr rc)
 
 e_surf_network_element_type_t routing_get_network_element_type(const char *name)
 {
-  RoutingEdgePtr rc = sg_routing_edge_by_name_or_null(name);
+  RoutingEdge *rc = sg_routing_edge_by_name_or_null(name);
   if (rc)
     return rc->getRcType();
 
@@ -837,7 +827,7 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
     XBT_DEBUG("<AS id=\"%s\"\trouting=\"Torus_Cluster\">", cluster->id);
     AS.routing = A_surfxml_AS_routing_Cluster___torus;
     sg_platf_new_AS_begin(&AS);
-    ((AsClusterTorusPtr)current_routing)->parse_specific_arguments(cluster);
+    ((AsClusterTorus*)current_routing)->parse_specific_arguments(cluster);
   }
   else if (cluster->topology == SURF_CLUSTER_FAT_TREE) {
     XBT_DEBUG("<AS id=\"%s\"\trouting=\"Fat_Tree_Cluster\">", cluster->id);
@@ -853,13 +843,13 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
   }
 
   if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){
-      ((AsClusterPtr)current_routing)->p_nb_links_per_node++;
-      ((AsClusterPtr)current_routing)->p_has_loopback=1;
+      ((AsCluster*)current_routing)->p_nb_links_per_node++;
+      ((AsCluster*)current_routing)->p_has_loopback=1;
   }
 
   if(cluster->limiter_link!=0){
-      ((AsClusterPtr)current_routing)->p_nb_links_per_node++;
-      ((AsClusterPtr)current_routing)->p_has_limiter=1;
+      ((AsCluster*)current_routing)->p_nb_links_per_node++;
+      ((AsCluster*)current_routing)->p_has_limiter=1;
   }
 
 
@@ -961,11 +951,10 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
         link.state     = SURF_RESOURCE_ON;
         link.policy    = SURF_LINK_FATPIPE;
         sg_platf_new_link(&link);
-        info_loop.link_up   =
-            xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL);
+        info_loop.link_up   = Link::byName(tmp_link);
         info_loop.link_down = info_loop.link_up;
         free(tmp_link);
-        xbt_dynar_set(current_routing->p_linkUpDownList, rankId*((AsClusterPtr)current_routing)->p_nb_links_per_node, &info_loop);
+        xbt_dynar_set(current_routing->p_linkUpDownList, rankId*(static_cast<AsCluster*>(current_routing))->p_nb_links_per_node, &info_loop);
       }
 
       //add a limiter link (shared link to account for maximal bandwidth of the node)
@@ -982,12 +971,11 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
         link.state = SURF_RESOURCE_ON;
         link.policy = SURF_LINK_SHARED;
         sg_platf_new_link(&link);
-        info_lim.link_up =
-            xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL);
+        info_lim.link_up = Link::byName(tmp_link);
         info_lim.link_down = info_lim.link_up;
         free(tmp_link);
         xbt_dynar_set(current_routing->p_linkUpDownList,
-            rankId*((AsClusterPtr)current_routing)->p_nb_links_per_node + ((AsClusterPtr)current_routing)->p_has_loopback ,
+            rankId*(static_cast<AsCluster*>(current_routing))->p_nb_links_per_node + static_cast<AsCluster*>(current_routing)->p_has_loopback ,
             &info_lim);
 
       }
@@ -998,10 +986,10 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
         ((AsClusterFatTree*) current_routing)->addProcessingNode(i);
       }
       else {
-      ((AsClusterPtr)current_routing)->create_links_for_node(cluster, i, rankId, rankId*
-          ((AsClusterPtr)current_routing)->p_nb_links_per_node
-          + ((AsClusterPtr)current_routing)->p_has_loopback
-          + ((AsClusterPtr)current_routing)->p_has_limiter );
+      static_cast<AsCluster*>(current_routing)->create_links_for_node(cluster, i, rankId, rankId*
+                 static_cast<AsCluster*>(current_routing)->p_nb_links_per_node
+          + static_cast<AsCluster*>(current_routing)->p_has_loopback
+          + static_cast<AsCluster*>(current_routing)->p_has_limiter );
       }
       xbt_free(link_id);
       xbt_free(host_id);
@@ -1014,7 +1002,7 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
 
   // For fat trees, the links must be created once all nodes have been added
   if(cluster->topology == SURF_CLUSTER_FAT_TREE) {
-    ((AsClusterFatTree*)current_routing)->create_links();
+    static_cast<AsClusterFatTree*>(current_routing)->create_links();
   }
   // Add a router. It is magically used thanks to the way in which surf_routing_cluster is written,
   // and it's very useful to connect clusters together
@@ -1030,7 +1018,7 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
         bprintf("%s%s_router%s", cluster->prefix, cluster->id,
                 cluster->suffix);
   sg_platf_new_router(&router);
-  ((AsClusterPtr)current_routing)->p_router = (RoutingEdgePtr) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL);
+  ((AsCluster*)current_routing)->p_router = (RoutingEdge*) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL);
   free(newid);
 
   //Make the backbone
@@ -1048,7 +1036,7 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster)
 
     sg_platf_new_link(&link);
 
-    routing_cluster_add_backbone(xbt_lib_get_or_null(link_lib, link_backbone, SURF_LINK_LEVEL));
+    routing_cluster_add_backbone(Link::byName(link_backbone));
 
     free(link_backbone);
   }
@@ -1133,7 +1121,7 @@ static void routing_parse_peer(sg_platf_peer_cbarg_t peer)
   router.id = router_id;
   router.coord = peer->coord;
   sg_platf_new_router(&router);
-  static_cast<AsClusterPtr>(current_routing)->p_router = static_cast<RoutingEdgePtr>(xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL));
+  static_cast<AsCluster*>(current_routing)->p_router = static_cast<RoutingEdge*>(xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL));
 
   XBT_DEBUG("</AS>");
   sg_platf_new_AS_end();
@@ -1272,10 +1260,10 @@ static void check_disk_attachment()
   xbt_lib_cursor_t cursor;
   char *key;
   void **data;
-  RoutingEdgePtr host_elm;
+  RoutingEdge *host_elm;
   xbt_lib_foreach(storage_lib, cursor, key, data) {
     if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
-         StoragePtr storage = static_cast<StoragePtr>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
+         Storage *storage = static_cast<Storage*>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
          host_elm = sg_routing_edge_by_name_or_null(storage->p_attach);
          if(!host_elm)
                  surf_parse_error("Unable to attach storage %s: host %s doesn't exist.", storage->getName(), storage->p_attach);
@@ -1318,7 +1306,7 @@ void routing_register_callbacks()
  * This fuction is call by "finalize". It allow to finalize the
  * AS or routing components. It delete all the structures.
  */
-static void finalize_rec(AsPtr as) {
+static void finalize_rec(As *as) {
   xbt_dict_cursor_t cursor = NULL;
   char *key;
   AS_t elem;
@@ -1345,15 +1333,15 @@ AS_t surf_AS_get_routing_root() {
   return routing_platf->p_root;
 }
 
-const char *surf_AS_get_name(AsPtr as) {
+const char *surf_AS_get_name(As *as) {
   return as->p_name;
 }
 
-static AsPtr surf_AS_recursive_get_by_name(AsPtr current, const char * name) {
+static As *surf_AS_recursive_get_by_name(As *current, const char * name) {
   xbt_dict_cursor_t cursor = NULL;
   char *key;
   AS_t elem;
-  AsPtr tmp = NULL;
+  As *tmp = NULL;
 
   if(!strcmp(current->p_name, name))
     return current;
@@ -1368,22 +1356,22 @@ static AsPtr surf_AS_recursive_get_by_name(AsPtr current, const char * name) {
 }
 
 
-AsPtr surf_AS_get_by_name(const char * name) {
-  AsPtr as = surf_AS_recursive_get_by_name(routing_platf->p_root, name);
+As *surf_AS_get_by_name(const char * name) {
+  As *as = surf_AS_recursive_get_by_name(routing_platf->p_root, name);
   if(as == NULL)
     XBT_WARN("Impossible to find an AS with name %s, please check your input", name);
   return as;
 }
 
-xbt_dict_t surf_AS_get_routing_sons(AsPtr as) {
+xbt_dict_t surf_AS_get_routing_sons(As *as) {
   return as->p_routingSons;
 }
 
-const char *surf_AS_get_model(AsPtr as) {
+const char *surf_AS_get_model(As *as) {
   return as->p_modelDesc->name;
 }
 
-xbt_dynar_t surf_AS_get_hosts(AsPtr as) {
+xbt_dynar_t surf_AS_get_hosts(As *as) {
   xbt_dynar_t elms = as->p_indexNetworkElm;
   sg_routing_edge_t relm;
   xbt_dictelm_t delm;
@@ -1391,7 +1379,7 @@ xbt_dynar_t surf_AS_get_hosts(AsPtr as) {
   int count = xbt_dynar_length(elms);
   xbt_dynar_t res =  xbt_dynar_new(sizeof(xbt_dictelm_t), NULL);
   for (index = 0; index < count; index++) {
-     relm = xbt_dynar_get_as(elms, index, RoutingEdgePtr);
+     relm = xbt_dynar_get_as(elms, index, RoutingEdge*);
      delm = xbt_lib_get_elm_or_null(host_lib, relm->getName());
      if (delm!=NULL) {
        xbt_dynar_push(res, &delm);
index a45a29c..6877e4c 100644 (file)
@@ -21,37 +21,25 @@ xbt_edge_t new_xbt_graph_edge (xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xb
  * Classes *
  ***********/
 
-/* Note: As and RoutingEdge are declard as struct instead of class, to keep
-   compatibility with C files where they are mentioned. */
-struct As;
-typedef As *AsPtr;
-
+class As;
 class RoutingModelDescription;
-typedef RoutingModelDescription *RoutingModelDescriptionPtr;
-
-struct RoutingEdge;
-typedef RoutingEdge *RoutingEdgePtr;
-
 class Onelink;
-typedef Onelink *OnelinkPtr;
-
 class RoutingPlatf;
-typedef RoutingPlatf *RoutingPlatfPtr;
 
 /** @ingroup SURF_routing_interface
  * @brief The Autonomous System (AS) routing interface
  * @details [TODO]
  */
-struct As {
+class As {
 public:
   xbt_dynar_t p_indexNetworkElm;
   xbt_dict_t p_bypassRoutes;    /* store bypass routes */
   routing_model_description_t p_modelDesc;
   e_surf_routing_hierarchy_t p_hierarchy;
   char *p_name;
-  AsPtr p_routingFather;
+  As *p_routingFather;
   xbt_dict_t p_routingSons;
-  RoutingEdgePtr p_netElem;
+  RoutingEdge *p_netElem;
   xbt_dynar_t p_linkUpDownList;
 
   /**
@@ -75,17 +63,17 @@ public:
    * @param into [description]
    * @param latency [description]
    */
-  virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency)=0;
+  virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency)=0;
   virtual xbt_dynar_t getOneLinkRoutes()=0;
   virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0;
-  virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat)=0;
+  virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat)=0;
 
   /* The parser calls the following functions to inform the routing models
    * that a new element is added to the AS currently built.
    *
    * Of course, only the routing model of this AS is informed, not every ones */
-  virtual int parsePU(RoutingEdgePtr elm)=0; /* A host or a router, whatever */
-  virtual int parseAS( RoutingEdgePtr elm)=0;
+  virtual int parsePU(RoutingEdge *elm)=0; /* A host or a router, whatever */
+  virtual int parseAS( RoutingEdge *elm)=0;
   virtual void parseRoute(sg_platf_route_cbarg_t route)=0;
   virtual void parseASroute(sg_platf_route_cbarg_t route)=0;
   virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
@@ -102,13 +90,13 @@ public:
   virtual int *getIdPtr()=0;
   virtual void setId(int id)=0;
   virtual char *getName()=0;
-  virtual AsPtr getRcComponent()=0;
+  virtual As *getRcComponent()=0;
   virtual e_surf_network_element_type_t getRcType()=0;
 };
 
 struct RoutingEdgeImpl : public RoutingEdge {
 public:
-  RoutingEdgeImpl(char *name, int id, e_surf_network_element_type_t rcType, AsPtr rcComponent)
+  RoutingEdgeImpl(char *name, int id, e_surf_network_element_type_t rcType, As *rcComponent)
   : p_rcComponent(rcComponent), p_rcType(rcType), m_id(id), p_name(name) {}
   ~RoutingEdgeImpl() { xbt_free(p_name);};
 
@@ -116,10 +104,10 @@ public:
   int *getIdPtr() {return &m_id;}
   void setId(int id) {m_id = id;}
   char *getName() {return p_name;}
-  AsPtr getRcComponent() {return p_rcComponent;}
+  As *getRcComponent() {return p_rcComponent;}
   e_surf_network_element_type_t getRcType() {return p_rcType;}
 private:
-  AsPtr p_rcComponent;
+  As *p_rcComponent;
   e_surf_network_element_type_t p_rcType;
   int m_id;
   char *p_name;
@@ -133,7 +121,7 @@ public:
   int *getIdPtr() {return p_re->getIdPtr();}
   void setId(int id) {p_re->setId(id);}
   char *getName() {return p_re->getName();}
-  AsPtr getRcComponent() {return p_re->getRcComponent();}
+  As *getRcComponent() {return p_re->getRcComponent();}
   e_surf_network_element_type_t getRcType() {return p_re->getRcType();}
 private:
   RoutingEdge *p_re;
@@ -144,10 +132,10 @@ private:
  */
 class Onelink {
 public:
-  Onelink(void *link, RoutingEdgePtr src, RoutingEdgePtr dst)
+  Onelink(void *link, RoutingEdge *src, RoutingEdge *dst)
     : p_src(src), p_dst(dst), p_link(link) {};
-  RoutingEdgePtr p_src;
-  RoutingEdgePtr p_dst;
+  RoutingEdge *p_src;
+  RoutingEdge *p_dst;
   void *p_link;
 };
 
@@ -157,12 +145,12 @@ public:
 XBT_PUBLIC_CLASS RoutingPlatf {
 public:
   ~RoutingPlatf();
-  AsPtr p_root;
+  As *p_root;
   void *p_loopback;
   xbt_dynar_t p_lastRoute;
   xbt_dynar_t getOneLinkRoutes(void);
-  xbt_dynar_t recursiveGetOneLinkRoutes(AsPtr rc);
-  void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, xbt_dynar_t * links, double *latency);
+  xbt_dynar_t recursiveGetOneLinkRoutes(As *rc);
+  void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, xbt_dynar_t * links, double *latency);
 };
 
 #endif /* NETWORK_ROUTING_HPP_ */
index 91427cd..c33c05f 100644 (file)
@@ -29,7 +29,7 @@ AsCluster::AsCluster() : AsNone()
 }
 
 /* Business methods */
-void AsCluster::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat)
+void AsCluster::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat)
 {
   s_surf_parsing_link_up_down_t info;
   XBT_VERB("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]",
@@ -41,7 +41,7 @@ void AsCluster::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_pl
       info = xbt_dynar_get_as(p_linkUpDownList, src->getId() * p_nb_links_per_node, s_surf_parsing_link_up_down_t);
       xbt_dynar_push_as(route->link_list, void *, info.link_up);
       if (lat)
-        *lat += static_cast<NetworkLinkPtr>(info.link_up)->getLatency();
+        *lat += static_cast<Link*>(info.link_up)->getLatency();
       return;
     }
 
@@ -55,13 +55,13 @@ void AsCluster::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_pl
     if (info.link_up) {         // link up
       xbt_dynar_push_as(route->link_list, void *, info.link_up);
       if (lat)
-        *lat += static_cast<NetworkLinkPtr>(info.link_up)->getLatency();
+        *lat += static_cast<Link*>(info.link_up)->getLatency();
     }
 
   }
 
   if (p_backbone) {
-    xbt_dynar_push_as(route->link_list, void *, static_cast<ResourcePtr>(p_backbone));
+    xbt_dynar_push_as(route->link_list, void *, static_cast<Resource*>(p_backbone));
     if (lat)
       *lat += p_backbone->getLatency();
   }
@@ -72,7 +72,7 @@ void AsCluster::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_pl
     if (info.link_down) {       // link down
       xbt_dynar_push_as(route->link_list, void *, info.link_down);
       if (lat)
-        *lat += static_cast<NetworkLinkPtr>(info.link_down)->getLatency();
+        *lat += static_cast<Link*>(info.link_down)->getLatency();
     }
     if (p_has_limiter){          // limiter for receiver
         info = xbt_dynar_get_as(p_linkUpDownList, dst->getId() * p_nb_links_per_node + p_has_loopback, s_surf_parsing_link_up_down_t);
@@ -86,7 +86,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
   int isrc;
   int table_size = xbt_dynar_length(p_indexNetworkElm);
 
-  RoutingEdgePtr src;
+  RoutingEdge *src;
   xbt_node_t current, previous, backboneNode = NULL, routerNode;
   s_surf_parsing_link_up_down_t info;
 
@@ -104,7 +104,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
   }
 
   for (isrc = 0; isrc < table_size; isrc++) {
-    src = xbt_dynar_get_as(p_indexNetworkElm, isrc, RoutingEdgePtr);
+    src = xbt_dynar_get_as(p_indexNetworkElm, isrc, RoutingEdge*);
 
     if (src->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) {
       previous = new_xbt_graph_node(graph, src->getName(), nodes);
@@ -113,7 +113,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
 
       if (info.link_up) {     // link up
 
-        const char *link_name = static_cast<ResourcePtr>(info.link_up)->getName();
+        const char *link_name = static_cast<Resource*>(info.link_up)->getName();
         current = new_xbt_graph_node(graph, link_name, nodes);
         new_xbt_graph_edge(graph, previous, current, edges);
 
@@ -126,7 +126,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
       }
 
       if (info.link_down) {    // link down
-        const char *link_name = static_cast<ResourcePtr>(info.link_down)->getName();
+        const char *link_name = static_cast<Resource*>(info.link_down)->getName();
         current = new_xbt_graph_node(graph, link_name, nodes);
         new_xbt_graph_edge(graph, previous, current, edges);
 
@@ -156,28 +156,28 @@ void AsCluster::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id,
 
   if (link.policy == SURF_LINK_FULLDUPLEX) {
     char *tmp_link = bprintf("%s_UP", link_id);
-    info.link_up = xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL);
+    info.link_up = sg_link_by_name(tmp_link);
     xbt_free(tmp_link);
     tmp_link = bprintf("%s_DOWN", link_id);
-    info.link_down = xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL);
+    info.link_down = sg_link_by_name(tmp_link);
     xbt_free(tmp_link);
   } else {
-    info.link_up = xbt_lib_get_or_null(link_lib, link_id, SURF_LINK_LEVEL);
+    info.link_up = sg_link_by_name(link_id);
     info.link_down = info.link_up;
   }
   xbt_dynar_set(p_linkUpDownList, position, &info);
   xbt_free(link_id);
 }
 
-int AsCluster::parsePU(RoutingEdgePtr elm) {
+int AsCluster::parsePU(RoutingEdge *elm) {
   XBT_DEBUG("Load process unit \"%s\"", elm->getName());
-  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
   return xbt_dynar_length(p_indexNetworkElm)-1;
 }
 
-int AsCluster::parseAS(RoutingEdgePtr elm) {
+int AsCluster::parseAS(RoutingEdge *elm) {
   XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
-  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
   return xbt_dynar_length(p_indexNetworkElm)-1;
 }
 
index 294fe2b..f87953e 100644 (file)
@@ -14,7 +14,6 @@
  * Classes *
  ***********/
 class AsCluster;
-typedef AsCluster *AsClusterPtr;
 
 
 /* ************************************************** */
@@ -24,24 +23,24 @@ class AsCluster: public AsNone {
 public:
   AsCluster();
 
-  virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+  virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
   //xbt_dynar_t getOneLinkRoutes();
   //void parseRoute(sg_platf_route_cbarg_t route);
   //void parseASroute(sg_platf_route_cbarg_t route);
 
   void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
-  //sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+  //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
 
   /* The parser calls the following functions to inform the routing models
    * that a new element is added to the AS currently built.
    *
    * Of course, only the routing model of this AS is informed, not every ones */
-  int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
-  int parseAS(RoutingEdgePtr elm);
+  int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+  int parseAS(RoutingEdge *elm);
   virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position);
-  NetworkLinkPtr p_backbone;
+  Link* p_backbone;
   void *p_loopback;
-  RoutingEdgePtr p_router;
+  RoutingEdge *p_router;
   int p_has_limiter;
   int p_has_loopback;
   int p_nb_links_per_node;
index 01bee9a..6527e15 100644 (file)
@@ -47,8 +47,8 @@ bool AsClusterFatTree::isInSubTree(FatTreeNode *root, FatTreeNode *node) {
   return true;
 }
 
-void AsClusterFatTree::getRouteAndLatency(RoutingEdgePtr src,
-                                          RoutingEdgePtr dst,
+void AsClusterFatTree::getRouteAndLatency(RoutingEdge *src,
+                                          RoutingEdge *dst,
                                           sg_platf_route_cbarg_t into,
                                           double *latency) {
   FatTreeNode *source, *destination, *currentNode;
@@ -501,9 +501,7 @@ FatTreeNode::FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level,
     linkTemplate.policy = SURF_LINK_SHARED;
     linkTemplate.id = bprintf("limiter_%d", id);
     sg_platf_new_link(&linkTemplate);
-    this->limiterLink = (NetworkLink*) xbt_lib_get_or_null(link_lib,
-                                                           linkTemplate.id,
-                                                           SURF_LINK_LEVEL);
+    this->limiterLink = Link::byName(linkTemplate.id);
     free((void*)linkTemplate.id);
   }
   if(cluster->loopback_bw || cluster->loopback_lat) {
@@ -514,9 +512,7 @@ FatTreeNode::FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level,
     linkTemplate.policy = SURF_LINK_FATPIPE;
     linkTemplate.id = bprintf("loopback_%d", id);
     sg_platf_new_link(&linkTemplate);
-    this->loopback = (NetworkLink*) xbt_lib_get_or_null(link_lib,
-                                                        linkTemplate.id,
-                                                        SURF_LINK_LEVEL);
+    this->loopback = Link::byName(linkTemplate.id);
     free((void*)linkTemplate.id);
   }  
 }
@@ -535,21 +531,18 @@ FatTreeLink::FatTreeLink(sg_platf_cluster_cbarg_t cluster,
   linkTemplate.id = bprintf("link_from_%d_to_%d_%d", downNode->id, upNode->id,
                             uniqueId);
   sg_platf_new_link(&linkTemplate);
-  NetworkLink* link;
+  Link* link;
   std::string tmpID;
   if (cluster->sharing_policy == SURF_LINK_FULLDUPLEX) {
     tmpID = std::string(linkTemplate.id) + "_UP";
-    link = (NetworkLink*) xbt_lib_get_or_null(link_lib, tmpID.c_str(),
-                                              SURF_LINK_LEVEL);
+    link =  Link::byName(tmpID.c_str());
     this->upLink = link; // check link?
     tmpID = std::string(linkTemplate.id) + "_DOWN";
-    link = (NetworkLink*) xbt_lib_get_or_null(link_lib, tmpID.c_str(),
-                                              SURF_LINK_LEVEL);
+    link = Link::byName(tmpID.c_str());
     this->downLink = link; // check link ?
   }
   else {
-    link = (NetworkLink*) xbt_lib_get_or_null(link_lib, linkTemplate.id,
-                                              SURF_LINK_LEVEL);
+    link = Link::byName(linkTemplate.id);
     this->upLink = link;
     this->downLink = link;
   }
index 2f924ad..9435ca9 100644 (file)
@@ -52,11 +52,11 @@ public:
 
   /** Virtual link standing for the node global capacity.
    */
-  NetworkLink* limiterLink;
+  Link* limiterLink;
   /** If present, communications from this node to this node will pass through it
    * instead of passing by an upper level switch.
    */
-  NetworkLink* loopback;
+  Link* loopback;
   FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level,
               int position);
 };
@@ -74,10 +74,10 @@ public:
               FatTreeNode *destination);
   /** Link going up in the tree
    */
-  NetworkLink *upLink; 
+  Link *upLink; 
   /** Link going down in the tree
    */
-  NetworkLink *downLink;
+  Link *downLink;
   /** Upper end of the link
    */
   FatTreeNode *upNode;
@@ -111,7 +111,7 @@ class AsClusterFatTree : public AsCluster {
 public:
   AsClusterFatTree();
   ~AsClusterFatTree();
-  virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst,
+  virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst,
                                   sg_platf_route_cbarg_t into,
                                   double *latency);
 
index 33dc8cc..13369b4 100644 (file)
@@ -70,15 +70,13 @@ void AsClusterTorus::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int
       s_surf_parsing_link_up_down_t info;
       if (link.policy == SURF_LINK_FULLDUPLEX) {
           char *tmp_link = bprintf("%s_UP", link_id);
-          info.link_up =
-              xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL);
+          info.link_up = Link::byName(tmp_link);
           free(tmp_link);
           tmp_link = bprintf("%s_DOWN", link_id);
-          info.link_down =
-              xbt_lib_get_or_null(link_lib, tmp_link, SURF_LINK_LEVEL);
+          info.link_down = Link::byName(tmp_link);
           free(tmp_link);
       } else {
-          info.link_up = xbt_lib_get_or_null(link_lib, link_id, SURF_LINK_LEVEL);
+          info.link_up = Link::byName(link_id);
           info.link_down = info.link_up;
       }
       /**
@@ -120,7 +118,7 @@ void AsClusterTorus::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster){
     xbt_dynar_free(&dimensions);
 }
 
-void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat){
+void AsClusterTorus::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat){
 
   XBT_VERB("torus_get_route_and_latency from '%s'[%d] to '%s'[%d]",
                src->getName(), src->getId(),
@@ -133,7 +131,7 @@ void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst,
        xbt_dynar_push_as(route->link_list, void *, info.link_up);
 
        if (lat)
-         *lat += static_cast<NetworkLinkPtr>(info.link_up)->getLatency();
+         *lat += static_cast<Link*>(info.link_up)->getLatency();
        return;
      }
 
@@ -222,12 +220,12 @@ void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst,
            xbt_dynar_push_as(route->link_list,void*,info.link_down);
 
        if (lat)
-         *lat += static_cast<NetworkLinkPtr>(info.link_down)->getLatency();
+         *lat += static_cast<Link*>(info.link_down)->getLatency();
        }else{
            xbt_dynar_push_as(route->link_list,void*,info.link_up);
 
        if (lat)
-         *lat += static_cast<NetworkLinkPtr>(info.link_up)->getLatency();
+         *lat += static_cast<Link*>(info.link_up)->getLatency();
        }
        current_node = next_node;
        next_node = 0;
index 86e9a20..a9ab794 100644 (file)
 #ifndef SURF_ROUTING_CLUSTER_TORUS_HPP_
 #define SURF_ROUTING_CLUSTER_TORUS_HPP_
 
-class AsClusterTorus;
-typedef AsClusterTorus *AsClusterTorusPtr;
-
-
 class AsClusterTorus: public AsCluster {
 public:
    AsClusterTorus();
    virtual ~AsClusterTorus();
    virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position);
-   virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+   virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
    void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster);
 
 
index 7c1ae30..f6d146d 100644 (file)
@@ -48,7 +48,7 @@ AS_t model_dijkstracache_create(void){
 
 void model_dijkstra_both_end(AS_t as)
 {
-  AsDijkstraPtr THIS_AS = static_cast<AsDijkstraPtr>(as);
+  AsDijkstra *THIS_AS = static_cast<AsDijkstra*>(as);
   xbt_node_t node = NULL;
   unsigned int cursor2;
   xbt_dynar_t nodes = NULL;
@@ -176,23 +176,23 @@ void AsDijkstra::addLoopback() {
 
 xbt_dynar_t AsDijkstra::getOnelinkRoutes()
 {
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
+  xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
   sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
   route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
 
   int src,dst;
-  RoutingEdgePtr src_elm, dst_elm;
+  RoutingEdge *src_elm, *dst_elm;
   int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
   for(src=0; src < table_size; src++) {
     for(dst=0; dst< table_size; dst++) {
       xbt_dynar_reset(route->link_list);
-      src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdgePtr);
-      dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdgePtr);
+      src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdge*);
+      dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdge*);
       this->getRouteAndLatency(src_elm, dst_elm,route, NULL);
 
       if (xbt_dynar_length(route->link_list) == 1) {
         void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
-        OnelinkPtr onelink;
+        Onelink *onelink;
         if (p_hierarchy == SURF_ROUTING_BASE)
           onelink = new Onelink(link, src_elm, dst_elm);
         else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
@@ -206,7 +206,7 @@ xbt_dynar_t AsDijkstra::getOnelinkRoutes()
   return ret;
 }
 
-void AsDijkstra::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat)
+void AsDijkstra::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat)
 {
 
   /* set utils vars */
@@ -256,7 +256,7 @@ void AsDijkstra::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_p
     xbt_dynar_foreach(links, cpt, link) {
       xbt_dynar_unshift(route->link_list, &link);
       if (lat)
-        *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
+        *lat += static_cast<Link*>(link)->getLatency();
     }
 
   }
@@ -330,8 +330,8 @@ void AsDijkstra::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_p
   }
 
   /* compose route path with links */
-  RoutingEdgePtr gw_src = NULL, gw_dst, prev_gw_src, first_gw = NULL;
-  RoutingEdgePtr gw_dst_net_elm = NULL, prev_gw_src_net_elm = NULL;
+  RoutingEdge *gw_src = NULL, *gw_dst, *prev_gw_src, *first_gw = NULL;
+  RoutingEdge *gw_dst_net_elm = NULL, *prev_gw_src_net_elm = NULL;
 
   for (v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
     xbt_node_t node_pred_v =
@@ -364,7 +364,7 @@ void AsDijkstra::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_p
       xbt_dynar_foreach(links, cpt, link) {
         xbt_dynar_insert_at(route->link_list, pos, &link);
         if (lat)
-          *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
+          *lat += static_cast<Link*>(link)->getLatency();
         pos++;
       }
     }
@@ -373,7 +373,7 @@ void AsDijkstra::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_p
     xbt_dynar_foreach(links, cpt, link) {
       xbt_dynar_unshift(route->link_list, &link);
       if (lat)
-        *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
+        *lat += static_cast<Link*>(link)->getLatency();
     }
     size++;
   }
@@ -480,7 +480,7 @@ void AsDijkstra::parseRoute(sg_platf_route_cbarg_t route)
       surf_parse_error("The gw_src '%s' does not exist!",route->gw_src->getName());
   }
 
-  RoutingEdgePtr src_net_elm, dst_net_elm;
+  RoutingEdge *src_net_elm, *dst_net_elm;
 
   src_net_elm = sg_routing_edge_by_name_or_null(src);
   dst_net_elm = sg_routing_edge_by_name_or_null(dst);
@@ -521,7 +521,7 @@ void AsDijkstra::parseRoute(sg_platf_route_cbarg_t route)
       THROWF(arg_error,0,"(AS)Route from '%s' to '%s' already exists",src,dst);
 
     if (route->gw_dst && route->gw_src) {
-      RoutingEdgePtr gw_tmp;
+      RoutingEdge *gw_tmp;
       gw_tmp = route->gw_src;
       route->gw_src = route->gw_dst;
       route->gw_dst = gw_tmp;
index 033e4f9..2814383 100644 (file)
@@ -27,7 +27,6 @@ typedef struct route_cache_element {
  * Classes *
  ***********/
 class AsDijkstra;
-typedef AsDijkstra *AsDijkstraPtr;
 
 class AsDijkstra : public AsGeneric {
 public:
@@ -50,7 +49,7 @@ public:
      * will have a loopback attached to it.
      */
        void addLoopback();
-       void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat);
+       void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat);
        xbt_dynar_t getOnelinkRoutes();
        void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat);
        void parseASroute(sg_platf_route_cbarg_t route);
index e87df4f..adc6a53 100644 (file)
@@ -20,7 +20,7 @@ AS_t model_floyd_create(void)
 
 void model_floyd_end(AS_t current_routing)
 {
-  static_cast<AsFloydPtr>(current_routing)->end();
+  static_cast<AsFloyd*>(current_routing)->end();
 }
 
 AsFloyd::AsFloyd(): AsGeneric() {
@@ -51,7 +51,7 @@ AsFloyd::~AsFloyd(){
 /* Business methods */
 xbt_dynar_t AsFloyd::getOneLinkRoutes()
 {
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
+  xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
   sg_platf_route_cbarg_t route =   xbt_new0(s_sg_platf_route_cbarg_t, 1);
   route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
 
@@ -61,13 +61,13 @@ xbt_dynar_t AsFloyd::getOneLinkRoutes()
   for(src=0; src < table_size; src++) {
     for(dst=0; dst< table_size; dst++) {
       xbt_dynar_reset(route->link_list);
-      src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdgePtr);
-      dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdgePtr);
+      src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdge*);
+      dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdge*);
       this->getRouteAndLatency(src_elm, dst_elm, route, NULL);
 
       if (xbt_dynar_length(route->link_list) == 1) {
         void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
-        OnelinkPtr onelink;
+        Onelink *onelink;
         if (p_hierarchy == SURF_ROUTING_BASE)
           onelink = new Onelink(link, src_elm, dst_elm);
         else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
@@ -82,7 +82,7 @@ xbt_dynar_t AsFloyd::getOneLinkRoutes()
   return ret;
 }
 
-void AsFloyd::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t res, double *lat)
+void AsFloyd::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t res, double *lat)
 {
 
   /* set utils vars */
@@ -124,7 +124,7 @@ void AsFloyd::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_plat
     xbt_dynar_foreach(links, cpt, link) {
       xbt_dynar_push_as(res->link_list, sg_routing_link_t, link);
       if (lat)
-        *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
+        *lat += static_cast<Link*>(link)->getLatency();
     }
 
     prev_dst_gw = e_route->gw_dst;
@@ -149,7 +149,7 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route)
 
   /* set the size of table routing */
   int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
-  RoutingEdgePtr src_net_elm, dst_net_elm;
+  RoutingEdge *src_net_elm, *dst_net_elm;
 
   src_net_elm = sg_routing_edge_by_name_or_null(src);
   dst_net_elm = sg_routing_edge_by_name_or_null(dst);
@@ -193,7 +193,7 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route)
     xbt_dynar_t link_route_to_test = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
     xbt_dynar_foreach(route->link_list,cpt,link_name)
     {
-      void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
+      void *link = Link::byName(link_name);
       xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
       xbt_dynar_push(link_route_to_test,&link);
     }
@@ -229,7 +229,7 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route)
       for(i=xbt_dynar_length(route->link_list) ;i>0 ;i--)
       {
         link_name = xbt_dynar_get_as(route->link_list,i-1,char *);
-        void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
+        void *link = Link::byName(link_name);
         xbt_assert(link,"Link : '%s' doesn't exists.",link_name);
         xbt_dynar_push(link_route_to_test,&link);
       }
index 57fca5e..e307d47 100644 (file)
  * Classes *
  ***********/
 class AsFloyd;
-typedef AsFloyd *AsFloydPtr;
 
 class AsFloyd: public AsGeneric {
 public:
   AsFloyd();
   ~AsFloyd();
 
-  void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+  void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
   xbt_dynar_t getOneLinkRoutes();
   void parseASroute(sg_platf_route_cbarg_t route);
   void parseRoute(sg_platf_route_cbarg_t route);
@@ -29,14 +28,14 @@ public:
   //void parseASroute(sg_platf_route_cbarg_t route);
 
   //void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
-  //sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+  //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
 
   /* The parser calls the following functions to inform the routing models
    * that a new element is added to the AS currently built.
    *
    * Of course, only the routing model of this AS is informed, not every ones */
-  //int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
-  //int parseAS(RoutingEdgePtr elm);
+  //int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+  //int parseAS(RoutingEdge *elm);
 
   //virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
 
index 4c74df4..c7ef49a 100644 (file)
@@ -11,7 +11,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_full, surf, "Routing part of surf");
 
 /* Global vars */
 extern routing_platf_t routing_platf;
-extern int surf_parse_lineno;
 
 #define TO_ROUTE_FULL(i,j) p_routingTable[(i)+(j)*table_size]
 
@@ -26,7 +25,7 @@ void model_full_end(AS_t _routing)
   sg_platf_route_cbarg_t e_route;
 
   /* set utils vars */
-  AsFullPtr routing = ((AsFullPtr) _routing);
+  AsFull *routing = static_cast<AsFull*>(_routing);
   int table_size = (int)xbt_dynar_length(routing->p_indexNetworkElm);
 
   /* Create table if necessary */
@@ -71,7 +70,7 @@ AsFull::~AsFull(){
 
 xbt_dynar_t AsFull::getOneLinkRoutes()
 {
-  xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
+  xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
 
   int src, dst;
   int table_size = xbt_dynar_length(p_indexNetworkElm);
@@ -82,11 +81,11 @@ xbt_dynar_t AsFull::getOneLinkRoutes()
       if (route) {
         if (xbt_dynar_length(route->link_list) == 1) {
           void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
-          OnelinkPtr onelink;
+          Onelink *onelink;
           if (p_hierarchy == SURF_ROUTING_BASE) {
-               RoutingEdgePtr tmp_src = xbt_dynar_get_as(p_indexNetworkElm, src, sg_routing_edge_t);
+               RoutingEdge *tmp_src = xbt_dynar_get_as(p_indexNetworkElm, src, sg_routing_edge_t);
             tmp_src->setId(src);
-               RoutingEdgePtr tmp_dst = xbt_dynar_get_as(p_indexNetworkElm, dst, sg_routing_edge_t);
+               RoutingEdge *tmp_dst = xbt_dynar_get_as(p_indexNetworkElm, dst, sg_routing_edge_t);
                tmp_dst->setId(dst);
             onelink = new Onelink(link, tmp_src, tmp_dst);
           } else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
@@ -104,7 +103,7 @@ xbt_dynar_t AsFull::getOneLinkRoutes()
   return ret;
 }
 
-void AsFull::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t res, double *lat)
+void AsFull::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t res, double *lat)
 {
   XBT_DEBUG("full_get_route_and_latency from %s[%d] to %s[%d]",
       src->getName(),
@@ -127,7 +126,7 @@ void AsFull::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf
     xbt_dynar_foreach(e_route->link_list, cpt, link) {
       xbt_dynar_push(res->link_list, &link);
       if (lat)
-        *lat += static_cast<NetworkLinkPtr>(link)->getLatency();
+        *lat += static_cast<Link*>(link)->getLatency();
     }
   }
 }
@@ -146,7 +145,7 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route)
   int as_route = 0;
   char *src = (char*)(route->src);
   char *dst = (char*)(route->dst);
-  RoutingEdgePtr src_net_elm, dst_net_elm;
+  RoutingEdge *src_net_elm, *dst_net_elm;
   src_net_elm = sg_routing_edge_by_name_or_null(src);
   dst_net_elm = sg_routing_edge_by_name_or_null(dst);
 
@@ -168,7 +167,7 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route)
     xbt_dynar_t link_route_to_test =
         xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
     xbt_dynar_foreach(route->link_list, i, link_name) {
-      void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
+      void *link = Link::byName(link_name);
       xbt_assert(link, "Link : '%s' doesn't exists.", link_name);
       xbt_dynar_push(link_route_to_test, &link);
     }
@@ -246,7 +245,7 @@ void AsFull::parseRoute(sg_platf_route_cbarg_t route)
           xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
       for (i = xbt_dynar_length(route->link_list); i > 0; i--) {
         link_name = xbt_dynar_get_as(route->link_list, i - 1, char *);
-        void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
+        void *link = Link::byName(link_name);
         xbt_assert(link, "Link : '%s' doesn't exists.", link_name);
         xbt_dynar_push(link_route_to_test, &link);
       }
index de3d0de..bd0c712 100644 (file)
@@ -13,7 +13,6 @@
  * Classes *
  ***********/
 class AsFull;
-typedef AsFull *AsFullPtr;
 
 class AsFull: public AsGeneric {
 public:
@@ -22,20 +21,20 @@ public:
   AsFull();
   ~AsFull();
 
-  void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+  void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
   xbt_dynar_t getOneLinkRoutes();
   void parseRoute(sg_platf_route_cbarg_t route);
   void parseASroute(sg_platf_route_cbarg_t route);
 
   //void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
-  //sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+  //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
 
   /* The parser calls the following functions to inform the routing models
    * that a new element is added to the AS currently built.
    *
    * Of course, only the routing model of this AS is informed, not every ones */
-  //virtual int parsePU(RoutingEdgePtr elm)=0; /* A host or a router, whatever */
-  //virtual int parseAS( RoutingEdgePtr elm)=0;
+  //virtual int parsePU(RoutingEdge *elm)=0; /* A host or a router, whatever */
+  //virtual int parseAS( RoutingEdge *elm)=0;
 
   //virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
 };
index c67abb4..d80e89c 100644 (file)
@@ -30,7 +30,7 @@ void AsGeneric::parseASroute(sg_platf_route_cbarg_t /*route*/){
   THROW_IMPOSSIBLE;
 }
 
-void AsGeneric::getRouteAndLatency(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, sg_platf_route_cbarg_t /*into*/, double */*latency*/){
+void AsGeneric::getRouteAndLatency(RoutingEdge */*src*/, RoutingEdge */*dst*/, sg_platf_route_cbarg_t /*into*/, double */*latency*/){
   THROW_IMPOSSIBLE;
 }
 
@@ -42,17 +42,17 @@ AsGeneric::~AsGeneric() {
   xbt_dict_free(&p_bypassRoutes);
 }
 
-int AsGeneric::parsePU(RoutingEdgePtr elm)
+int AsGeneric::parsePU(RoutingEdge *elm)
 {
   XBT_DEBUG("Load process unit \"%s\"", elm->getName());
-  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
   return xbt_dynar_length(p_indexNetworkElm)-1;
 }
 
-int AsGeneric::parseAS(RoutingEdgePtr elm)
+int AsGeneric::parseAS(RoutingEdge *elm)
 {
   XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
-  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
   return xbt_dynar_length(p_indexNetworkElm)-1;
 }
 
@@ -149,13 +149,13 @@ void AsGeneric::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
 
 
   for (src = 0; src < table_size; src++) {
-    RoutingEdgePtr my_src =
-        xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdgePtr);
+    RoutingEdge *my_src =
+        xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdge*);
     for (dst = 0; dst < table_size; dst++) {
       if (src == dst)
         continue;
-      RoutingEdgePtr my_dst =
-          xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdgePtr);
+      RoutingEdge *my_dst =
+          xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdge*);
 
       sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
       route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
@@ -179,7 +179,7 @@ void AsGeneric::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
       }
 
       xbt_dynar_foreach(route->link_list, cpt, link) {
-        const char *link_name = ((ResourcePtr) link)->getName();
+        const char *link_name = static_cast<Resource*>(link)->getName();
         current = new_xbt_graph_node(graph, link_name, nodes);
         current_name = link_name;
         new_xbt_graph_edge(graph, previous, current, edges);
@@ -204,8 +204,8 @@ void AsGeneric::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)
   }
 }
 
-sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdgePtr src,
-                                               RoutingEdgePtr dst,
+sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdge *src,
+                                               RoutingEdge *dst,
                                                double *lat)
 {
   // If never set a bypass route return NULL without any further computations
@@ -224,13 +224,13 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdgePtr src,
     free(route_name);
   }
   else{
-    AsPtr src_as, dst_as;
+    As *src_as, *dst_as;
     int index_src, index_dst;
     xbt_dynar_t path_src = NULL;
     xbt_dynar_t path_dst = NULL;
-    AsPtr current = NULL;
-    AsPtr *current_src = NULL;
-    AsPtr *current_dst = NULL;
+    As *current = NULL;
+    As **current_src = NULL;
+    As **current_dst = NULL;
 
     if (src == NULL || dst == NULL)
       xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
@@ -241,13 +241,13 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdgePtr src,
     dst_as = dst->getRcComponent();
 
     /* (2) find the path to the root routing component */
-    path_src = xbt_dynar_new(sizeof(AsPtr), NULL);
+    path_src = xbt_dynar_new(sizeof(As*), NULL);
     current = src_as;
     while (current != NULL) {
       xbt_dynar_push(path_src, &current);
       current = current->p_routingFather;
     }
-    path_dst = xbt_dynar_new(sizeof(AsPtr), NULL);
+    path_dst = xbt_dynar_new(sizeof(As*), NULL);
     current = dst_as;
     while (current != NULL) {
       xbt_dynar_push(path_dst, &current);
@@ -257,15 +257,15 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdgePtr src,
     /* (3) find the common father */
     index_src = path_src->used - 1;
     index_dst = path_dst->used - 1;
-    current_src = (AsPtr *) xbt_dynar_get_ptr(path_src, index_src);
-    current_dst = (AsPtr *) xbt_dynar_get_ptr(path_dst, index_dst);
+    current_src = (As **) xbt_dynar_get_ptr(path_src, index_src);
+    current_dst = (As **) xbt_dynar_get_ptr(path_dst, index_dst);
     while (index_src >= 0 && index_dst >= 0 && *current_src == *current_dst) {
       xbt_dynar_pop_ptr(path_src);
       xbt_dynar_pop_ptr(path_dst);
       index_src--;
       index_dst--;
-      current_src = (AsPtr *) xbt_dynar_get_ptr(path_src, index_src);
-      current_dst = (AsPtr *) xbt_dynar_get_ptr(path_dst, index_dst);
+      current_src = (As **) xbt_dynar_get_ptr(path_src, index_src);
+      current_dst = (As **) xbt_dynar_get_ptr(path_dst, index_dst);
     }
 
     int max_index_src = path_src->used - 1;
@@ -278,9 +278,9 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdgePtr src,
       for (i = 0; i < max; i++) {
         if (i <= max_index_src && max <= max_index_dst) {
           char *route_name = bprintf("%s#%s",
-              (*(AsPtr *)
+              (*(As **)
                   (xbt_dynar_get_ptr(path_src, i)))->p_name,
-                  (*(AsPtr *)
+                  (*(As **)
                       (xbt_dynar_get_ptr(path_dst, max)))->p_name);
           e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
           xbt_free(route_name);
@@ -289,9 +289,9 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdgePtr src,
           break;
         if (max <= max_index_src && i <= max_index_dst) {
           char *route_name = bprintf("%s#%s",
-              (*(AsPtr *)
+              (*(As **)
                   (xbt_dynar_get_ptr(path_src, max)))->p_name,
-                  (*(AsPtr *)
+                  (*(As **)
                       (xbt_dynar_get_ptr(path_dst, i)))->p_name);
           e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
           xbt_free(route_name);
@@ -305,9 +305,9 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdgePtr src,
 
       if (max <= max_index_src && max <= max_index_dst) {
         char *route_name = bprintf("%s#%s",
-            (*(AsPtr *)
+            (*(As **)
                 (xbt_dynar_get_ptr(path_src, max)))->p_name,
-                (*(AsPtr *)
+                (*(As **)
                     (xbt_dynar_get_ptr(path_dst, max)))->p_name);
         e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
         xbt_free(route_name);
@@ -322,7 +322,7 @@ sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdgePtr src,
 
   sg_platf_route_cbarg_t new_e_route = NULL;
   if (e_route_bypass) {
-    NetworkLinkPtr link;
+         Link* link;
     unsigned int cpt = 0;
     new_e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
     new_e_route->gw_src = e_route_bypass->gw_src;
@@ -361,21 +361,21 @@ sg_platf_route_cbarg_t AsGeneric::newExtendedRoute(e_surf_routing_hierarchy_t hi
     xbt_assert(routearg->gw_src && routearg->gw_dst,
         "NULL is obviously a bad gateway");
 
-    /* remeber not erase the gateway names */
+    /* remember not erase the gateway names */
     result->gw_src = routearg->gw_src;
     result->gw_dst = routearg->gw_dst;
   }
 
   xbt_dynar_foreach(routearg->link_list, cpt, link_name) {
 
-    void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL);
+    Link *link = Link::byName(link_name);
     if (link) {
       if (change_order)
         xbt_dynar_push(result->link_list, &link);
       else
         xbt_dynar_unshift(result->link_list, &link);
     } else
-      THROWF(mismatch_error, 0, "Link %s not found", link_name);
+      THROWF(mismatch_error, 0, "Link '%s' not found", link_name);
   }
 
   return result;
@@ -383,13 +383,13 @@ sg_platf_route_cbarg_t AsGeneric::newExtendedRoute(e_surf_routing_hierarchy_t hi
 
 
 
-AsPtr AsGeneric::asExist(AsPtr to_find)
+As *AsGeneric::asExist(As *to_find)
 {
   //return to_find; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
   xbt_dict_cursor_t cursor = NULL;
   char *key;
   int found = 0;
-  AsGenericPtr elem;
+  AsGeneric *elem;
   xbt_dict_foreach(p_routingSons, cursor, key, elem) {
     if (to_find == elem || elem->asExist(to_find)) {
       found = 1;
@@ -401,16 +401,16 @@ AsPtr AsGeneric::asExist(AsPtr to_find)
   return NULL;
 }
 
-AsPtr AsGeneric::autonomousSystemExist(char *element)
+As *AsGeneric::autonomousSystemExist(char *element)
 {
   //return rc; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
-  AsPtr element_as, result, elem;
+  As *element_as, *result, *elem;
   xbt_dict_cursor_t cursor = NULL;
   char *key;
-  element_as = ((RoutingEdgePtr)
+  element_as = ((RoutingEdge*)
       xbt_lib_get_or_null(as_router_lib, element,
           ROUTING_ASR_LEVEL))->getRcComponent();
-  result = ((AsPtr) - 1);
+  result = ((As*) - 1);
   if (element_as != this)
     result = asExist(element_as);
 
@@ -427,18 +427,15 @@ AsPtr AsGeneric::autonomousSystemExist(char *element)
   return NULL;
 }
 
-AsPtr AsGeneric::processingUnitsExist(char *element)
+As *AsGeneric::processingUnitsExist(char *element)
 {
-  AsPtr element_as;
-  element_as = ((RoutingEdgePtr)
-      xbt_lib_get_or_null(host_lib,
-          element, ROUTING_HOST_LEVEL))->getRcComponent();
+  As *element_as = sg_host_edge(sg_host_by_name(element)) ->getRcComponent();
   if (element_as == this)
     return element_as;
   return asExist(element_as);
 }
 
-void AsGeneric::srcDstCheck(RoutingEdgePtr src, RoutingEdgePtr dst)
+void AsGeneric::srcDstCheck(RoutingEdge *src, RoutingEdge *dst)
 {
   if (src == NULL || dst == NULL)
     xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
@@ -446,8 +443,8 @@ void AsGeneric::srcDstCheck(RoutingEdgePtr src, RoutingEdgePtr dst)
             dst ? dst->getName() : "(null)",
             p_name);
 
-  AsPtr src_as = src->getRcComponent();
-  AsPtr dst_as = dst->getRcComponent();
+  As *src_as = src->getRcComponent();
+  As *dst_as = dst->getRcComponent();
 
   if (src_as != dst_as)
     xbt_die("The src(%s in %s) and dst(%s in %s) are in differents AS",
index 53928b1..fd386a6 100644 (file)
@@ -10,7 +10,6 @@
 #define SURF_ROUTING_GENERIC_HPP_
 
 class AsGeneric;
-typedef AsGeneric *AsGenericPtr;
 
 void generic_free_route(sg_platf_route_cbarg_t route);
 
@@ -19,26 +18,26 @@ public:
   AsGeneric();
   ~AsGeneric();
 
-  virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+  virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
   virtual xbt_dynar_t getOneLinkRoutes();
   virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
-  virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+  virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
 
   /* The parser calls the following functions to inform the routing models
    * that a new element is added to the AS currently built.
    *
    * Of course, only the routing model of this AS is informed, not every ones */
-  virtual int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
-  virtual int parseAS( RoutingEdgePtr elm);
+  virtual int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+  virtual int parseAS(RoutingEdge *elm);
   virtual void parseRoute(sg_platf_route_cbarg_t route);
   virtual void parseASroute(sg_platf_route_cbarg_t route);
   virtual void parseBypassroute(sg_platf_route_cbarg_t e_route);
 
   virtual sg_platf_route_cbarg_t newExtendedRoute(e_surf_routing_hierarchy_t hierarchy, sg_platf_route_cbarg_t routearg, int change_order);
-  virtual AsPtr asExist(AsPtr to_find);
-  virtual AsPtr autonomousSystemExist(char *element);
-  virtual AsPtr processingUnitsExist(char *element);
-  virtual void srcDstCheck(RoutingEdgePtr src, RoutingEdgePtr dst);
+  virtual As *asExist(As *to_find);
+  virtual As *autonomousSystemExist(char *element);
+  virtual As *processingUnitsExist(char *element);
+  virtual void srcDstCheck(RoutingEdge *src, RoutingEdge *dst);
 };
 
 #endif /* SURF_ROUTING_GENERIC_HPP_ */
index 1ea0e4a..a1a97e8 100644 (file)
@@ -17,7 +17,7 @@ xbt_dynar_t AsNone::getOneLinkRoutes() {
   return NULL;
 }
 
-void AsNone::getRouteAndLatency(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/,
+void AsNone::getRouteAndLatency(RoutingEdge */*src*/, RoutingEdge */*dst*/,
                                 sg_platf_route_cbarg_t /*res*/, double *lat)
 {
   *lat = 0.0;
@@ -28,20 +28,20 @@ void AsNone::getGraph(xbt_graph_t /*graph*/, xbt_dict_t /*nodes*/, xbt_dict_t /*
        XBT_INFO("No routing no graph");
 }
 
-sg_platf_route_cbarg_t AsNone::getBypassRoute(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, double */*lat*/) {
+sg_platf_route_cbarg_t AsNone::getBypassRoute(RoutingEdge */*src*/, RoutingEdge */*dst*/, double */*lat*/) {
   return NULL;
 }
 
-int AsNone::parsePU(RoutingEdgePtr elm) {
+int AsNone::parsePU(RoutingEdge *elm) {
   XBT_DEBUG("Load process unit \"%s\"", elm->getName());
-  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
   /* don't care about PUs */
   return -1;
 }
 
-int AsNone::parseAS(RoutingEdgePtr elm) {
+int AsNone::parseAS(RoutingEdge *elm) {
   XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
-  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+  xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
   /* even don't care about sub-ASes -- I'm as nihilist as an old punk*/
   return -1;
 }
index 042161e..8fab504 100644 (file)
@@ -14,17 +14,17 @@ public:
   AsNone();
   ~AsNone();
 
-  void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+  void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
   xbt_dynar_t getOneLinkRoutes();
   void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
-  sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+  sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
 
   /* The parser calls the following functions to inform the routing models
    * that a new element is added to the AS currently built.
    *
    * Of course, only the routing model of this AS is informed, not every ones */
-  int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
-  int parseAS( RoutingEdgePtr elm);
+  int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+  int parseAS( RoutingEdge *elm);
   void parseRoute(sg_platf_route_cbarg_t route);
   void parseASroute(sg_platf_route_cbarg_t route);
   void parseBypassroute(sg_platf_route_cbarg_t e_route);
index 4dbfad4..99479c6 100644 (file)
@@ -66,9 +66,9 @@ void model_floyd_parse_route(AS_t rc, sg_platf_route_cbarg_t route);
 /* ************************************************** */
 /* **************  Cluster ROUTING   **************** */
 
-AsPtr model_cluster_create(void);      /* create structures for cluster routing model */
-AsPtr model_torus_cluster_create(void); 
-AsPtr model_fat_tree_cluster_create(void);
+As *model_cluster_create(void);      /* create structures for cluster routing model */
+As *model_torus_cluster_create(void);
+As *model_fat_tree_cluster_create(void);
 
 /* ************************************************** */
 /* **************  Vivaldi ROUTING   **************** */
index efabf71..2865fa0 100644 (file)
@@ -23,7 +23,7 @@ AS_t model_vivaldi_create(void)
   return new AsVivaldi();
 }
 
-void AsVivaldi::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat)
+void AsVivaldi::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat)
 {
   s_surf_parsing_link_up_down_t info;
 
@@ -51,7 +51,7 @@ void AsVivaldi::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_pl
       if(info.link_up) { // link up
         xbt_dynar_push_as(route->link_list, void*, info.link_up);
         if (lat)
-          *lat += static_cast<NetworkLinkPtr>(info.link_up)->getLatency();
+          *lat += static_cast<Link*>(info.link_up)->getLatency();
       }
     }
     src_ctn = (xbt_dynar_t) xbt_lib_get_or_null(host_lib, tmp_src_name, COORD_HOST_LEVEL);
@@ -73,7 +73,7 @@ void AsVivaldi::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_pl
       if(info.link_down) { // link down
         xbt_dynar_push_as(route->link_list,void*,info.link_down);
         if (lat)
-          *lat += static_cast<NetworkLinkPtr>(info.link_down)->getLatency();
+          *lat += static_cast<Link*>(info.link_down)->getLatency();
       }
     }
     dst_ctn = (xbt_dynar_t) xbt_lib_get_or_null(host_lib, tmp_dst_name, COORD_HOST_LEVEL);
@@ -101,7 +101,7 @@ void AsVivaldi::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_pl
   }
 }
 
-int AsVivaldi::parsePU(RoutingEdgePtr elm) {
+int AsVivaldi::parsePU(RoutingEdge *elm) {
   XBT_DEBUG("Load process unit \"%s\"", elm->getName());
   xbt_dynar_push_as(p_indexNetworkElm, sg_routing_edge_t, elm);
   return xbt_dynar_length(p_indexNetworkElm)-1;
index ee0ab65..a85bb93 100644 (file)
@@ -20,7 +20,6 @@ AS_t model_vivaldi_create(void);      /* create structures for vivaldi routing m
  * Classes *
  ***********/
 class AsVivaldi;
-typedef AsVivaldi *AsVivaldiPtr;
 
 class AsVivaldi: public AsGeneric {
 public:
@@ -29,16 +28,16 @@ public:
   AsVivaldi() : AsGeneric() {};
   ~AsVivaldi() {};
 
-  void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+  void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
   //void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
-  //sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+  //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
 
   /* The parser calls the following functions to inform the routing models
    * that a new element is added to the AS currently built.
    *
    * Of course, only the routing model of this AS is informed, not every ones */
-  int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
-  //virtual int parseAS( RoutingEdgePtr elm)=0;
+  int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+  //virtual int parseAS( RoutingEdge *elm)=0;
 
   //virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
 };
index c1add14..e10788b 100644 (file)
@@ -702,7 +702,7 @@ void ETag_surfxml_backbone(void){
   link.policy = SURF_LINK_SHARED;
 
   sg_platf_new_link(&link);
-  routing_cluster_add_backbone(xbt_lib_get_or_null(link_lib, A_surfxml_backbone_id, SURF_LINK_LEVEL));
+  routing_cluster_add_backbone(sg_link_by_name(A_surfxml_backbone_id));
 }
 
 void STag_surfxml_route(void){
index d567fc5..918df46 100644 (file)
@@ -12,7 +12,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_vm);
 void surf_vm_model_init_HL13(void){
   if (surf_cpu_model_vm) {
     surf_vm_model = new VMHL13Model();
-    ModelPtr model = surf_vm_model;
+    Model *model = surf_vm_model;
 
     xbt_dynar_push(model_list, &model);
     xbt_dynar_push(model_list_invoke, &model);
@@ -23,24 +23,16 @@ void surf_vm_model_init_HL13(void){
  * Model *
  *********/
 
-VMHL13Model::VMHL13Model() : VMModel() {
-  p_cpuModel = surf_cpu_model_vm;
-}
-
-void VMHL13Model::updateActionsState(double /*now*/, double /*delta*/){
-  return;
-}
+VMHL13Model::VMHL13Model() : VMModel() {}
 
-ActionPtr VMHL13Model::communicate(HostPtr src, HostPtr dst, double size, double rate){
-  return surf_network_model->communicate(src->p_netElm, dst->p_netElm, size, rate);
-}
+void VMHL13Model::updateActionsState(double /*now*/, double /*delta*/) {}
 
 /* ind means ''indirect'' that this is a reference on the whole dict_elm
  * structure (i.e not on the surf_resource_private infos) */
 
-VMPtr VMHL13Model::createVM(const char *name, surf_resource_t host_PM)
+VM *VMHL13Model::createVM(const char *name, surf_resource_t host_PM)
 {
-  VMHL13Ptr ws = new VMHL13(this, name, NULL, host_PM);
+  VMHL13 *ws = new VMHL13(this, name, NULL, host_PM);
 
   xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, ws);
 
@@ -50,7 +42,7 @@ VMPtr VMHL13Model::createVM(const char *name, surf_resource_t host_PM)
   return ws;
 }
 
-static inline double get_solved_value(CpuActionPtr cpu_action)
+static inline double get_solved_value(CpuAction *cpu_action)
 {
   return cpu_action->getVariable()->value;
 }
@@ -70,8 +62,8 @@ double VMHL13Model::shareResources(double now)
   /* 0. Make sure that we already calculated the resource share at the physical
    * machine layer. */
   {
-    _XBT_GNUC_UNUSED ModelPtr ws_model = surf_host_model;
-    _XBT_GNUC_UNUSED ModelPtr vm_ws_model = surf_vm_model;
+    _XBT_GNUC_UNUSED Model *ws_model = surf_host_model;
+    _XBT_GNUC_UNUSED Model *vm_ws_model = surf_vm_model;
     _XBT_GNUC_UNUSED unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &ws_model);
     _XBT_GNUC_UNUSED unsigned int index_of_vm_ws_model = xbt_dynar_search(model_list_invoke, &vm_ws_model);
     xbt_assert((index_of_pm_ws_model < index_of_vm_ws_model), "Cannot assume surf_host_model comes before");
@@ -111,8 +103,8 @@ double VMHL13Model::shareResources(double now)
          VMModel::ws_vms.begin();
        iter !=  VMModel::ws_vms.end(); ++iter) {
 
-    VMPtr ws_vm = &*iter;
-    CpuPtr cpu = ws_vm->p_cpu;
+    VM *ws_vm = &*iter;
+    Cpu *cpu = ws_vm->p_cpu;
     xbt_assert(cpu, "cpu-less host");
 
     double solved_value = get_solved_value(ws_vm->p_action);
@@ -130,16 +122,15 @@ double VMHL13Model::shareResources(double now)
   /* 2. Calculate resource share at the virtual machine layer. */
   adjustWeightOfDummyCpuActions();
 
-  double min_by_cpu = p_cpuModel->shareResources(now);
-  double min_by_net = (strcmp(surf_network_model->getName(), "network NS3")) ? surf_network_model->shareResources(now) : -1;
+  double min_by_cpu = surf_cpu_model_vm->shareResources(now);
+  double min_by_net = surf_network_model->shareResourcesIsIdempotent() ? surf_network_model->shareResources(now) : -1;
+  // Fixme: take storage into account once it's implemented
   double min_by_sto = -1;
-  if (p_cpuModel == surf_cpu_model_pm)
-       min_by_sto = surf_storage_model->shareResources(now);
 
   XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
-      this, surf_cpu_model_pm->getName(), min_by_cpu,
-            surf_network_model->getName(), min_by_net,
-            surf_storage_model->getName(), min_by_sto);
+      this, typeid(surf_cpu_model_pm ).name(), min_by_cpu,
+               typeid(surf_network_model).name(), min_by_net,
+            typeid(surf_storage_model).name(), min_by_sto);
 
   double ret = max(max(min_by_cpu, min_by_net), min_by_sto);
   if (min_by_cpu >= 0.0 && min_by_cpu < ret)
@@ -158,7 +149,7 @@ double VMHL13Model::shareResources(double now)
 
     {
 #if 0
-      VM2013Ptr ws_vm2013 = static_cast<VM2013Ptr>(&*iter);
+      VM2013 *ws_vm2013 = static_cast<VM2013Ptr>(&*iter);
       XBT_INFO("cost %f remains %f start %f finish %f", ws_vm2013->cpu_action->cost,
           ws_vm2013->cpu_action->remains,
           ws_vm2013->cpu_action->start,
@@ -181,18 +172,18 @@ double VMHL13Model::shareResources(double now)
   return ret;
 }
 
-ActionPtr VMHL13Model::executeParallelTask(int host_nb,
-                                        void **host_list,
-                                        double *flops_amount,
-                                        double *bytes_amount,
-                                        double rate){
+Action *VMHL13Model::executeParallelTask(int host_nb,
+                                         sg_host_t *host_list,
+                                                                                double *flops_amount,
+                                                                                double *bytes_amount,
+                                                                                double rate){
 #define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
   if ((host_nb == 1)
       && (cost_or_zero(bytes_amount, 0) == 0.0))
-    return ((HostCLM03Ptr)host_list[0])->execute(flops_amount[0]);
+    return surf_host_execute(host_list[0], flops_amount[0]);
   else if ((host_nb == 1)
            && (cost_or_zero(flops_amount, 0) == 0.0))
-    return communicate((HostCLM03Ptr)host_list[0], (HostCLM03Ptr)host_list[0],bytes_amount[0], rate);
+    return surf_network_model_communicate(surf_network_model, host_list[0], host_list[0],bytes_amount[0], rate);
   else if ((host_nb == 2)
              && (cost_or_zero(flops_amount, 0) == 0.0)
              && (cost_or_zero(flops_amount, 1) == 0.0)) {
@@ -206,11 +197,11 @@ ActionPtr VMHL13Model::executeParallelTask(int host_nb,
       }
     }
     if (nb == 1)
-      return communicate((HostCLM03Ptr)host_list[0], (HostCLM03Ptr)host_list[1],value, rate);
+      return surf_network_model_communicate(surf_network_model, host_list[0], host_list[1], value, rate);
   }
 #undef cost_or_zero
 
-  THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
+  THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks for more than 2 hosts. */
   return NULL;
 }
 
@@ -218,11 +209,11 @@ ActionPtr VMHL13Model::executeParallelTask(int host_nb,
  * Resource *
  ************/
 
-VMHL13::VMHL13(VMModelPtr model, const char* name, xbt_dict_t props,
+VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props,
                                                   surf_resource_t host_PM)
  : VM(model, name, props, NULL, NULL)
 {
-  HostPtr sub_ws = static_cast<HostPtr>(surf_host_resource_priv(host_PM));
+  Host *sub_ws = static_cast<Host*>(surf_host_resource_priv(host_PM));
 
   /* Currently, we assume a VM has no storage. */
   p_storage = NULL;
@@ -233,18 +224,16 @@ VMHL13::VMHL13(VMModelPtr model, const char* name, xbt_dict_t props,
    * from the VM name, we have to make sure that the system does not call the
    * free callback for the network resource object. The network resource object
    * is still used by the physical machine. */
-  p_netElm = new RoutingEdgeWrapper(static_cast<RoutingEdgePtr>(xbt_lib_get_or_null(host_lib, sub_ws->getName(), ROUTING_HOST_LEVEL)));
-  xbt_lib_set(host_lib, name, ROUTING_HOST_LEVEL, p_netElm);
+  sg_host_t sg_sub_ws = sg_host_by_name_or_create(sub_ws->getName());
+  p_netElm = new RoutingEdgeWrapper(sg_host_edge(sg_sub_ws));
+  sg_host_edge_set(sg_host_by_name_or_create(name), p_netElm);
 
   p_subWs = sub_ws;
   p_currentState = SURF_VM_STATE_CREATED;
 
   // //// CPU  RELATED STUFF ////
   // Roughly, create a vcpu resource by using the values of the sub_cpu one.
-  CpuCas01Ptr sub_cpu = static_cast<CpuCas01Ptr>(surf_cpu_resource_priv(host_PM));
-
-  /* We can assume one core and cas01 cpu for the first step.
-   * Do xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu) if you get the resource. */
+  CpuCas01 *sub_cpu = static_cast<CpuCas01*>(sg_host_surfcpu(host_PM));
 
   p_cpu = surf_cpu_model_vm->createCpu(name, // name
       sub_cpu->getPowerPeakList(),        // host->power_peak,
@@ -330,26 +319,24 @@ void VMHL13::restore()
 void VMHL13::migrate(surf_resource_t ind_dst_pm)
 {
    /* ind_dst_pm equals to smx_host_t */
-   HostPtr ws_dst = static_cast<HostPtr>(surf_host_resource_priv(ind_dst_pm));
+   Host *ws_dst = static_cast<Host*>(surf_host_resource_priv(ind_dst_pm));
    const char *vm_name = getName();
    const char *pm_name_src = p_subWs->getName();
    const char *pm_name_dst = ws_dst->getName();
 
    xbt_assert(ws_dst);
 
-   /* do something */
-
    /* update net_elm with that of the destination physical host */
-   RoutingEdgePtr old_net_elm = p_netElm;
-   RoutingEdgePtr new_net_elm = new RoutingEdgeWrapper(static_cast<RoutingEdgePtr>(xbt_lib_get_or_null(host_lib, pm_name_dst, ROUTING_HOST_LEVEL)));
+   RoutingEdge *old_net_elm = p_netElm;
+   RoutingEdge *new_net_elm = new RoutingEdgeWrapper(sg_host_edge(sg_host_by_name(pm_name_dst)));
    xbt_assert(new_net_elm);
 
    /* Unregister the current net_elm from host_lib. Do not call the free callback. */
-   xbt_lib_unset(host_lib, vm_name, ROUTING_HOST_LEVEL, 0);
+   sg_host_edge_destroy(sg_host_by_name(vm_name), 0);
 
    /* Then, resister the new one. */
    p_netElm = new_net_elm;
-   xbt_lib_set(host_lib, vm_name, ROUTING_HOST_LEVEL, p_netElm);
+   sg_host_edge_set(sg_host_by_name(vm_name), p_netElm);
 
    p_subWs = ws_dst;
 
@@ -366,8 +353,8 @@ void VMHL13::migrate(surf_resource_t ind_dst_pm)
 #endif
 
      /* create a cpu action bound to the pm model at the destination. */
-     CpuActionPtr new_cpu_action = static_cast<CpuActionPtr>(
-                                           static_cast<CpuPtr>(surf_cpu_resource_priv(ind_dst_pm))->execute(0));
+     CpuAction *new_cpu_action = static_cast<CpuAction*>(
+                                           static_cast<Cpu*>(sg_host_surfcpu(ind_dst_pm))->execute(0));
 
      e_surf_action_state_t state = p_action->getState();
      if (state != SURF_ACTION_DONE)
@@ -397,7 +384,7 @@ void VMHL13::setBound(double bound){
  p_action->setBound(bound);
 }
 
-void VMHL13::setAffinity(CpuPtr cpu, unsigned long mask){
+void VMHL13::setAffinity(Cpu *cpu, unsigned long mask){
  p_action->setAffinity(cpu, mask);
 }
 
@@ -411,7 +398,7 @@ surf_resource_t VMHL13::getPm()
 }
 
 /* Adding a task to a VM updates the VCPU task on its physical machine. */
-ActionPtr VMHL13::execute(double size)
+Action *VMHL13::execute(double size)
 {
   double old_cost = p_action->getCost();
   double new_cost = old_cost + size;
@@ -425,7 +412,7 @@ ActionPtr VMHL13::execute(double size)
   return p_cpu->execute(size);
 }
 
-ActionPtr VMHL13::sleep(double duration) {
+Action *VMHL13::sleep(double duration) {
   return p_cpu->sleep(duration);
 }
 
index 397bac5..80a6fe6 100644 (file)
  ***********/
 
 class VMHL13Model;
-typedef VMHL13Model *VMHL13ModelPtr;
-
 class VMHL13;
-typedef VMHL13 *VMHL13Ptr;
 
 /*********
  * Model *
@@ -31,15 +28,14 @@ public:
   VMHL13Model();
   ~VMHL13Model(){};
 
-  VMPtr createVM(const char *name, surf_resource_t host_PM);
+  VM *createVM(const char *name, surf_resource_t host_PM);
   double shareResources(double now);
   void adjustWeightOfDummyCpuActions() {};
-  ActionPtr communicate(HostPtr src, HostPtr dst, double size, double rate);
-  ActionPtr executeParallelTask(int host_nb,
-                                          void **host_list,
-                                          double *flops_amount,
-                                          double *bytes_amount,
-                                          double rate);
+  Action *executeParallelTask(int host_nb,
+                              sg_host_t *host_list,
+                                                         double *flops_amount,
+                                                         double *bytes_amount,
+                                                         double rate);
   void updateActionsState(double /*now*/, double /*delta*/);
 };
 
@@ -49,7 +45,7 @@ public:
 
 class VMHL13 : public VM {
 public:
-  VMHL13(VMModelPtr model, const char* name, xbt_dict_t props, surf_resource_t host_PM);
+  VMHL13(VMModel *model, const char* name, xbt_dict_t props, surf_resource_t host_PM);
   ~VMHL13();
 
   void suspend();
@@ -66,14 +62,14 @@ public:
   surf_resource_t getPm(); // will be vm_ws_get_pm()
 
   void setBound(double bound);
-  void setAffinity(CpuPtr cpu, unsigned long mask);
+  void setAffinity(Cpu *cpu, unsigned long mask);
 
   //FIXME: remove
   void updateState(tmgr_trace_event_t event_type, double value, double date);
   bool isUsed();
 
-  ActionPtr execute(double size);
-  ActionPtr sleep(double duration);
+  Action *execute(double size);
+  Action *sleep(double duration);
 };
 
 /**********
index c72689d..872bdd3 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-2015. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm, surf,
                                 "Logging specific to the SURF VM module");
 
-VMModelPtr surf_vm_model = NULL;
+VMModel *surf_vm_model = NULL;
 
 /*************
  * Callbacks *
  *************/
 
-surf_callback(void, VMPtr) VMCreatedCallbacks;
-surf_callback(void, VMPtr) VMDestructedCallbacks;
-surf_callback(void, VMPtr) VMStateChangedCallbacks;
+surf_callback(void, VM*) VMCreatedCallbacks;
+surf_callback(void, VM*) VMDestructedCallbacks;
+surf_callback(void, VM*) VMStateChangedCallbacks;
 
 /*********
  * Model *
  *********/
 
-VMModel::VMModel() : HostModel("Virtual Machine") {
-  p_cpuModel = surf_cpu_model_vm;
-}
-
 VMModel::vm_list_t VMModel::ws_vms;
 
 /************
  * Resource *
  ************/
 
-VM::VM(ModelPtr model, const char *name, xbt_dict_t props,
-                       RoutingEdgePtr netElm, CpuPtr cpu)
+VM::VM(Model *model, const char *name, xbt_dict_t props,
+                       RoutingEdge *netElm, Cpu *cpu)
 : Host(model, name, props, NULL, netElm, cpu)
 {
   VMModel::ws_vms.push_back(*this);
@@ -43,14 +38,13 @@ VM::VM(ModelPtr model, const char *name, xbt_dict_t props,
 }
 
 /*
- * A physical host does not disapper in the current SimGrid code, but a VM may
- * disapper during a simulation.
+ * A physical host does not disappear in the current SimGrid code, but a VM may
+ * disappear during a simulation.
  */
 VM::~VM()
 {
   surf_callback_emit(VMDestructedCallbacks, this);
-  VMModel::ws_vms.erase(VMModel::
-                                   vm_list_t::s_iterator_to(*this));
+  VMModel::ws_vms.erase(VMModel::vm_list_t::s_iterator_to(*this));
 }
 
 void VM::setState(e_surf_resource_state_t state){
@@ -59,7 +53,7 @@ void VM::setState(e_surf_resource_state_t state){
 }
 
 /*
- * A surf level object will be useless in the upper layer. Returing the
+ * A surf level object will be useless in the upper layer. Returning the
  * dict_elm of the host.
  **/
 surf_resource_t VM::getPm()
index a8ddce8..e15fa81 100644 (file)
  ***********/
 
 class VMModel;
-typedef VMModel *VMModelPtr;
-
 class VM;
-typedef VM *VMPtr;
-
-class VMLmm;
-typedef VMLmm *VMLmmPtr;
 
 /*************
  * Callbacks *
  *************/
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after VM creation *
- * @details Callback functions have the following signature: `void(VMPtr)`
+ * @brief Callbacks fired after VM creation. Signature: `void(VM*)`
  */
-extern surf_callback(void, VMPtr) VMCreatedCallbacks;
+extern surf_callback(void, VM*) VMCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after VM destruction *
- * @details Callback functions have the following signature: `void(VMPtr)`
+ * @brief Callbacks fired after VM destruction. Signature: `void(VM*)`
  */
-extern surf_callback(void, VMPtr) VMDestructedCallbacks;
+extern surf_callback(void, VM*) VMDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after VM State changed *
- * @details Callback functions have the following signature: `void(VMActionPtr)`
+ * @brief Callbacks after VM State changes. Signature: `void(VMAction*)`
  */
-extern surf_callback(void, VMPtr) VMStateChangedCallbacks;
+extern surf_callback(void, VM*) VMStateChangedCallbacks;
 
 /*********
  * Model *
@@ -56,10 +47,10 @@ extern surf_callback(void, VMPtr) VMStateChangedCallbacks;
  */
 class VMModel : public HostModel {
 public:
-  VMModel();
+  VMModel() :HostModel(){}
   ~VMModel(){};
 
-  HostPtr createHost(const char *name){DIE_IMPOSSIBLE;}
+  Host *createHost(const char *name){DIE_IMPOSSIBLE;}
 
   /**
    * @brief Create a new VM
@@ -68,12 +59,10 @@ public:
    * @param host_PM The real machine hosting the VM
    *
    */
-  virtual VMPtr createVM(const char *name, surf_resource_t host_PM)=0;
+  virtual VM *createVM(const char *name, surf_resource_t host_PM)=0;
   void adjustWeightOfDummyCpuActions() {};
 
-  typedef boost::intrusive::list<VM,
-                                 boost::intrusive::constant_time_size<false> >
-          vm_list_t;
+  typedef boost::intrusive::list<VM, boost::intrusive::constant_time_size<false> > vm_list_t;
   static vm_list_t ws_vms;
 };
 
@@ -89,7 +78,7 @@ class VM : public Host,
            public boost::intrusive::list_base_hook<> {
 public:
   /**
-   * @brief VM constructor
+   * @brief Constructor
    *
    * @param model VMModel associated to this VM
    * @param name The name of the VM
@@ -97,55 +86,38 @@ public:
    * @param netElm The RoutingEdge associated to this VM
    * @param cpu The Cpu associated to this VM
    */
-  VM(ModelPtr model, const char *name, xbt_dict_t props,
-                       RoutingEdgePtr netElm, CpuPtr cpu);
+  VM(Model *model, const char *name, xbt_dict_t props,
+                       RoutingEdge *netElm, Cpu *cpu);
 
-  /**
-   * @brief WdorkstationVM destructor
-   */
+  /** @brief Destructor */
   ~VM();
 
   void setState(e_surf_resource_state_t state);
 
-  /**
-   * @brief Suspend the VM
-   */
+  /** @brief Suspend the VM */
   virtual void suspend()=0;
 
-  /**
-   * @brief Resume the VM
-   */
+  /** @brief Resume the VM */
   virtual void resume()=0;
 
-  /**
-   * @brief Save the VM (Not yet implemented)
-   */
+  /** @brief Save the VM (Not yet implemented) */
   virtual void save()=0;
 
-  /**
-   * @brief Restore the VM (Not yet implemented)
-   */
+  /** @brief Restore the VM (Not yet implemented) */
   virtual void restore()=0;
 
-  /**
-   * @brief Migrate the VM to the destination host
-   *
-   * @param ind_vm_ws_dest The destination host
-   */
-  virtual void migrate(surf_resource_t ind_vm_ws_dest)=0;
+  /** @brief Migrate the VM to the destination host */
+  virtual void migrate(surf_resource_t dest_PM)=0;
 
-  /**
-   * @brief Get the physical machine hosting the VM
-   * @return The physical machine hosting the VM
-   */
+  /** @brief Get the physical machine hosting the VM */
   virtual surf_resource_t getPm()=0;
 
   virtual void setBound(double bound)=0;
-  virtual void setAffinity(CpuPtr cpu, unsigned long mask)=0;
+  virtual void setAffinity(Cpu *cpu, unsigned long mask)=0;
 
   /* The vm object of the lower layer */
-  CpuActionPtr p_action;
-  HostPtr p_subWs;  // Pointer to the ''host'' OS
+  CpuAction *p_action;
+  Host *p_subWs;  // Pointer to the ''host'' OS
   e_surf_vm_state_t p_currentState;
 };
 
index 953666c..4f9313e 100644 (file)
@@ -70,7 +70,6 @@ void xbt_lib_set(xbt_lib_t lib, const char *key, int level, void *obj)
   elts[level] = obj;
 }
 
-/* for vm */
 void xbt_lib_unset(xbt_lib_t lib, const char *key, int level, int invoke_callback)
 {
   void **elts = xbt_dict_get_or_null(lib->dict, key);
index 7547f32..c690e8b 100644 (file)
@@ -721,9 +721,7 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(surf_network_gtnets_topology);
 #endif
 #ifdef HAVE_NS3
-  XBT_LOG_CONNECT(surf_network_ns3);
-  XBT_LOG_CONNECT(interface_ns3);
-  XBT_LOG_CONNECT(simulator_ns3);
+  XBT_LOG_CONNECT(ns3);
 #endif
   XBT_LOG_CONNECT(surf_parse);
   XBT_LOG_CONNECT(surf_route);
index 3221ba8..b086b9a 100644 (file)
@@ -62,7 +62,7 @@ xbt_thread_t xbt_thread_create(const char *name, void_f_pvoid_t code,
   res->code = code;
   res->father_data = SIMIX_process_self_get_data(SIMIX_process_self());
   /*   char*name = bprintf("%s#%p",SIMIX_process_self_get_name(), param); */
-  simcall_process_create(&res->s_process, name,
+  res->s_process = simcall_process_create(name,
                            xbt_thread_create_wrapper, res,
                            SIMIX_host_self_get_name(), -1.0, 0, NULL,
                            /*props */ NULL,0);
index 62660f9..f3e0759 100644 (file)
@@ -25,7 +25,7 @@ int master(int argc, char *argv[])
 
   char mailbox[256];
   msg_task_t task = NULL;
-  msg_host_t jupiter = MSG_get_host_by_name("Jupiter");
+  msg_host_t jupiter = MSG_host_by_name("Jupiter");
   sprintf(mailbox, "jupi");
 
   task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL);
@@ -55,7 +55,7 @@ int master(int argc, char *argv[])
 
   char **argvF = xbt_new(char*, 2);
   argvF[0] = xbt_strdup("slave");
-  MSG_process_create_with_arguments("slave", slave, NULL, MSG_get_host_by_name("Jupiter"), 1, argvF);
+  MSG_process_create_with_arguments("slave", slave, NULL, MSG_host_by_name("Jupiter"), 1, argvF);
 
   task = MSG_task_create("task on with proc", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Sending \"%s\"", task->name);
index 9fb3bde..2ef12c3 100644 (file)
@@ -25,7 +25,7 @@ int master(int argc, char *argv[])
 {
   xbt_ex_t e;
   TRY {
-    msg_host_t jupiter = MSG_get_host_by_name("Jupiter");
+    msg_host_t jupiter = MSG_host_by_name("Jupiter");
     
     XBT_INFO("Master starting");
     MSG_process_sleep(0.5);
index 8237bf2..5decb22 100644 (file)
@@ -23,7 +23,7 @@ int master(int argc, char *argv[])
 {
   xbt_ex_t e;
   TRY {
-    msg_host_t jupiter = MSG_get_host_by_name("Jupiter");
+    msg_host_t jupiter = MSG_host_by_name("Jupiter");
     XBT_INFO("Master waiting");
     if(MSG_process_sleep(1)) {
       XBT_ERROR("Unexpected error while sleeping");
index d81dfe8..2db60b3 100644 (file)
@@ -28,7 +28,7 @@ int test_launcher(int argc, char *argv[])
   char **argvF;
   argvF = xbt_new(char*, 2);
   argvF[0] = xbt_strdup("process_daemon");
-  msg_host_t jupiter = MSG_get_host_by_name("Jupiter");
+  msg_host_t jupiter = MSG_host_by_name("Jupiter");
 
   test = 1;
   // Create a process running a simple task on a host and turn the host off during the execution of the process.
@@ -90,7 +90,7 @@ int test_launcher(int argc, char *argv[])
     MSG_process_sleep(10);
     argvF = xbt_new(char*, 2);
     argvF[0] = xbt_strdup("commRX");
-    MSG_process_create_with_arguments("commRX", commRX, NULL, MSG_get_host_by_name("Tremblay"), 1, argvF);
+    MSG_process_create_with_arguments("commRX", commRX, NULL, MSG_host_by_name("Tremblay"), 1, argvF);
     argvF = xbt_new(char*, 2);
     argvF[0] = xbt_strdup("commTX");
     MSG_process_create_with_arguments("commTX", commTX, NULL, jupiter, 1, argvF);
@@ -111,7 +111,7 @@ int test_launcher(int argc, char *argv[])
     MSG_process_create_with_arguments("commRX", commRX, NULL, jupiter, 1, argvF);
     argvF = xbt_new(char*, 2);
     argvF[0] = xbt_strdup("commTX");
-    MSG_process_create_with_arguments("commTX", commTX, NULL, MSG_get_host_by_name("Tremblay"), 1, argvF);
+    MSG_process_create_with_arguments("commTX", commTX, NULL, MSG_host_by_name("Tremblay"), 1, argvF);
     XBT_INFO("  number of processes: %d", MSG_process_get_number());
     MSG_process_sleep(10);
     XBT_INFO("  Turn Jupiter off");
index 592715a..32b0d7d 100644 (file)
@@ -116,16 +116,16 @@ int main(int argc, char **argv)
   MSG_create_environment(argv[1]);
 
   MSG_function_register("host", host);
-  storage_info(MSG_get_host_by_name(xbt_strdup("host")));
+  storage_info(MSG_host_by_name(xbt_strdup("host")));
   for(i = 0 ; i<10; i++){
-       MSG_process_create(xbt_strdup("host"), host, NULL, MSG_get_host_by_name(xbt_strdup("host")));
+       MSG_process_create(xbt_strdup("host"), host, NULL, MSG_host_by_name(xbt_strdup("host")));
   }
 
 
 
 
   res = MSG_main();
-  storage_info(MSG_get_host_by_name(xbt_strdup("host")));
+  storage_info(MSG_host_by_name(xbt_strdup("host")));
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
   if (res == MSG_OK)
index e8458b1..e7cee69 100644 (file)
@@ -2,7 +2,7 @@
 
 $ simdag/availability/availability_test ${srcdir:=.}/simdag/availability/simulacrum_7_hosts.xml --cfg=path:${srcdir:=.}/simdag/availability/ ${srcdir:=.}/../examples/simdag/scheduling/Montage_25.xml --cfg=network/TCP_gamma:4194304 --log=sd_daxparse.thresh:critical
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > Scheduling DAX...
 > Scheduling root to node: Host 26
 > Scheduling ID00000@mProjectPP to node: Host 27
index 07e3966..183303b 100644 (file)
@@ -1,3 +1,3 @@
 $ ${bindir:=.}/basic0 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n"
-> [  0.000000] surf_host_model_init_ptask_L07
+> [  0.000000] Switching to the L07 model to handle parallel tasks.
 > [  0.800100] Simulation time: 0.800100
index b87dc1f..1e251eb 100644 (file)
@@ -1,3 +1,3 @@
 $ ${bindir:=.}/basic1 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > [ 16.000100] (0:@) Simulation time: 16.000100
index 069f50f..7728ee8 100644 (file)
@@ -1,3 +1,3 @@
 $ ${bindir:=.}/basic2 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > [  8.800100] (0:@) Simulation time: 8.800100
index 55b481a..7c3139c 100644 (file)
@@ -1,5 +1,5 @@
 $ ${bindir:=.}/basic3 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n" --log=sd_kernel.thresh:verbose
-> [  0.000000] surf_host_model_init_ptask_L07
+> [  0.000000] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] Starting simulation...
 > [  0.000000] Run simulation for -1.000000 seconds
 > [  0.000000] Executing task 'Task Init'
index 6d025c3..01341d2 100644 (file)
@@ -1,5 +1,5 @@
 $ ${bindir:=.}/basic4 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n" --log=sd_kernel.thresh:verbose
-> [  0.000000] surf_host_model_init_ptask_L07
+> [  0.000000] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] Starting simulation...
 > [  0.000000] Run simulation for -1.000000 seconds
 > [  0.000000] Executing task 'Task Init'
index 906989d..55b251b 100644 (file)
@@ -1,3 +1,3 @@
 $ ${bindir:=.}/basic5 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n"
-> [  0.000000] surf_host_model_init_ptask_L07
+> [  0.000000] Switching to the L07 model to handle parallel tasks.
 > [  0.002500] Simulation time: 0.002500
index 721e08e..550dd6c 100644 (file)
@@ -1,3 +1,3 @@
 $ ${bindir:=.}/basic6 ../network/p2p/platform_2p_1sl.xml "--log=root.fmt:[%10.6r]%e%m%n"
-> [  0.000000] surf_host_model_init_ptask_L07
+> [  0.000000] Switching to the L07 model to handle parallel tasks.
 > [  2.000000] Simulation time: 2.000000
index d5c817e..e98ada5 100644 (file)
@@ -1,5 +1,5 @@
 $ ${bindir:=.}/incomplete ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e%m%n"
-> [  0.000000] surf_host_model_init_ptask_L07
+> [  0.000000] Switching to the L07 model to handle parallel tasks.
 > [  8.000100] Simulation is finished but 3 tasks are still not done
 > [  8.000100] Task C is in SD_NOT_SCHEDULED state
 > [  8.000100] Task B is in SD_SCHEDULABLE state
index 286ff7a..af6a3f8 100644 (file)
@@ -3,5 +3,5 @@ p all 2 all test, only fat pipe switch is used concurrently
 ! output sort
 
 $ simdag/network/mxn/test_intra_all2all ${srcdir:=.}/simdag/network/mxn/platform_4p_1switch.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 8
index de0811d..95b2a62 100644 (file)
@@ -3,5 +3,5 @@ p sending on different paths test
 ! output sort
 
 $ simdag/network/mxn/test_intra_independent_comm ${srcdir:=.}/simdag/network/mxn/platform_4p_1switch.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 3
index 72680c4..51cfb1a 100644 (file)
@@ -3,5 +3,5 @@ p scatter test
 ! output sort
 
 $ simdag/network/mxn/test_intra_scatter ${srcdir:=.}/simdag/network/mxn/platform_4p_1switch.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 8
index a51af45..66109b0 100644 (file)
@@ -3,19 +3,19 @@ p latency check, 1 byte, shared link
 ! output sort
 
 $ simdag/network/p2p/test_latency1 ${srcdir:=.}/simdag/network/p2p/platform_2p_1sl.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 1.5
 
 p latency check, 1 byte, fat pipe
 ! output sort
 
 $ simdag/network/p2p/test_latency1 ${srcdir:=.}/simdag/network/p2p/platform_2p_1fl.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 1.5
 
 p latency check, 1 byte, link - switch - link
 ! output sort
 
 $ simdag/network/p2p/test_latency1 ${srcdir:=.}/simdag/network/p2p/platform_2p_1switch.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 3
index 7aeb17b..3ee1a07 100644 (file)
@@ -3,19 +3,19 @@ p latency check, 2 x 1 byte, same direction, shared link
 ! output sort
 
 $ simdag/network/p2p/test_latency2 ${srcdir:=.}/simdag/network/p2p/platform_2p_1sl.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 2.5
 
 p latency check, 2 x 1 byte, same direction, fat pipe
 ! output sort
 
 $ simdag/network/p2p/test_latency2 ${srcdir:=.}/simdag/network/p2p/platform_2p_1fl.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 1.5
 
 p latency check, 2 x 1 byte, same direction, link - switch - link
 ! output sort
 
 $ simdag/network/p2p/test_latency2 ${srcdir:=.}/simdag/network/p2p/platform_2p_1switch.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 4
index c5f3958..7ba096d 100644 (file)
@@ -3,19 +3,19 @@ p latency check, 2 x 1 byte, opposite direction, shared link
 ! output sort
 
 $ simdag/network/p2p/test_latency3 ${srcdir:=.}/simdag/network/p2p/platform_2p_1sl.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 2.5
 
 p latency check, 2 x 1 byte, opposite direction, fat pipe
 ! output sort
 
 $ simdag/network/p2p/test_latency3 ${srcdir:=.}/simdag/network/p2p/platform_2p_1fl.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 1.5
 
 p latency check, 2 x 1 byte, opposite direction, link - switch - link
 ! output sort
 
 $ simdag/network/p2p/test_latency3 ${srcdir:=.}/simdag/network/p2p/platform_2p_1switch.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 4
index 413e25d..138c728 100644 (file)
@@ -3,5 +3,5 @@ p latency bounded by large latency link
 ! output sort
 
 $ simdag/network/p2p/test_latency_bound ${srcdir:=.}/simdag/network/p2p/platform_2p_1bb.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 10001.5
index 3ebcb41..a126fcf 100644 (file)
@@ -3,7 +3,7 @@ p Reinitialization test
 ! output sort
 
 $ simdag/network/test_reinit_costs ${srcdir:=.}/simdag/network/platform_2p_1sl.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 0
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 1.5
index 04eaac4..1ef2faf 100644 (file)
@@ -2,11 +2,11 @@
 p par task comp only, no comm, homogeneous
 ! output sort
 $ simdag/partask/test_comp_only_par ${srcdir:=.}/simdag/partask/platform_2p_1sl.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 1
 
 p par task comp only, no comm, heterogeneous
 ! output sort
 $ simdag/partask/test_comp_only_par ${srcdir:=.}/simdag/partask/platform_2p_1sl_hetero.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 1
index bd31216..39fee75 100644 (file)
@@ -3,5 +3,5 @@ p seq task comp only, no comm
 
 ! output sort
 $ simdag/partask/test_comp_only_seq ${srcdir:=.}/simdag/partask/platform_2p_1sl.xml --cfg=path:${srcdir} --log=sd_kernel.thres=warning "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > 1
index c7c3b71..67c5c31 100644 (file)
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic_link_test, sd,
                                 "SimDag test basic_link_test");
 
+static int cmp_link(const void*a, const void*b) {
+       const char *nameA = SD_link_get_name(*(SD_link_t*)a);
+       const char *nameB = SD_link_get_name(*(SD_link_t*)b);
+  return strcmp( nameA, nameB );
+}
+
 int main(int argc, char **argv)
 {
   int i;
@@ -24,8 +30,11 @@ int main(int argc, char **argv)
 
   /* creation of the environment */
   SD_create_environment(argv[1]);
-  XBT_INFO("Link number: %d", SD_link_get_number());
   links = SD_link_get_list();
+  int count = SD_link_get_number();
+  XBT_INFO("Link count: %d", count);
+  qsort((void *)links, count, sizeof(SD_link_t), cmp_link);
+   
   for(i=0; i<SD_link_get_number();i++){
     XBT_INFO("%s: latency = %.5f, bandwidth = %f",
              SD_link_get_name(links[i]),
index e4918d2..632a84f 100644 (file)
@@ -1,17 +1,17 @@
 #! ./tesh
 
 $ ${bindir:=.}/basic_link_test one_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
-> [  0.000000] (0:@) Link number: 12
-> [  0.000000] (0:@) bob_cluster_link_2_UP: latency = 0.00005, bandwidth = 125000000.000000
-> [  0.000000] (0:@) bob_cluster_link_6_UP: latency = 0.00005, bandwidth = 125000000.000000
-> [  0.000000] (0:@) bob_cluster_link_2_DOWN: latency = 0.00005, bandwidth = 125000000.000000
-> [  0.000000] (0:@) bob_cluster_link_6_DOWN: latency = 0.00005, bandwidth = 125000000.000000
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
+> [  0.000000] (0:@) Link count: 12
 > [  0.000000] (0:@) __loopback__: latency = 0.00002, bandwidth = 498000000.000000
 > [  0.000000] (0:@) bob_cluster_backbone: latency = 0.00050, bandwidth = 2250000000.000000
-> [  0.000000] (0:@) bob_cluster_link_3_DOWN: latency = 0.00005, bandwidth = 125000000.000000
-> [  0.000000] (0:@) bob_cluster_link_0_UP: latency = 0.00005, bandwidth = 125000000.000000
-> [  0.000000] (0:@) bob_cluster_link_4_UP: latency = 0.00005, bandwidth = 125000000.000000
 > [  0.000000] (0:@) bob_cluster_link_0_DOWN: latency = 0.00005, bandwidth = 125000000.000000
-> [  0.000000] (0:@) bob_cluster_link_4_DOWN: latency = 0.00005, bandwidth = 125000000.000000
+> [  0.000000] (0:@) bob_cluster_link_0_UP: latency = 0.00005, bandwidth = 125000000.000000
+> [  0.000000] (0:@) bob_cluster_link_2_DOWN: latency = 0.00005, bandwidth = 125000000.000000
+> [  0.000000] (0:@) bob_cluster_link_2_UP: latency = 0.00005, bandwidth = 125000000.000000
+> [  0.000000] (0:@) bob_cluster_link_3_DOWN: latency = 0.00005, bandwidth = 125000000.000000
 > [  0.000000] (0:@) bob_cluster_link_3_UP: latency = 0.00005, bandwidth = 125000000.000000
+> [  0.000000] (0:@) bob_cluster_link_4_DOWN: latency = 0.00005, bandwidth = 125000000.000000
+> [  0.000000] (0:@) bob_cluster_link_4_UP: latency = 0.00005, bandwidth = 125000000.000000
+> [  0.000000] (0:@) bob_cluster_link_6_DOWN: latency = 0.00005, bandwidth = 125000000.000000
+> [  0.000000] (0:@) bob_cluster_link_6_UP: latency = 0.00005, bandwidth = 125000000.000000
index bcaa51b..636b553 100644 (file)
@@ -1,79 +1,79 @@
 ! output sort
 
 $ ${bindir:=.}/basic_parsing_test one_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 5, link number: 12
 
 $ ${bindir:=.}/basic_parsing_test one_host_availability.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 1
 
 $ ${bindir:=.}/basic_parsing_test one_host_properties.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 1
 
 $ ${bindir:=.}/basic_parsing_test one_host_state_file.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 1
 
 $ ${bindir:=.}/basic_parsing_test one_host_state_off.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 1
 
 $ ${bindir:=.}/basic_parsing_test one_host_state_on.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 1
 
 $ ${bindir:=.}/basic_parsing_test one_host_trace_file.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 1
 
 $ ${bindir:=.}/basic_parsing_test one_host_trace_inside.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 1
 
 $ ${bindir:=.}/basic_parsing_test one_host.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 1
 
 $ ${bindir:=.}/basic_parsing_test one_link_availability.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 2
 
 $ ${bindir:=.}/basic_parsing_test one_link_fatpipe.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 2
 
 $ ${bindir:=.}/basic_parsing_test one_link_shared.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 2
 
 $ ${bindir:=.}/basic_parsing_test one_link_state_file.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 1, link number: 2
 
 $ ${bindir:=.}/basic_parsing_test three_hosts_non_symmetric_route.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 3, link number: 4
 
 $ ${bindir:=.}/basic_parsing_test two_clusters.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 10, link number: 24
 
 $ ${bindir:=.}/basic_parsing_test two_hosts_multi_hop.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 2, link number: 4
 
 $ ${bindir:=.}/basic_parsing_test two_hosts_one_link.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 2, link number: 2
 
 $ ${bindir:=.}/basic_parsing_test ./four_hosts_floyd.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > Workstation number: 4, link number: 5
 
 $ ${bindir:=.}/basic_parsing_test ./four_hosts_floyd_bis.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > Workstation number: 5, link number: 7
 
 $ ${bindir:=.}/basic_parsing_test ./properties.xml
@@ -92,11 +92,11 @@ $ ${bindir:=.}/basic_parsing_test ./properties.xml --cfg=cpu/optim:TI
 > Workstation number: 1, link number: 1
 
 $ ${bindir:=.}/basic_parsing_test ./one_cluster_file.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > Workstation number: 2, link number: 6
 
 $ ${bindir:=.}/is_router_test ./test_of_is_router.xml
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > Workstation number: 10, link number: 1, elmts number: 21
 >    - Seen: "host01" is type : 1
 >    - Seen: "host02" is type : 1
index ee7c561..ff96505 100644 (file)
@@ -3,7 +3,7 @@
 p Testing a bypass ASroute
 ! output sort
 $ ${bindir:=.}/basic_parsing_test ${srcdir:=.}/examples/platforms/bypassASroute.xml FULL_LINK
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > Workstation number: 3, link number: 11
 > Route between 1 and 1
 >   Route size 2
@@ -63,7 +63,7 @@ $ ${bindir:=.}/basic_parsing_test ${srcdir:=.}/examples/platforms/bypassASroute.
 p Testing a bypass route
 
 $ ${bindir:=.}/basic_parsing_test ${srcdir:=.}/examples/platforms/bypassRoute.xml FULL_LINK
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > Workstation number: 4, link number: 10
 > Route between AS_2_host1 and AS_2_host1
 >   Route size 1
index 9574528..361ae21 100644 (file)
@@ -2,7 +2,7 @@
 ! output sort
 
 $ ${bindir:=.}/basic_parsing_test one_cluster_fullduplex.xml FULL_LINK "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 5, link number: 12
 > Route between bob3.hamburger.edu and bob3.hamburger.edu
 >   Route size 3
@@ -156,7 +156,7 @@ $ ${bindir:=.}/basic_parsing_test one_cluster_fullduplex.xml FULL_LINK "--log=ro
 >   Route latency = 0.000600, route bandwidth = 125000000.000000
 
 $ ${bindir:=.}/basic_parsing_test two_clusters_symmetric.xml FULL_LINK "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 4, link number: 12
 > Route between bob1.hamburger.edu and bob1.hamburger.edu
 >   Route size 3
@@ -272,7 +272,7 @@ $ ${bindir:=.}/basic_parsing_test two_clusters_symmetric.xml FULL_LINK "--log=ro
 >   Route latency = 0.000600, route bandwidth = 125000000.000000
 
 $ ${bindir:=.}/basic_parsing_test two_hosts_one_link_symmetrical.xml FULL_LINK "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 2, link number: 4
 > Route between alice and alice
 >   Route size 1
@@ -296,7 +296,7 @@ $ ${bindir:=.}/basic_parsing_test two_hosts_one_link_symmetrical.xml FULL_LINK "
 >   Route latency = 0.000015, route bandwidth = 498000000.000000
 
 $ ${bindir:=.}/basic_parsing_test two_hosts_one_link_fullduplex.xml FULL_LINK "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 2, link number: 3
 > Route between alice and alice
 >   Route size 1
@@ -316,7 +316,7 @@ $ ${bindir:=.}/basic_parsing_test two_hosts_one_link_fullduplex.xml FULL_LINK "-
 >   Route latency = 0.000015, route bandwidth = 498000000.000000
 
 $ ${bindir:=.}/basic_parsing_test Dijkstra.xml FULL_LINK "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [  0.000000] (0:@) surf_host_model_init_ptask_L07
+> [  0.000000] (0:@) Switching to the L07 model to handle parallel tasks.
 > Workstation number: 2, link number: 6
 > Route between NODO01 and NODO01
 >   Route size 1
index 0b928fb..ef254d2 100644 (file)
@@ -1,5 +1,5 @@
 ! expect signal SIGABRT
 $ ${bindir:=.}/flatifier bogus_disk_attachment.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:@] Parse error at bogus_disk_attachment.xml:26: Unable to attach storage cdisk: host plouf doesn't exist.
 > [  0.000000] [0:@] Exiting now
index 75f1fd2..5392c51 100644 (file)
@@ -1,11 +1,11 @@
 ! expect signal SIGABRT
 $ ${bindir:=.}/flatifier bogus_missing_src_gateway.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:@] Parse error at bogus_missing_src_gateway.xml:16: gw_src="nod-cluster_router.cluster.us" not found for ASroute from "us" to "fr"
 > [  0.000000] [0:@] Exiting now
 
 ! expect signal SIGABRT
 $ ${bindir:=.}/flatifier bogus_missing_dst_gateway.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:@] Parse error at bogus_missing_dst_gateway.xml:16: gw_dst="neud-grappe_router.grappe.fr" not found for ASroute from "us" to "fr"
 > [  0.000000] [0:@] Exiting now
index c8a97aa..c4e90d5 100644 (file)
@@ -1,11 +1,11 @@
 ! expect signal SIGABRT
 $ ${bindir:=.}/flatifier bogus_two_hosts_asymetric.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:@] Parse error at bogus_two_hosts_asymetric.xml:24: A route between "alice" and "bob" already exists with a different content. If you are trying to define a reverse route, you must set the symmetrical=no attribute to your routes tags.
 > [  0.000000] [0:@] Exiting now
 
 ! expect signal SIGABRT
 $ ${bindir:=.}/flatifier bogus_two_hosts_asymetric-2.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > [  0.000000] [0:@] Parse error at bogus_two_hosts_asymetric-2.xml:26: A route between "alice" and "bob" already exists with a different content. If you are trying to define a reverse route, you must set the symmetrical=no attribute to your routes tags.
 > [  0.000000] [0:@] Exiting now
index a9c1c25..23b2632 100644 (file)
@@ -183,7 +183,7 @@ int main(int argc, char **argv)
           SD_link_get_name(links[i]),
           SD_link_get_current_bandwidth(links[i]),
           SD_link_get_current_latency(links[i]));
-      if (SD_link_get_sharing_policy(links[i]) == SD_LINK_SHARED) {
+      if (SD_link_is_shared(links[i])) {
         printf("/>\n");
       } else {
         printf(" sharing_policy=\"FATPIPE\"/>\n");
@@ -193,14 +193,14 @@ int main(int argc, char **argv)
 
     xbt_lib_foreach(host_lib, cursor_src, src, value1) // Routes from host
     {
-      value1 = xbt_lib_get_or_null(host_lib,src,ROUTING_HOST_LEVEL);
+      value1 = sg_host_edge(sg_host_by_name(src));
       xbt_lib_foreach(host_lib, cursor_dst, dst, value2) //to host
       {
         printf("  <route src=\"%s\" dst=\"%s\">\n  "
             ,src
             ,dst);
         xbt_dynar_t route=NULL;
-        value2 = xbt_lib_get_or_null(host_lib,dst,ROUTING_HOST_LEVEL);
+        value2 = sg_host_edge(sg_host_by_name(dst));
         routing_get_route_and_latency(value1,value2,&route,NULL);
         for(i=0;i<xbt_dynar_length(route) ;i++)
         {
@@ -263,7 +263,7 @@ int main(int argc, char **argv)
           printf("  <route src=\"%s\" dst=\"%s\">\n  "
               ,src, dst);
           xbt_dynar_t route=NULL;
-          value2 = xbt_lib_get_or_null(host_lib,dst,ROUTING_HOST_LEVEL);
+          value2 = sg_host_edge(sg_host_by_name(dst));
           routing_get_route_and_latency((sg_routing_edge_t)value1,(sg_routing_edge_t)value2,&route, NULL);
           for(i=0;i<xbt_dynar_length(route) ;i++)
           {
index 710a0ee..d4356e8 100644 (file)
@@ -3,7 +3,7 @@
 ! output sort
 
 $ ${bindir:=.}/flatifier$EXEEXT one_cluster.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -138,7 +138,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_cluster.xml "--log=root.fmt:[%10.6r]%e[%i:%P
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_cluster_multicore.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -272,7 +272,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_cluster_multicore.xml "--log=root.fmt:[%10.6
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_host_availability.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -286,7 +286,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_host_availability.xml "--log=root.fmt:[%10.6
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_host_properties.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -304,7 +304,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_host_properties.xml "--log=root.fmt:[%10.6r]
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_host_state_file.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -318,7 +318,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_host_state_file.xml "--log=root.fmt:[%10.6r]
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_host_state_off.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -332,7 +332,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_host_state_off.xml "--log=root.fmt:[%10.6r]%
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_host_state_on.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -346,7 +346,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_host_state_on.xml "--log=root.fmt:[%10.6r]%e
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_host_trace_file.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -360,7 +360,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_host_trace_file.xml "--log=root.fmt:[%10.6r]
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_host_trace_inside.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -374,7 +374,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_host_trace_inside.xml "--log=root.fmt:[%10.6
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_host.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -388,7 +388,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_host.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_link_availability.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -403,7 +403,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_link_availability.xml "--log=root.fmt:[%10.6
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_link_fatpipe.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -418,7 +418,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_link_fatpipe.xml "--log=root.fmt:[%10.6r]%e[
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_link_shared.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -433,7 +433,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_link_shared.xml "--log=root.fmt:[%10.6r]%e[%
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT one_link_state_file.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -448,7 +448,7 @@ $ ${bindir:=.}/flatifier$EXEEXT one_link_state_file.xml "--log=root.fmt:[%10.6r]
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT three_hosts_non_symmetric_route.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -491,7 +491,7 @@ $ ${bindir:=.}/flatifier$EXEEXT three_hosts_non_symmetric_route.xml "--log=root.
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT two_clusters.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -968,7 +968,7 @@ $ ${bindir:=.}/flatifier$EXEEXT two_clusters.xml "--log=root.fmt:[%10.6r]%e[%i:%
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT two_hosts_multi_hop.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -995,7 +995,7 @@ $ ${bindir:=.}/flatifier$EXEEXT two_hosts_multi_hop.xml "--log=root.fmt:[%10.6r]
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT two_hosts_one_link.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -1020,7 +1020,7 @@ $ ${bindir:=.}/flatifier$EXEEXT two_hosts_one_link.xml "--log=root.fmt:[%10.6r]%
 > </platform>
 
 $ ${bindir:=.}/flatifier$EXEEXT ${srcdir:=.}/examples/platforms/bypassASroute.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
@@ -1155,7 +1155,7 @@ $ ${bindir:=.}/flatifier$EXEEXT ${srcdir:=.}/examples/platforms/bypassASroute.xm
 
 
 $ ${bindir:=.}/flatifier$EXEEXT ${srcdir:=.}/examples/platforms/torus_cluster.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
-> [  0.000000] [0:@] surf_host_model_init_ptask_L07
+> [  0.000000] [0:@] Switching to the L07 model to handle parallel tasks.
 > <?xml version='1.0'?>
 > <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 > <platform version="3">
index 53d3634..a105727 100644 (file)
@@ -2,7 +2,7 @@
 ! output sort
 
 $ ${bindir:=.}/basic_parsing_test ./four_hosts_floyd.xml FULL_LINK
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > Workstation number: 4, link number: 5
 > Route between host1 and host1
 >   Route size 1
@@ -74,7 +74,7 @@ $ ${bindir:=.}/basic_parsing_test ./four_hosts_floyd.xml FULL_LINK
 >   Route latency = 0.000015, route bandwidth = 498000000.000000
 
 $ ${bindir:=.}/basic_parsing_test ./four_hosts_floyd_bis.xml FULL_LINK
-> [0.000000] [surf_host/INFO] surf_host_model_init_ptask_L07
+> [0.000000] [surf_host/INFO] Switching to the L07 model to handle parallel tasks.
 > Workstation number: 5, link number: 7
 > Route between host1 and host1
 >   Route size 1
index f6e335e..46fbbbd 100644 (file)
@@ -41,10 +41,8 @@ const char *string_action(e_surf_action_state_t state)
 void test(char *platform);
 void test(char *platform)
 {
-  void *cpuA = NULL;
-  void *cpuB = NULL;
-  void *cardA = NULL;
-  void *cardB = NULL;
+  sg_host_t cpuA = NULL;
+  sg_host_t cpuB = NULL;
   surf_action_t actionA = NULL;
   surf_action_t actionB = NULL;
   surf_action_t actionC = NULL;
@@ -58,12 +56,12 @@ void test(char *platform)
 
   /*********************** CPU ***********************************/
   XBT_DEBUG("%p", surf_cpu_model_pm);
-  cpuA = surf_cpu_resource_by_name("Cpu A");
-  cpuB = surf_cpu_resource_by_name("Cpu B");
+  cpuA = sg_host_by_name("Cpu A");
+  cpuB = sg_host_by_name("Cpu B");
 
   /* Let's check that those two processors exist */
-  XBT_DEBUG("%s : %p", surf_cpu_name(surf_cpu_resource_priv(cpuA)), cpuA);
-  XBT_DEBUG("%s : %p", surf_cpu_name(surf_cpu_resource_priv(cpuB)), cpuB);
+  XBT_DEBUG("%s : %p", surf_cpu_name(sg_host_surfcpu(cpuA)), cpuA);
+  XBT_DEBUG("%s : %p", surf_cpu_name(sg_host_surfcpu(cpuB)), cpuB);
 
   /* Let's do something on it */
   actionA = surf_cpu_execute(cpuA, 1000.0);
@@ -82,15 +80,9 @@ void test(char *platform)
 
   /*********************** Network *******************************/
   XBT_DEBUG("%p", surf_network_model);
-  cardA = sg_routing_edge_by_name_or_null("Cpu A");
-  cardB = sg_routing_edge_by_name_or_null("Cpu B");
-
-  /* Let's check that those two processors exist */
-  XBT_DEBUG("%s : %p", surf_routing_edge_name(cardA), cardA);
-  XBT_DEBUG("%s : %p", surf_routing_edge_name(cardB), cardB);
 
   /* Let's do something on it */
-  surf_network_model_communicate(surf_network_model, cardA, cardB, 150.0, -1.0);
+  surf_network_model_communicate(surf_network_model, cpuA, cpuB, 150.0, -1.0);
 
   surf_solve(-1.0);                 /* Takes traces into account. Returns 0.0 */
   do {
index dbb1c6a..8d3791e 100644 (file)
@@ -42,8 +42,8 @@ const char *string_action(e_surf_action_state_t state)
 void test(char *platform);
 void test(char *platform)
 {
-  void *hostA = NULL;
-  void *hostB = NULL;
+  sg_host_t hostA = NULL;
+  sg_host_t hostB = NULL;
   double now = -1.0;
   int running;
 
@@ -52,19 +52,19 @@ void test(char *platform)
   parse_platform_file(platform);
 
   /*********************** HOST ***********************************/
-  hostA = surf_host_resource_by_name("Cpu A");
-  hostB = surf_host_resource_by_name("Cpu B");
+  hostA = sg_host_by_name("Cpu A");
+  hostB = sg_host_by_name("Cpu B");
 
   /* Let's check that those two processors exist */
-  XBT_DEBUG("%s : %p", surf_resource_name(hostA), hostA);
-  XBT_DEBUG("%s : %p", surf_resource_name(hostB), 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 */
   surf_host_execute(hostA, 1000.0);
   surf_host_execute(hostB, 1000.0);
   surf_host_sleep(hostB, 7.32);
 
-  surf_host_model_communicate(surf_host_model, hostA, hostB, 150.0, -1.0);
+  surf_network_model_communicate(surf_network_model, hostA, hostB, 150.0, -1.0);
 
   surf_solve(-1.0);                 /* Takes traces into account. Returns 0.0 */
   do {