Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "Remove XBT_INFO call"
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 31 Mar 2014 19:43:02 +0000 (21:43 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 31 Mar 2014 19:43:13 +0000 (21:43 +0200)
This commit changes much much more than wanted. In particular, it
reverts several changes done in the tree recently. I assume that the
merge that occured just before this commit went awfully wrong,
actually.

That's ok, shit happens, don't worry.

Nevertheless, I revert this commit when it's still possible, before
the first unrelated commit on top of it. Pierre, please, pick your
changes back from the diff, and resubmit them.

This reverts commit f9e6853d2c5b7b867211700bc12f0ee57f640b30.

62 files changed:
.gitignore
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/MakeExe.cmake
examples/java/reservationSurfPlugin/Receiver.java
examples/java/reservationSurfPlugin/ReservationPlugin.java
examples/java/reservationSurfPlugin/Sender.java
examples/java/reservationSurfPlugin/TestPlugin.java
examples/java/reservationSurfPlugin/reservationSurfPluginDeployment.xml
examples/java/reservationSurfPlugin/reservationSurfPluginPlatform.xml
examples/java/reservationSurfPlugin/reservation_surf_plugin.tesh
examples/java/surfPlugin/TracePlugin.java
examples/msg/mc/bugged1.tesh
examples/msg/mc/bugged1_liveness.tesh
examples/msg/mc/bugged1_liveness_visited.tesh
examples/msg/mc/bugged2.tesh
examples/smpi/CMakeLists.txt
examples/smpi/mc/hostfile_mutual_exclusion [new file with mode: 0644]
examples/smpi/mc/mutual_exclusion.c [new file with mode: 0644]
src/bindings/java/surf.i
src/bindings/java/surf_swig.cpp
src/bindings/java/surf_swig.hpp
src/mc/mc_checkpoint.c
src/mc/mc_dwarf.c
src/mc/mc_dwarf_expression.c
src/mc/mc_global.c
src/mc/mc_private.h
src/msg/msg_io.c
src/simix/smx_global.c
src/simix/smx_io.c
src/smpi/smpi_base.c
src/smpi/smpi_bench.c
src/smpi/smpi_global.c
src/smpi/smpi_pmpi.c
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.cpp
src/surf/network_interface.cpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/ns3/ns3_interface.cc
src/surf/ns3/ns3_interface.h
src/surf/plugins/energy.cpp
src/surf/storage_interface.cpp
src/surf/storage_interface.hpp
src/surf/surf_interface.cpp
src/surf/workstation_interface.cpp
src/surf/workstation_interface.hpp
src/surf/workstation_ptask_L07.cpp
src/surf/workstation_ptask_L07.hpp
src/xbt/mmalloc/mmorecore.c
teshsuite/bug-17132/CMakeLists.txt [new file with mode: 0644]
teshsuite/bug-17132/README [new file with mode: 0644]
teshsuite/bug-17132/bug-17132.c [new file with mode: 0644]
teshsuite/bug-17132/bug-17132.tesh [new file with mode: 0644]
teshsuite/bug-17132/hostfile.txt [new file with mode: 0644]
teshsuite/bug-17132/small_platform.xml [new file with mode: 0644]
teshsuite/simix/stack_overflow.tesh
testsuite/mc/dwarf_expression.c

index 6dc00ee..5b889c1 100644 (file)
@@ -254,6 +254,7 @@ examples/smpi/mc/bugged2
 
 src/replay/replay
 src/testall
 
 src/replay/replay
 src/testall
+teshsuite/bug-17132/bug-17132
 teshsuite/smpi/allgather_coll
 teshsuite/smpi/allgatherv_coll
 teshsuite/smpi/allreduce_coll
 teshsuite/smpi/allgather_coll
 teshsuite/smpi/allgatherv_coll
 teshsuite/smpi/allreduce_coll
index 03ad3a8..1b7ea2c 100644 (file)
@@ -444,6 +444,10 @@ if(NOT enable_memcheck)
     ADD_TEST(smpi-struct-thread                 ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct.tesh)
     ADD_TEST(smpi-pt2pt-thread                  ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt.tesh)
     ADD_TEST(smpi-compute-thread                ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute.tesh)
     ADD_TEST(smpi-struct-thread                 ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/struct.tesh)
     ADD_TEST(smpi-pt2pt-thread                  ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt.tesh)
     ADD_TEST(smpi-compute-thread                ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/compute.tesh)
+    
+    # https://gforge.inria.fr/tracker/index.php?func=detail&aid=17132&group_id=12&atid=165
+    ADD_TEST(smpi-bug-17132                ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132 --cd ${CMAKE_BINARY_DIR}/teshsuite/bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132.tesh)
+    
     if (NOT WIN32)
       ADD_TEST(smpi-shared-thread               ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/shared.tesh)
     endif()
     if (NOT WIN32)
       ADD_TEST(smpi-shared-thread               ${TESH_COMMAND} ${TESH_OPTION} --cfg contexts/factory:thread --cd ${CMAKE_BINARY_DIR}/teshsuite/smpi ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/shared.tesh)
     endif()
index 2c0e140..013c8fc 100644 (file)
@@ -505,7 +505,13 @@ set(JSURF_JAVA_GENERATED_SRC
   ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/NetworkLink.java
   ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/NetworkAction.java
 
   ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/NetworkLink.java
   ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/NetworkAction.java
 
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/RoutingEdge.java
+
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/ActionState.java
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/ResourceState.java
+
   ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/LmmConstraint.java
   ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/LmmConstraint.java
+  ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/LmmVariable.java
   ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/XbtDict.java
 )
 
   ${CMAKE_BINARY_DIR}/src/bindings/java/org/simgrid/surf/XbtDict.java
 )
 
@@ -975,6 +981,7 @@ set(TESHSUITE_CMAKEFILES_TXT
   teshsuite/msg/CMakeLists.txt
   teshsuite/msg/storage/CMakeLists.txt
   teshsuite/msg/trace/CMakeLists.txt
   teshsuite/msg/CMakeLists.txt
   teshsuite/msg/storage/CMakeLists.txt
   teshsuite/msg/trace/CMakeLists.txt
+  teshsuite/bug-17132/CMakeLists.txt
   teshsuite/simdag/CMakeLists.txt
   teshsuite/simdag/availability/CMakeLists.txt
   teshsuite/simdag/network/CMakeLists.txt
   teshsuite/simdag/CMakeLists.txt
   teshsuite/simdag/availability/CMakeLists.txt
   teshsuite/simdag/network/CMakeLists.txt
index a5a5819..b9445e4 100644 (file)
@@ -90,6 +90,8 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/network/p2p)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/partask)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms)
 
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/partask)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms)
 
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132)
+
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simix)
 
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi)
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simix)
 
 add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi)
index cd66bb4..7097e5b 100644 (file)
@@ -21,15 +21,11 @@ public class Receiver extends Process {
    public void main(String[] args) throws MsgException {
 
       Msg.info("helloo!");
    public void main(String[] args) throws MsgException {
 
       Msg.info("helloo!");
-      double communicationTime=0;
 
 
-      Msg.info("try to get a task");
-
-      Task task = Task.receive(getHost().getName());
-      double timeGot = Msg.getClock();
-
-      Msg.info("Got at time "+ timeGot);
-      task.execute();
+      Task task;
+      task = Task.receive(getHost().getName());
+      task = Task.receive(getHost().getName());
+      task = Task.receive(getHost().getName());
 
       Msg.info("goodbye!");
     }
 
       Msg.info("goodbye!");
     }
index 0bd91aa..8f3b6b7 100644 (file)
@@ -7,55 +7,34 @@ import java.util.HashMap;
 public class ReservationPlugin extends Plugin {
 
   public ReservationPlugin() {
 public class ReservationPlugin extends Plugin {
 
   public ReservationPlugin() {
-    activateCpuCreatedCallback();
-    activateCpuDestructedCallback();
-    activateCpuStateChangedCallback();
-    activateCpuActionStateChangedCallback();
-
-    activateNetworkLinkCreatedCallback();
-    activateNetworkLinkDestructedCallback();
-    activateNetworkLinkStateChangedCallback();
-    activateNetworkActionStateChangedCallback();
-
-  }
-
-  public void init() {
-    NetworkLink[] route = Surf.getRoute("Jacquelin", "Boivin");
-    Msg.info("RouteLength:"+route.length);
-    Msg.info("RouteName0:"+route[0].getName());
-    Msg.info("RouteName1:"+route[1].getName());
+    activateNetworkCommunicateCallback();
   }
 
   }
 
-  public void cpuCreatedCallback(Cpu cpu) {
-    Msg.info("Trace: Cpu created "+cpu.getName());
-  }
-
-  public void cpuDestructedCallback(Cpu cpu) {
-    Msg.info("Trace: Cpu destructed "+cpu.getName());
-  }
-
-  public void cpuStateChangedCallback(Cpu cpu){
-    Msg.info("Trace: Cpu state changed "+cpu.getName());
-  }
-
-  public void cpuActionStateChangedCallback(CpuAction action){
-    Msg.info("Trace: CpuAction state changed "+action.getModel().getName());
-  }
-
-  public void networkLinkCreatedCallback(NetworkLink link) {
-    Msg.info("Trace: NetworkLink created "+link.getName());
-  }
+  //HashMap<String,Reservation> reservations;
+  double bandwidth = 0;
+  String src = "";
+  String dst = "";
 
 
-  public void networkLinkDestructedCallback(NetworkLink link) {
-    Msg.info("Trace: NetworkLink destructed "+link.getName());
+  public void limitBandwidthActions(String src, String dst, double bandwidth){
+    this.bandwidth = bandwidth;
+    this.src = src;
+    this.dst = dst;
   }
 
   }
 
-  public void networkLinkStateChangedCallback(NetworkLink link){
-    Msg.info("Trace: NetworkLink state changed "+link.getName());
+  public void updateBandwidthRoute(String src, String dst, double bandwidth){
+    NetworkLink[] 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();
+      Msg.info("Trace: bandwidth of "+route[i].getName()+" after "+route[i].getBandwidth());
+    }
   }
 
   }
 
-  public void networkActionStateChangedCallback(NetworkAction action){
-    Msg.info("Trace: NetworkAction state changed "+action.getModel().getName());
+  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 6f5ccf4..5f6ca38 100644 (file)
@@ -23,33 +23,31 @@ public class Sender extends Process {
 
        Msg.info("helloo!");
 
 
        Msg.info("helloo!");
 
-       int hostCount = args.length;
-
-       Msg.info("host count: " + hostCount);
-       String mailboxes[] = new String[hostCount];
-       double time;
+       String receiverName = args[0];
+       double oldTime, curTime;
        double computeDuration = 10000;
        Task task;
 
        double computeDuration = 10000;
        Task task;
 
-       for(int pos = 0; pos < args.length ; pos++) {
-         try {
-            mailboxes[pos] = Host.getByName(args[pos]).getName();
-         } catch (HostNotFoundException e) {
-            Msg.info("Invalid deployment file: " + e.toString());
-            System.exit(1);
-         }
-        }
-
-        for (int pos = 0; pos < hostCount; pos++) {
-          time = Msg.getClock();
-
-          Msg.info("sender time: " + time);
-
-          task = new Task("no name",computeDuration,commSizeLat);
-
-          task.send(mailboxes[pos]);
-        }
-
-        Msg.info("goodbye!");
+       oldTime = Msg.getClock();
+            task = new Task("no name",computeDuration,commSizeLat);
+            task.send(receiverName);
+       curTime = Msg.getClock();
+       Msg.info("Send duration: " + (curTime - oldTime));
+
+       TestPlugin.tp.updateBandwidthRoute("Jacquelin", "Boivin", 10E2);
+       oldTime = curTime;
+       task = new Task("no name",computeDuration,commSizeLat);
+       task.send(receiverName);
+       curTime = Msg.getClock();
+       Msg.info("Send duration with update bandwidth: " + (curTime - oldTime));
+
+       TestPlugin.tp.limitBandwidthActions("Jacquelin", "Boivin", 10E1);
+       oldTime = curTime;
+       task = new Task("no name",computeDuration,commSizeLat);
+       task.send(receiverName);
+       curTime = Msg.getClock();
+       Msg.info("Send normal duration with limited bandwidth: " + (curTime - oldTime));
+
+       Msg.info("goodbye!");
     }
 }
     }
 }
index cedbb04..64e0a6c 100644 (file)
@@ -16,7 +16,7 @@ public class TestPlugin {
   *   java simgrid.msg.Msg
   * which also contains such a launcher
   */
   *   java simgrid.msg.Msg
   * which also contains such a launcher
   */
-  static ReservationPlugin tp = new ReservationPlugin();
+  public static ReservationPlugin tp = new ReservationPlugin();
 
   public static void main(String[] args) throws NativeException {
     /* initialize the MSG simulation. Must be done before anything else (even logging). */
 
   public static void main(String[] args) throws NativeException {
     /* initialize the MSG simulation. Must be done before anything else (even logging). */
@@ -26,10 +26,12 @@ public class TestPlugin {
       Msg.info("example : TestPlugin ping_pong_platform.xml ping_pong_deployment.xml");
       System.exit(1);
     }
       Msg.info("example : TestPlugin ping_pong_platform.xml ping_pong_deployment.xml");
       System.exit(1);
     }
+
     /* construct the platform and deploy the application */
     Msg.createEnvironment(args[0]);
     Msg.deployApplication(args[1]);
     /* construct the platform and deploy the application */
     Msg.createEnvironment(args[0]);
     Msg.deployApplication(args[1]);
-    tp.init();
+
+
 
     // getName());
     /*  execute the simulation. */
 
     // getName());
     /*  execute the simulation. */
index 9101480..c238e1e 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version='1.0'?>
 <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 <platform version="3">
 <?xml version='1.0'?>
 <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
 <platform version="3">
-  <process host="Jacquelin" function="surfPlugin.Sender">
+  <process host="Jacquelin" function="reservationSurfPlugin.Sender">
       <argument value="Boivin"/>
   </process>
       <argument value="Boivin"/>
   </process>
-<process host="Boivin" function="surfPlugin.Receiver"/>
+<process host="Boivin" function="reservationSurfPlugin.Receiver"/>
 </platform>
 </platform>
index 2712607..155dd2d 100644 (file)
@@ -5,9 +5,9 @@
    <host id="Jacquelin" power="137.333Mf"/>
    <host id="Boivin" power="98.095Mf"/>
    <host id="TeX" power="68.667Mf"/>
    <host id="Jacquelin" power="137.333Mf"/>
    <host id="Boivin" power="98.095Mf"/>
    <host id="TeX" power="68.667Mf"/>
-   <link id="link0" bandwidth="1MBps" latency="100ms"/>
-   <link id="link1" bandwidth="1MBps" latency="100ms"/>
-   <link id="link2" bandwidth="1MBps" latency="100ms"/>
+   <link id="link0" bandwidth="1MBps" latency="1ms"/>
+   <link id="link1" bandwidth="1MBps" latency="1ms"/>
+   <link id="link2" bandwidth="1MBps" latency="1ms"/>
    <route src="Jacquelin" dst="Boivin">
      <link_ctn id="link0"/>
      <link_ctn id="link1"/>
    <route src="Jacquelin" dst="Boivin">
      <link_ctn id="link0"/>
      <link_ctn id="link1"/>
index 012094f..3d2e4b2 100644 (file)
@@ -2,26 +2,18 @@
 
 $ java -classpath ${classpath:=.} reservationSurfPlugin/TestPlugin ${srcdir:=.}/reservationSurfPlugin/reservationSurfPluginPlatform.xml ${srcdir:=.}/reservationSurfPlugin/reservationSurfPluginDeployment.xml
 > [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up.
 
 $ java -classpath ${classpath:=.} reservationSurfPlugin/TestPlugin ${srcdir:=.}/reservationSurfPlugin/reservationSurfPluginPlatform.xml ${srcdir:=.}/reservationSurfPlugin/reservationSurfPluginDeployment.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: Cpu created Jacquelin
-> [0.000000] [jmsg/INFO] Trace: Cpu state changed Jacquelin
-> [0.000000] [jmsg/INFO] Trace: Cpu created Boivin
-> [0.000000] [jmsg/INFO] Trace: Cpu state changed Boivin
-> [0.000000] [jmsg/INFO] Trace: NetworkLink created link
-> [0.000000] [jmsg/INFO] Trace: NetworkLink state changed link
-> [Jacquelin:surfPlugin.Sender:(1) 0.000000] [jmsg/INFO] helloo!
-> [Jacquelin:surfPlugin.Sender:(1) 0.000000] [jmsg/INFO] host count: 1
-> [Jacquelin:surfPlugin.Sender:(1) 0.000000] [jmsg/INFO] sender time: 0.0
-> [Boivin:surfPlugin.Receiver:(2) 0.000000] [jmsg/INFO] helloo!
-> [Boivin:surfPlugin.Receiver:(2) 0.000000] [jmsg/INFO] try to get a task
-> [1.301001] [jmsg/INFO] Trace: NetworkAction state changed network
-> [Boivin:surfPlugin.Receiver:(2) 1.301001] [jmsg/INFO] Got at time 1.3010010824742269
-> [Jacquelin:surfPlugin.Sender:(1) 1.301001] [jmsg/INFO] goodbye!
-> [1.301103] [jmsg/INFO] Trace: CpuAction state changed cpu
-> [Boivin:surfPlugin.Receiver:(2) 1.301103] [jmsg/INFO] goodbye!
-> [1.301103] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
-> [1.301103] [jmsg/INFO] Trace: Cpu destructed Jacquelin
-> [1.301103] [jmsg/INFO] Trace: Cpu destructed Boivin
-> [1.301103] [jmsg/INFO] Trace: NetworkLink destructed link
-> [1.301103] [jmsg/INFO] Trace: NetworkLink destructed __loopback__
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.000000] [jmsg/INFO] helloo!
+> [Boivin:reservationSurfPlugin.Receiver:(2) 0.000000] [jmsg/INFO] helloo!
+> [0.000000] [jmsg/INFO] Trace: Communicate message of size 1.0 with rate -1.0 and bound 1.048576E9 from Jacquelin to Boivin
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Send duration: 0.026021082474226805
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Trace: bandwidth of link0 before 1000000.0
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Trace: bandwidth of link0 after 1000.0
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Trace: bandwidth of link1 before 1000000.0
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.026021] [jmsg/INFO] Trace: bandwidth of link1 after 1000.0
+> [0.026021] [jmsg/INFO] Trace: Communicate message of size 1.0 with rate -1.0 and bound 1.048576E9 from Jacquelin to Boivin
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.053124] [jmsg/INFO] Send duration with update bandwidth: 0.027102474226804125
+> [0.053124] [jmsg/INFO] Trace: Communicate message of size 1.0 with rate -1.0 and bound 100.0 from Jacquelin to Boivin
+> [Boivin:reservationSurfPlugin.Receiver:(2) 0.089144] [jmsg/INFO] goodbye!
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.089144] [jmsg/INFO] Send normal duration with limited bandwidth: 0.036019999999999996
+> [Jacquelin:reservationSurfPlugin.Sender:(1) 0.089144] [jmsg/INFO] goodbye!
+> [0.089144] [jmsg/INFO] MSG_main finished; Cleaning up the simulation...
index 6de1823..0d1fec4 100644 (file)
@@ -26,11 +26,11 @@ public class TracePlugin extends Plugin {
     Msg.info("Trace: Cpu destructed "+cpu.getName());
   }
 
     Msg.info("Trace: Cpu destructed "+cpu.getName());
   }
 
-  public void cpuStateChangedCallback(Cpu cpu){
+  public void cpuStateChangedCallback(Cpu cpu, ResourceState old, ResourceState cur){
     Msg.info("Trace: Cpu state changed "+cpu.getName());
   }
 
     Msg.info("Trace: Cpu state changed "+cpu.getName());
   }
 
-  public void cpuActionStateChangedCallback(CpuAction action){
+  public void cpuActionStateChangedCallback(CpuAction action, ActionState old, ActionState cur){
     Msg.info("Trace: CpuAction state changed "+action.getModel().getName());
   }
 
     Msg.info("Trace: CpuAction state changed "+action.getModel().getName());
   }
 
@@ -42,11 +42,11 @@ public class TracePlugin extends Plugin {
     Msg.info("Trace: NetworkLink destructed "+link.getName());
   }
 
     Msg.info("Trace: NetworkLink destructed "+link.getName());
   }
 
-  public void networkLinkStateChangedCallback(NetworkLink link){
+  public void networkLinkStateChangedCallback(NetworkLink link, ResourceState old, ResourceState cur){
     Msg.info("Trace: NetworkLink state changed "+link.getName());
   }
 
     Msg.info("Trace: NetworkLink state changed "+link.getName());
   }
 
-  public void networkActionStateChangedCallback(NetworkAction action){
+  public void networkActionStateChangedCallback(NetworkAction action, ActionState old, ActionState cur){
     Msg.info("Trace: NetworkAction state changed "+action.getModel().getName());
   }
 
     Msg.info("Trace: NetworkAction state changed "+action.getModel().getName());
   }
 
index 504b90e..85cd2ce 100644 (file)
@@ -2,7 +2,7 @@
 
 ! expect signal SIGABRT
 ! timeout 20
 
 ! expect signal SIGABRT
 ! timeout 20
-$ ${bindir:=.}/bugged1 --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/bugged1 --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/stack_size:256
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) Check a safety property
 > [  0.000000] (0:@) Get debug information ...
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) Check a safety property
 > [  0.000000] (0:@) Get debug information ...
index fd34555..ff3cd79 100644 (file)
@@ -2,7 +2,7 @@
 
 ! expect signal SIGABRT
 ! timeout 20
 
 ! expect signal SIGABRT
 ! timeout 20
-$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../msg_platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext
+$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../msg_platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=contexts/stack_size:256
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) Check the liveness property promela_bugged1_liveness
 > [  0.000000] (0:@) Get debug information ...
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) Check the liveness property promela_bugged1_liveness
 > [  0.000000] (0:@) Get debug information ...
index f117bb4..4775fdc 100644 (file)
@@ -2,7 +2,7 @@
 
 ! expect signal SIGABRT
 ! timeout 90
 
 ! expect signal SIGABRT
 ! timeout 90
-$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../msg_platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100
+$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../msg_platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100 --cfg=contexts/stack_size:256
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) Configuration change: Set 'model-check/visited' to '100'
 > [  0.000000] (0:@) Check the liveness property promela_bugged1_liveness
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) Configuration change: Set 'model-check/visited' to '100'
 > [  0.000000] (0:@) Check the liveness property promela_bugged1_liveness
index 3d65e67..d3d7eec 100644 (file)
@@ -2,7 +2,7 @@
 
 ! expect signal SIGABRT
 ! timeout 20
 
 ! expect signal SIGABRT
 ! timeout 20
-$ ${bindir:=.}/bugged2 --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/bugged2 --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/stack_size:256
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) Check a safety property
 > [  0.000000] (0:@) Get debug information ...
 > [  0.000000] (0:@) Configuration change: Set 'model-check' to '1'
 > [  0.000000] (0:@) Check a safety property
 > [  0.000000] (0:@) Get debug information ...
index 9afad64..7420e84 100644 (file)
@@ -25,12 +25,14 @@ if(enable_smpi)
     add_executable(mc/bugged1_liveness mc/bugged1_liveness.c)
     add_executable(mc/send_deterministic mc/send_deterministic.c)
     add_executable(mc/non_deterministic mc/non_deterministic.c)
     add_executable(mc/bugged1_liveness mc/bugged1_liveness.c)
     add_executable(mc/send_deterministic mc/send_deterministic.c)
     add_executable(mc/non_deterministic mc/non_deterministic.c)
+    add_executable(mc/mutual_exclusion mc/mutual_exclusion.c)
   
     target_link_libraries(mc/bugged1 simgrid)
     target_link_libraries(mc/bugged2 simgrid)
     target_link_libraries(mc/bugged1_liveness simgrid)
     target_link_libraries(mc/send_deterministic simgrid)
     target_link_libraries(mc/non_deterministic simgrid)
   
     target_link_libraries(mc/bugged1 simgrid)
     target_link_libraries(mc/bugged2 simgrid)
     target_link_libraries(mc/bugged1_liveness simgrid)
     target_link_libraries(mc/send_deterministic simgrid)
     target_link_libraries(mc/non_deterministic simgrid)
+    target_link_libraries(mc/mutual_exclusion simgrid)
   endif()
   
   target_link_libraries(bcbench simgrid)
   endif()
   
   target_link_libraries(bcbench simgrid)
@@ -64,6 +66,7 @@ set(examples_src
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/bugged1_liveness.c
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/send_deterministic.c
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/non_deterministic.c
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/bugged1_liveness.c
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/send_deterministic.c
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/non_deterministic.c
+  ${CMAKE_CURRENT_SOURCE_DIR}/mc/mutual_exclusion.c
   PARENT_SCOPE
   )
 set(bin_files
   PARENT_SCOPE
   )
 set(bin_files
@@ -75,6 +78,7 @@ set(bin_files
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_bugged2
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_send_deterministic
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_non_deterministic
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_bugged2
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_send_deterministic
   ${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_non_deterministic
+  ${CMAKE_CURRENT_SOURCE_DIR}/mc/hostfile_mutual_exclusion     
   PARENT_SCOPE
   )
 set(txt_files
   PARENT_SCOPE
   )
 set(txt_files
diff --git a/examples/smpi/mc/hostfile_mutual_exclusion b/examples/smpi/mc/hostfile_mutual_exclusion
new file mode 100644 (file)
index 0000000..b6d1c07
--- /dev/null
@@ -0,0 +1,3 @@
+c-1.me
+c-2.me
+c-3.me
diff --git a/examples/smpi/mc/mutual_exclusion.c b/examples/smpi/mc/mutual_exclusion.c
new file mode 100644 (file)
index 0000000..a917060
--- /dev/null
@@ -0,0 +1,72 @@
+#include <stdio.h>
+#include <mpi.h>
+#include <simgrid/modelchecker.h>
+
+#define GRANT_TAG 0
+#define REQUEST_TAG 1
+#define RELEASE_TAG 2
+
+int main(int argc, char **argv){
+
+  int err, size, rank;
+  int recv_buff;
+  MPI_Status status;
+  int CS_used = 0;
+  xbt_dynar_t requests = xbt_dynar_new(sizeof(int), NULL);
+  
+  /* Initialize MPI */
+  err = MPI_Init(&argc, &argv);
+  if(err !=  MPI_SUCCESS){
+    printf("MPI initialization failed !\n");
+    exit(1);
+  }
+
+  MC_ignore(&(status.count), sizeof(status.count));
+
+  /* Get number of processes */
+  err = MPI_Comm_size(MPI_COMM_WORLD, &size);
+  /* Get id of this process */
+  err = MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+
+  if(rank == 0){ /* Coordinator */
+    while(1){
+      MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
+      if(status.MPI_TAG == REQUEST_TAG){
+        if(CS_used){
+          printf("CS already used. Queue the request.\n");
+          xbt_dynar_push(requests, &recv_buff);
+        }else{
+          printf("CS idle. Grant immediatly.\n");
+          MPI_Send(&rank, 1, MPI_INT, recv_buff, GRANT_TAG, MPI_COMM_WORLD);
+          CS_used = 1;
+        }
+      }else{
+        if(!xbt_dynar_is_empty(requests)){
+          printf("CS release. Grant to queued requests (queue size: %lu)",
+              xbt_dynar_length(requests));
+          xbt_dynar_shift(requests, &recv_buff);
+          MPI_Send(&rank, 1, MPI_INT, recv_buff, GRANT_TAG, MPI_COMM_WORLD);
+          CS_used = 1;
+        }else{
+          printf("CS release. Resource now idle.\n");
+          CS_used = 0;
+        }
+      }
+    }
+  }else{ /* Client */
+    while(1){
+      printf("%d asks the request.\n", rank);
+      MPI_Send(&rank, 1, MPI_INT, 0, REQUEST_TAG, MPI_COMM_WORLD);
+    
+      MPI_Recv(&recv_buff, 1, MPI_INT, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
+    
+      printf("%d got the answer. Release it.\n", rank);
+      MPI_Send(&rank, 1, MPI_INT, 0, RELEASE_TAG, MPI_COMM_WORLD);
+    
+    }
+  }
+
+  MPI_Finalize();
+
+  return 0;
+}
index d860b98..91e75dc 100644 (file)
@@ -40,9 +40,14 @@ JAVA_ARRAYSOFCLASSES(NetworkLink);
 %typemap(out) NetworkLinkDynar {
   long l = xbt_dynar_length($1);
   $result = jenv->NewLongArray(l);
 %typemap(out) NetworkLinkDynar {
   long l = xbt_dynar_length($1);
   $result = jenv->NewLongArray(l);
-  NetworkLink **lout = (NetworkLink **)xbt_dynar_to_array($1);
-  jenv->SetLongArrayRegion($result, 0, l, (const jlong*)lout);
-  free(lout);
+  unsigned i;
+  NetworkLink *link;
+  jlong *elts = jenv->GetLongArrayElements($result, NULL);
+  xbt_dynar_foreach($1, i, link) {
+    elts[i] = (jlong)link;
+  }
+  jenv->ReleaseLongArrayElements($result, elts, 0);
+  xbt_dynar_free(&$1);
 }
 
 /* Allow to subclass Plugin and send java object to C++ code */
 }
 
 /* Allow to subclass Plugin and send java object to C++ code */
@@ -76,11 +81,18 @@ class NetworkLink : public Resource {
 public:
   NetworkLink();
   ~NetworkLink();
 public:
   NetworkLink();
   ~NetworkLink();
+  double getBandwidth();
+  void updateBandwidth(double value, double date=surf_get_clock());
+  double getLatency();
+  void updateLatency(double value, double date=surf_get_clock());
 };
 
 class Action {
 public:
   Model *getModel();
 };
 
 class Action {
 public:
   Model *getModel();
+  lmm_variable *getVariable();
+  double getBound();
+  void setBound(double bound);
 };
 
 class CpuAction : public Action {
 };
 
 class CpuAction : public Action {
@@ -98,6 +110,12 @@ public:
 }
 };
 
 }
 };
 
+%nodefaultctor RoutingEdge;
+class RoutingEdge {
+public:
+  virtual char *getName()=0;
+};
+
 %rename lmm_constraint LmmConstraint;
 struct lmm_constraint {
 %extend {
 %rename lmm_constraint LmmConstraint;
 struct lmm_constraint {
 %extend {
@@ -105,9 +123,33 @@ struct lmm_constraint {
 }
 };
 
 }
 };
 
+%rename lmm_variable LmmVariable;
+struct lmm_variable {
+%extend {
+  double getValue() {return lmm_variable_getvalue($self);}
+}
+};
+
 %rename s_xbt_dict XbtDict;
 struct s_xbt_dict {
 %extend {
   char *getValue(char *key) {return (char*)xbt_dict_get_or_null($self, key);}
 }
 };
 %rename s_xbt_dict XbtDict;
 struct s_xbt_dict {
 %extend {
   char *getValue(char *key) {return (char*)xbt_dict_get_or_null($self, key);}
 }
 };
+
+%rename e_surf_action_state_t ActionState;
+typedef enum {
+  SURF_ACTION_READY = 0,        /**< Ready        */
+  SURF_ACTION_RUNNING,          /**< Running      */
+  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 ? */
+} e_surf_action_state_t;
+
+%rename e_surf_resource_state_t ResourceState;
+typedef enum {
+  SURF_RESOURCE_ON = 1,                   /**< Up & ready        */
+  SURF_RESOURCE_OFF = 0                   /**< Down & broken     */
+} e_surf_resource_state_t;
index 32f557f..88f0ee6 100644 (file)
@@ -24,7 +24,6 @@ NetworkLinkDynar getRoute(char *srcName, char *dstName) {
     xbt_die("TOTO");
   if (dst==NULL)
     xbt_die("TOTO");
     xbt_die("TOTO");
   if (dst==NULL)
     xbt_die("TOTO");
-  printf("src: %s\ndst: %s\n", src->getName(), dst->getName());
   xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdgePtr), NULL);
   routing_platf->getRouteAndLatency(src, dst, &route, NULL);
   return route;
   xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdgePtr), NULL);
   routing_platf->getRouteAndLatency(src, dst, &route, NULL);
   return route;
@@ -39,11 +38,11 @@ void Plugin::activateCpuDestructedCallback(){
 }
 
 void Plugin::activateCpuStateChangedCallback(){
 }
 
 void Plugin::activateCpuStateChangedCallback(){
-  surf_callback_connect(cpuStateChangedCallbacks, boost::bind(&Plugin::cpuStateChangedCallback, this, _1));
+  surf_callback_connect(cpuStateChangedCallbacks, boost::bind(&Plugin::cpuStateChangedCallback, this, _1, _2, _3));
 }
 
 void Plugin::activateCpuActionStateChangedCallback(){
 }
 
 void Plugin::activateCpuActionStateChangedCallback(){
-  surf_callback_connect(cpuActionStateChangedCallbacks, boost::bind(&Plugin::cpuActionStateChangedCallback, this, _1));
+  surf_callback_connect(cpuActionStateChangedCallbacks, boost::bind(&Plugin::cpuActionStateChangedCallback, this, _1, _2, _3));
 }
 
 
 }
 
 
@@ -56,11 +55,16 @@ void Plugin::activateNetworkLinkDestructedCallback(){
 }
 
 void Plugin::activateNetworkLinkStateChangedCallback(){
 }
 
 void Plugin::activateNetworkLinkStateChangedCallback(){
-  surf_callback_connect(networkLinkStateChangedCallbacks, boost::bind(&Plugin::networkLinkStateChangedCallback, this, _1));
+  surf_callback_connect(networkLinkStateChangedCallbacks, boost::bind(&Plugin::networkLinkStateChangedCallback, this, _1, _2, _3));
 }
 
 void Plugin::activateNetworkActionStateChangedCallback(){
 }
 
 void Plugin::activateNetworkActionStateChangedCallback(){
-  surf_callback_connect(networkActionStateChangedCallbacks, boost::bind(&Plugin::networkActionStateChangedCallback, this, _1));
+  surf_callback_connect(networkActionStateChangedCallbacks, boost::bind(&Plugin::networkActionStateChangedCallback, this, _1, _2, _3));
 }
 
 }
 
+void Plugin::activateNetworkCommunicateCallback(){
+  surf_callback_connect(networkCommunicateCallbacks, boost::bind(&Plugin::networkCommunicateCallback, this, _1, _2, _3, _4, _5));
+}
+
+
 
 
index 1c51c7b..a7e7024 100644 (file)
@@ -25,10 +25,10 @@ public:
  virtual void cpuDestructedCallback(Cpu *cpu) {}
 
  void activateCpuStateChangedCallback();
  virtual void cpuDestructedCallback(Cpu *cpu) {}
 
  void activateCpuStateChangedCallback();
- virtual void cpuStateChangedCallback(Cpu *cpu) {}
+ virtual void cpuStateChangedCallback(Cpu *cpu, e_surf_resource_state_t, e_surf_resource_state_t) {}
 
  void activateCpuActionStateChangedCallback();
 
  void activateCpuActionStateChangedCallback();
- virtual void cpuActionStateChangedCallback(CpuAction *action) {}
+ virtual void cpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t, e_surf_action_state_t) {}
 
 
  void activateNetworkLinkCreatedCallback();
 
 
  void activateNetworkLinkCreatedCallback();
@@ -38,11 +38,11 @@ public:
  virtual void networkLinkDestructedCallback(NetworkLink *link) {}
 
  void activateNetworkLinkStateChangedCallback();
  virtual void networkLinkDestructedCallback(NetworkLink *link) {}
 
  void activateNetworkLinkStateChangedCallback();
- virtual void networkLinkStateChangedCallback(NetworkLink *link) {}
+ virtual void networkLinkStateChangedCallback(NetworkLink *link, e_surf_resource_state_t, e_surf_resource_state_t) {}
 
  void activateNetworkActionStateChangedCallback();
 
  void activateNetworkActionStateChangedCallback();
- virtual void networkActionStateChangedCallback(NetworkAction *action) {}
+ virtual void networkActionStateChangedCallback(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t cur) {}
 
 
+ void activateNetworkCommunicateCallback();
+ virtual void networkCommunicateCallback(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate) {}
 };
 };
-
-
index cece2e8..e482c42 100644 (file)
@@ -323,8 +323,13 @@ static xbt_dynar_t MC_unwind_stack_frames(void *stack_context) {
 
   unw_cursor_t c;
 
 
   unw_cursor_t c;
 
-  int ret;
-  for(ret = unw_init_local(&c, (unw_context_t *)stack_context); ret >= 0; ret = unw_step(&c)){
+  // TODO, check condition check (unw_init_local==0 means end of frame)
+  if(unw_init_local(&c, (unw_context_t *)stack_context)!=0) {
+
+    xbt_die("Could not initialize stack unwinding");
+
+  } else while(1) {
+
     mc_stack_frame_t stack_frame = xbt_new(s_mc_stack_frame_t, 1);
     xbt_dynar_push(result, &stack_frame);
 
     mc_stack_frame_t stack_frame = xbt_new(s_mc_stack_frame_t, 1);
     xbt_dynar_push(result, &stack_frame);
 
@@ -348,11 +353,19 @@ static xbt_dynar_t MC_unwind_stack_frames(void *stack_context) {
       stack_frame->frame_base = (unw_word_t)mc_find_frame_base(frame, frame->object_info, &c);
     } else {
       stack_frame->frame_base = 0;
       stack_frame->frame_base = (unw_word_t)mc_find_frame_base(frame, frame->object_info, &c);
     } else {
       stack_frame->frame_base = 0;
+      stack_frame->frame_name = NULL;
     }
 
     /* Stop before context switch with maestro */
     if(frame!=NULL && frame->name!=NULL && !strcmp(frame->name, "smx_ctx_sysv_wrapper"))
       break;
     }
 
     /* Stop before context switch with maestro */
     if(frame!=NULL && frame->name!=NULL && !strcmp(frame->name, "smx_ctx_sysv_wrapper"))
       break;
+
+    int ret = ret = unw_step(&c);
+    if(ret==0) {
+      xbt_die("Unexpected end of stack.");
+    } else if(ret<0) {
+      xbt_die("Error while unwinding stack.");
+    }
   }
 
   if(xbt_dynar_length(result) == 0){
   }
 
   if(xbt_dynar_length(result) == 0){
index 2533500..b24af22 100644 (file)
@@ -4,6 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdlib.h>
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdlib.h>
+#define DW_LANG_Objc DW_LANG_ObjC /* fix spelling error in older dwarf.h */
 #include <dwarf.h>
 #include <elfutils/libdw.h>
 #include <inttypes.h>
 #include <dwarf.h>
 #include <elfutils/libdw.h>
 #include <inttypes.h>
@@ -453,8 +454,8 @@ static void MC_dwarf_fill_member_location(dw_type_t type, dw_type_t member, Dwar
   if (!dwarf_hasattr_integrate(child, DW_AT_data_member_location)) {
     if (type->type != DW_TAG_union_type) {
         xbt_die(
   if (!dwarf_hasattr_integrate(child, DW_AT_data_member_location)) {
     if (type->type != DW_TAG_union_type) {
         xbt_die(
-          "Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%p>%s",
-          member->name, type->id, type->name);
+          "Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%"PRIx64">%s",
+          member->name, (uint64_t) type->id, type->name);
     } else {
       return;
     }
     } else {
       return;
     }
@@ -473,9 +474,9 @@ static void MC_dwarf_fill_member_location(dw_type_t type, dw_type_t member, Dwar
       size_t len;
       if (dwarf_getlocation(&attr, &expr, &len)) {
         xbt_die(
       size_t len;
       if (dwarf_getlocation(&attr, &expr, &len)) {
         xbt_die(
-          "Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%p>%s",
+          "Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%"PRIx64">%s",
           MC_dwarf_attr_integrate_string(child, DW_AT_name),
           MC_dwarf_attr_integrate_string(child, DW_AT_name),
-          type->id, type->name);
+          (uint64_t) type->id, type->name);
       }
       if (len==1 && expr[0].atom == DW_OP_plus_uconst) {
         member->offset =  expr[0].number;
       }
       if (len==1 && expr[0].atom == DW_OP_plus_uconst) {
         member->offset =  expr[0].number;
@@ -491,9 +492,9 @@ static void MC_dwarf_fill_member_location(dw_type_t type, dw_type_t member, Dwar
       if (!dwarf_formudata(&attr, &offset))
         member->offset = offset;
       else
       if (!dwarf_formudata(&attr, &offset))
         member->offset = offset;
       else
-        xbt_die("Cannot get %s location <%p>%s",
+        xbt_die("Cannot get %s location <%"PRIx64">%s",
           MC_dwarf_attr_integrate_string(child, DW_AT_name),
           MC_dwarf_attr_integrate_string(child, DW_AT_name),
-          type->id, type->name);
+          (uint64_t) type->id, type->name);
       break;
     }
   case MC_DW_CLASS_LOCLISTPTR:
       break;
     }
   case MC_DW_CLASS_LOCLISTPTR:
@@ -543,7 +544,7 @@ static void MC_dwarf_add_members(mc_object_info_t info, Dwarf_Die* die, Dwarf_Di
       member->type = tag;
 
       // Global Offset:
       member->type = tag;
 
       // Global Offset:
-      member->id = (void *) dwarf_dieoffset(&child);
+      member->id = dwarf_dieoffset(&child);
 
       const char* name = MC_dwarf_attr_integrate_string(&child, DW_AT_name);
       if(name)
 
       const char* name = MC_dwarf_attr_integrate_string(&child, DW_AT_name);
       if(name)
@@ -565,7 +566,7 @@ static void MC_dwarf_add_members(mc_object_info_t info, Dwarf_Die* die, Dwarf_Di
       MC_dwarf_fill_member_location(type, member, &child);
 
       if (!member->dw_type_id) {
       MC_dwarf_fill_member_location(type, member, &child);
 
       if (!member->dw_type_id) {
-        xbt_die("Missing type for member %s of <%p>%s", member->name, type->id, type->name);
+        xbt_die("Missing type for member %s of <%"PRIx64">%s", member->name, (uint64_t) type->id, type->name);
       }
 
       xbt_dynar_push(type->members, &member);
       }
 
       xbt_dynar_push(type->members, &member);
@@ -584,7 +585,7 @@ static dw_type_t MC_dwarf_die_to_type(mc_object_info_t info, Dwarf_Die* die, Dwa
 
   dw_type_t type = xbt_new0(s_dw_type_t, 1);
   type->type = -1;
 
   dw_type_t type = xbt_new0(s_dw_type_t, 1);
   type->type = -1;
-  type->id = NULL;
+  type->id = 0;
   type->name = NULL;
   type->byte_size = 0;
   type->element_count = -1;
   type->name = NULL;
   type->byte_size = 0;
   type->element_count = -1;
@@ -596,7 +597,7 @@ static dw_type_t MC_dwarf_die_to_type(mc_object_info_t info, Dwarf_Die* die, Dwa
   type->type = dwarf_tag(die);
 
   // Global Offset
   type->type = dwarf_tag(die);
 
   // Global Offset
-  type->id = (void *) dwarf_dieoffset(die);
+  type->id = dwarf_dieoffset(die);
 
   const char* prefix = "";
   switch (type->type) {
 
   const char* prefix = "";
   switch (type->type) {
@@ -618,8 +619,6 @@ static dw_type_t MC_dwarf_die_to_type(mc_object_info_t info, Dwarf_Die* die, Dwa
     type->name = namespace ? bprintf("%s%s::%s", prefix, namespace, name) : bprintf("%s%s", prefix, name);
   }
 
     type->name = namespace ? bprintf("%s%s::%s", prefix, namespace, name) : bprintf("%s%s", prefix, name);
   }
 
-  XBT_DEBUG("Processing type <%p>%s", type->id, type->name);
-
   type->dw_type_id = MC_dwarf_at_type(die);
 
   // Computation of the byte_size;
   type->dw_type_id = MC_dwarf_at_type(die);
 
   // Computation of the byte_size;
@@ -708,14 +707,14 @@ static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, D
       size_t len;
       if (dwarf_getlocation(&attr_location, &expr, &len)) {
         xbt_die(
       size_t len;
       if (dwarf_getlocation(&attr_location, &expr, &len)) {
         xbt_die(
-          "Could not read location expression in DW_AT_location of variable <%p>%s",
-          (void*) variable->dwarf_offset, variable->name);
+          "Could not read location expression in DW_AT_location of variable <%"PRIx64">%s",
+          (uint64_t) variable->dwarf_offset, variable->name);
       }
 
       if (len==1 && expr[0].atom == DW_OP_addr) {
         variable->global = 1;
       }
 
       if (len==1 && expr[0].atom == DW_OP_addr) {
         variable->global = 1;
-        Dwarf_Off offset = expr[0].number;
-        Dwarf_Off base = (Dwarf_Off) MC_object_base_address(info);
+        uintptr_t offset = (uintptr_t) expr[0].number;
+        uintptr_t base   = (uintptr_t) MC_object_base_address(info);
         variable->address = (void*) (base + offset);
       } else {
         mc_dwarf_location_list_init_from_expression(&variable->locations, len, expr);
         variable->address = (void*) (base + offset);
       } else {
         mc_dwarf_location_list_init_from_expression(&variable->locations, len, expr);
@@ -729,8 +728,8 @@ static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, D
     mc_dwarf_location_list_init(&variable->locations, info, die, &attr_location);
     break;
   default:
     mc_dwarf_location_list_init(&variable->locations, info, die, &attr_location);
     break;
   default:
-    xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location in <%p>%s",
-      form, form, klass, klass, (void*) variable->dwarf_offset, variable->name);
+    xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location in <%"PRIx64">%s",
+      form, form, klass, klass, (uint64_t) variable->dwarf_offset, variable->name);
   }
 
   // Handle start_scope:
   }
 
   // Handle start_scope:
@@ -746,6 +745,7 @@ static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, D
       variable->start_scope = dwarf_formudata(&attr, &value) == 0 ? (size_t) value : 0;
       break;
     }
       variable->start_scope = dwarf_formudata(&attr, &value) == 0 ? (size_t) value : 0;
       break;
     }
+    case MC_DW_CLASS_RANGELISTPTR: // TODO
     default:
       xbt_die("Unhandled form 0x%x, class 0x%X for DW_AT_start_scope of variable %s",
         form, klass, name==NULL ? "?" : name);
     default:
       xbt_die("Unhandled form 0x%x, class 0x%X for DW_AT_start_scope of variable %s",
         form, klass, name==NULL ? "?" : name);
@@ -811,29 +811,40 @@ static void MC_dwarf_handle_scope_die(mc_object_info_t info, Dwarf_Die* die, Dwa
 
   // Variables are filled in the (recursive) call of MC_dwarf_handle_children:
   frame->variables = xbt_dynar_new(sizeof(dw_variable_t), dw_variable_free_voidp);
 
   // Variables are filled in the (recursive) call of MC_dwarf_handle_children:
   frame->variables = xbt_dynar_new(sizeof(dw_variable_t), dw_variable_free_voidp);
-  frame->low_pc = ((char*) base) + MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc);
 
 
-  // DW_AT_high_pc:
-  {
+  // TODO, support DW_AT_ranges
+  uint64_t low_pc = MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc);
+  frame->low_pc = low_pc ? ((char*) base) + low_pc : 0;
+  if(low_pc) {
+    // DW_AT_high_pc:
     Dwarf_Attribute attr;
     Dwarf_Attribute attr;
-    if(dwarf_attr_integrate(die, DW_AT_high_pc, &attr)) {
-      uint64_t high_pc;
-      Dwarf_Addr value;
-      if (dwarf_formaddr(&attr, &value) == 0)
-        high_pc = (uint64_t) value;
-      else
-        high_pc = 0;
-
-      int form = dwarf_whatform(&attr);
-      int klass = MC_dwarf_form_get_class(form);
-      if (klass == MC_DW_CLASS_CONSTANT)
-        frame->high_pc = (void*) ((Dwarf_Off)frame->low_pc + high_pc);
-      else if(klass == MC_DW_CLASS_ADDRESS)
-        frame->high_pc = ((char*) base) + high_pc;
-      else
-        xbt_die("Unexpected class for DW_AT_high_pc");
-    } else {
-      frame->high_pc = 0;
+    if(!dwarf_attr_integrate(die, DW_AT_high_pc, &attr)) {
+      xbt_die("Missing DW_AT_high_pc matching with DW_AT_low_pc");
+    }
+
+    Dwarf_Sword offset;
+    Dwarf_Addr high_pc;
+
+    switch(MC_dwarf_form_get_class(dwarf_whatform(&attr))) {
+
+    // DW_AT_high_pc if an offset from the low_pc:
+    case MC_DW_CLASS_CONSTANT:
+
+      if (dwarf_formsdata(&attr, &offset) !=0)
+        xbt_die("Could not read constant");
+      frame->high_pc = (void*) ((char*)frame->low_pc + offset);
+      break;
+
+    // DW_AT_high_pc is a relocatable address:
+    case MC_DW_CLASS_ADDRESS:
+      if (dwarf_formaddr(&attr, &high_pc) != 0)
+        xbt_die("Could not read address");
+      frame->high_pc = ((char*) base) + high_pc;
+      break;
+
+    default:
+      xbt_die("Unexpected class for DW_AT_high_pc");
+
     }
   }
 
     }
   }
 
index caaf932..c349091 100644 (file)
@@ -92,7 +92,8 @@ int mc_dwarf_execute_expression(
         return MC_EXPRESSION_E_NO_BASE_ADDRESS;
       if(state->stack_size==MC_EXPRESSION_STACK_SIZE)
         return MC_EXPRESSION_E_STACK_OVERFLOW;
         return MC_EXPRESSION_E_NO_BASE_ADDRESS;
       if(state->stack_size==MC_EXPRESSION_STACK_SIZE)
         return MC_EXPRESSION_E_STACK_OVERFLOW;
-      error = mc_dwarf_push_value(state,  (Dwarf_Off)MC_object_base_address(state->object_info) + op->number);
+      error = mc_dwarf_push_value(state,
+        (Dwarf_Off)(uintptr_t)MC_object_base_address(state->object_info) + op->number);
       break;
 
     case DW_OP_const1u:
       break;
 
     case DW_OP_const1u:
@@ -260,7 +261,7 @@ int mc_dwarf_execute_expression(
 /** \brief Resolve a location expression
  *  \deprecated Use mc_dwarf_resolve_expression
  */
 /** \brief Resolve a location expression
  *  \deprecated Use mc_dwarf_resolve_expression
  */
-Dwarf_Off mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot) {
+uintptr_t mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot) {
   s_mc_expression_state_t state;
   memset(&state, 0, sizeof(s_mc_expression_state_t));
   state.frame_base = frame_pointer_address;
   s_mc_expression_state_t state;
   memset(&state, 0, sizeof(s_mc_expression_state_t));
   state.frame_base = frame_pointer_address;
@@ -273,10 +274,10 @@ Dwarf_Off mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t
   if(state.stack_size==0)
     xbt_die("No value on the stack");
   else
   if(state.stack_size==0)
     xbt_die("No value on the stack");
   else
-    return (Dwarf_Off) state.stack[state.stack_size-1];
+    return state.stack[state.stack_size-1];
 }
 
 }
 
-Dwarf_Off mc_dwarf_resolve_locations(mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot) {
+uintptr_t mc_dwarf_resolve_locations(mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot) {
 
   unw_word_t ip;
   if(c) {
 
   unw_word_t ip;
   if(c) {
index 0457aa9..55cf908 100644 (file)
@@ -8,6 +8,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/time.h>
+#include <sys/mman.h>
 #include <libgen.h>
 
 #include "simgrid/sg_config.h"
 #include <libgen.h>
 
 #include "simgrid/sg_config.h"
@@ -799,6 +800,14 @@ static void MC_init_debug_info(void) {
   mc_libsimgrid_info = MC_find_object_info(maps, libsimgrid_path, 0);
   mc_object_infos[1] = mc_libsimgrid_info;
 
   mc_libsimgrid_info = MC_find_object_info(maps, libsimgrid_path, 0);
   mc_object_infos[1] = mc_libsimgrid_info;
 
+#ifdef MADV_MERGEABLE
+  for(int i=0; i!=mc_object_infos_size; ++i) {
+    void* start = mc_object_infos[i]->start_rw;
+    void* end = mc_object_infos[i]->end_rw;
+    madvise(start, (char*)end - (char*)start, MADV_MERGEABLE);
+  }
+#endif
+
   // Use information of the other objects:
   MC_post_process_object_info(mc_binary_info);
   MC_post_process_object_info(mc_libsimgrid_info);
   // Use information of the other objects:
   MC_post_process_object_info(mc_binary_info);
   MC_post_process_object_info(mc_libsimgrid_info);
index 6b2ae33..20e4ab8 100644 (file)
@@ -416,8 +416,8 @@ typedef struct s_mc_location_list {
   mc_expression_t locations;
 } s_mc_location_list_t, *mc_location_list_t;
 
   mc_expression_t locations;
 } s_mc_location_list_t, *mc_location_list_t;
 
-Dwarf_Off mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot);
-Dwarf_Off mc_dwarf_resolve_locations(mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot);
+uintptr_t mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot);
+uintptr_t mc_dwarf_resolve_locations(mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot);
 
 void mc_dwarf_expression_clear(mc_expression_t expression);
 void mc_dwarf_expression_init(mc_expression_t expression, size_t len, Dwarf_Op* ops);
 
 void mc_dwarf_expression_clear(mc_expression_t expression);
 void mc_dwarf_expression_init(mc_expression_t expression, size_t len, Dwarf_Op* ops);
@@ -431,7 +431,7 @@ void mc_dwarf_location_list_init(mc_location_list_t target, mc_object_info_t inf
 
 struct s_dw_type{
   e_dw_type_type type;
 
 struct s_dw_type{
   e_dw_type_type type;
-  void *id; /* Offset in the section (in hexadecimal form) */
+  Dwarf_Off id; /* Offset in the section (in hexadecimal form) */
   char *name; /* Name of the type */
   int byte_size; /* Size in bytes */
   int element_count; /* Number of elements for array type */
   char *name; /* Name of the type */
   int byte_size; /* Size in bytes */
   int element_count; /* Number of elements for array type */
index f632e57..9a8b5c4 100644 (file)
@@ -326,7 +326,7 @@ msg_error_t MSG_file_move (msg_file_t fd, const char* fullpath)
 /**
  * \ingroup msg_file_management
  * \brief Copy a file to another location on a remote host.
 /**
  * \ingroup msg_file_management
  * \brief Copy a file to another location on a remote host.
- * \param fd : the file to move
+ * \param file : the file to move
  * \param host : the remote host where the file has to be copied
  * \param fullpath : the complete path destination on the remote host
  * \return If successful, the function returns MSG_OK. Otherwise, it returns
  * \param host : the remote host where the file has to be copied
  * \param fullpath : the complete path destination on the remote host
  * \return If successful, the function returns MSG_OK. Otherwise, it returns
@@ -406,7 +406,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
 /**
  * \ingroup msg_file_management
  * \brief Move a file to another location on a remote host.
 /**
  * \ingroup msg_file_management
  * \brief Move a file to another location on a remote host.
- * \param fd : the file to move
+ * \param file : the file to move
  * \param host : the remote host where the file has to be moved
  * \param fullpath : the complete path destination on the remote host
  * \return If successful, the function returns MSG_OK. Otherwise, it returns
  * \param host : the remote host where the file has to be moved
  * \param fullpath : the complete path destination on the remote host
  * \return If successful, the function returns MSG_OK. Otherwise, it returns
index 7df250c..71a85a4 100644 (file)
@@ -44,7 +44,12 @@ static void _XBT_CALL segvhandler(int signum, siginfo_t *siginfo, void *context)
 {
   if (siginfo->si_signo == SIGSEGV && siginfo->si_code == SEGV_ACCERR) {
     fprintf(stderr,
 {
   if (siginfo->si_signo == SIGSEGV && siginfo->si_code == SEGV_ACCERR) {
     fprintf(stderr,
-            "Access violation detected. This can result from a stack overflow.\n"
+            "Access violation detected.\n"
+            "This can result from a programming error in your code or, although less likely,\n"
+            "from a bug in SimGrid itself.  This can also be the sign of a bug in the OS or\n"
+            "in third-party libraries.  Failing hardware can sometimes generate such errors\n"
+            "too.\n"
+            "Finally, if nothing of the above applies, this can result from a stack overflow.\n"
             "Try to increase stack size with --cfg=contexts/stack_size (current size is %d KiB).\n",
             smx_context_stack_size / 1024);
     if (XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_debug)) {
             "Try to increase stack size with --cfg=contexts/stack_size (current size is %d KiB).\n",
             smx_context_stack_size / 1024);
     if (XBT_LOG_ISENABLED(simix_kernel, xbt_log_priority_debug)) {
index 4b5b1f2..4be4d69 100644 (file)
@@ -112,7 +112,7 @@ smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t si
   action->io.surf_io = surf_workstation_write(host, fd->surf_file, size);
 
   surf_action_set_data(action->io.surf_io, action);
   action->io.surf_io = surf_workstation_write(host, fd->surf_file, size);
 
   surf_action_set_data(action->io.surf_io, action);
-  XBT_DEBUG("Create io action %p", action);
+  XBT_INFO("Create io action %p", action);
 
   return action;
 }
 
   return action;
 }
index 6295038..f2085f2 100644 (file)
@@ -377,14 +377,11 @@ void smpi_mpi_start(MPI_Request request)
         oldbuf = request->buf;
         if (!_xbt_replay_is_active() && oldbuf && request->size!=0){
           if((smpi_privatize_global_variables)
         oldbuf = request->buf;
         if (!_xbt_replay_is_active() && oldbuf && request->size!=0){
           if((smpi_privatize_global_variables)
-           && ((char*)request->buf >= start_data_exe)
-           && ((char*)request->buf < start_data_exe + size_data_exe )
-       ){
-                 XBT_WARN("Privatization : We are sending from a zone inside global memory. Switch data segment ");
-                 switch_data_segment(smpi_process_index());
-       }
-
-
+             && ((char*)request->buf >= start_data_exe)
+             && ((char*)request->buf < start_data_exe + size_data_exe )){
+            XBT_DEBUG("Privatization : We are sending from a zone inside global memory. Switch data segment ");
+                   switch_data_segment(smpi_process_index());
+         }
           buf = xbt_malloc(request->size);
           memcpy(buf,oldbuf,request->size);
         }
           buf = xbt_malloc(request->size);
           memcpy(buf,oldbuf,request->size);
         }
index 126d181..fe8f3b4 100644 (file)
@@ -590,11 +590,18 @@ void switch_data_segment(int dest){
 
   if (loaded_page==dest)//no need to switch either
     return;
 
   if (loaded_page==dest)//no need to switch either
     return;
+
+
 #ifdef HAVE_MMAP
 #ifdef HAVE_MMAP
+  int i;
+  if(loaded_page==-1){//initial switch, do the copy from the real page here
+    for (i=0; i< SIMIX_process_count(); i++){
+      memcpy(mappings[i],TOPAGE(start_data_exe),size_data_exe);
+    }
+  }
   int current= fds[dest];
   XBT_VERB("Switching data frame to the one of process %d", dest);
   void* tmp = mmap (TOPAGE(start_data_exe), size_data_exe, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, current, 0);
   int current= fds[dest];
   XBT_VERB("Switching data frame to the one of process %d", dest);
   void* tmp = mmap (TOPAGE(start_data_exe), size_data_exe, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, current, 0);
-  msync(TOPAGE(start_data_exe), size_data_exe, MS_SYNC | MS_INVALIDATE );
   if (tmp != TOPAGE(start_data_exe))
     xbt_die("Couldn't map the new region");
   loaded_page=dest;
   if (tmp != TOPAGE(start_data_exe))
     xbt_die("Couldn't map the new region");
   loaded_page=dest;
index 60e550f..75815c1 100644 (file)
@@ -72,6 +72,7 @@ void smpi_process_init(int *argc, char ***argv)
 #ifdef SMPI_F2C
     smpi_current_rank = index;
 #endif
 #ifdef SMPI_F2C
     smpi_current_rank = index;
 #endif
+
     data = smpi_process_remote_data(index);
     simcall_process_set_data(proc, data);
     if (*argc > 2) {
     data = smpi_process_remote_data(index);
     simcall_process_set_data(proc, data);
     if (*argc > 2) {
@@ -85,6 +86,11 @@ void smpi_process_init(int *argc, char ***argv)
     // set the process attached to the mailbox
     simcall_rdv_set_receiver(data->mailbox_small, proc);
     XBT_DEBUG("<%d> New process in the game: %p", index, proc);
     // set the process attached to the mailbox
     simcall_rdv_set_receiver(data->mailbox_small, proc);
     XBT_DEBUG("<%d> New process in the game: %p", index, proc);
+
+    if(smpi_privatize_global_variables){
+      switch_data_segment(index);
+    }
+
   }
   if (smpi_process_data() == NULL)
     xbt_die("smpi_process_data() returned NULL. You probably gave a NULL parameter to MPI_Init. Although it's required by MPI-2, this is currently not supported by SMPI.");
   }
   if (smpi_process_data() == NULL)
     xbt_die("smpi_process_data() returned NULL. You probably gave a NULL parameter to MPI_Init. Although it's required by MPI-2, this is currently not supported by SMPI.");
@@ -93,6 +99,9 @@ void smpi_process_init(int *argc, char ***argv)
 void smpi_process_destroy(void)
 {
   int index = smpi_process_index();
 void smpi_process_destroy(void)
 {
   int index = smpi_process_index();
+  if(smpi_privatize_global_variables){
+    switch_data_segment(index);
+  }
   process_data[index]->state = SMPI_FINALIZED;
   XBT_DEBUG("<%d> Process left the game", index);
 }
   process_data[index]->state = SMPI_FINALIZED;
   XBT_DEBUG("<%d> Process left the game", index);
 }
@@ -334,7 +343,7 @@ static void smpi_comm_copy_buffer_callback(smx_action_t comm,
       && ((char*)buff >= start_data_exe)
       && ((char*)buff < start_data_exe + size_data_exe )
     ){
       && ((char*)buff >= start_data_exe)
       && ((char*)buff < start_data_exe + size_data_exe )
     ){
-       XBT_WARN("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
+       XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !");
        switch_data_segment(((smpi_process_data_t)SIMIX_process_get_data(comm->comm.src_proc))->index);
        tmpbuff = (void*)xbt_malloc(buff_size);
        memcpy(tmpbuff, buff, buff_size);
        switch_data_segment(((smpi_process_data_t)SIMIX_process_get_data(comm->comm.src_proc))->index);
        tmpbuff = (void*)xbt_malloc(buff_size);
        memcpy(tmpbuff, buff, buff_size);
@@ -345,7 +354,7 @@ static void smpi_comm_copy_buffer_callback(smx_action_t comm,
       && ((char*)comm->comm.dst_buff >= start_data_exe)
       && ((char*)comm->comm.dst_buff < start_data_exe + size_data_exe )
     ){
       && ((char*)comm->comm.dst_buff >= start_data_exe)
       && ((char*)comm->comm.dst_buff < start_data_exe + size_data_exe )
     ){
-       XBT_WARN("Privatization : We are copying to a zone inside global memory - Switch data segment");
+       XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment");
        switch_data_segment(((smpi_process_data_t)SIMIX_process_get_data(comm->comm.dst_proc))->index);
   }
 
        switch_data_segment(((smpi_process_data_t)SIMIX_process_get_data(comm->comm.dst_proc))->index);
   }
 
index cfd9b5b..5b51a9b 100644 (file)
@@ -93,14 +93,12 @@ int PMPI_Query_thread(int *provided)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (provided == NULL) {
     retval = MPI_ERR_ARG;
   } else {
     *provided = MPI_THREAD_MULTIPLE;
     retval = MPI_SUCCESS;
   }
   if (provided == NULL) {
     retval = MPI_ERR_ARG;
   } else {
     *provided = MPI_THREAD_MULTIPLE;
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -108,14 +106,12 @@ int PMPI_Is_thread_main(int *flag)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (flag == NULL) {
     retval = MPI_ERR_ARG;
   } else {
     *flag = smpi_process_index() == 0;
     retval = MPI_SUCCESS;
   }
   if (flag == NULL) {
     retval = MPI_ERR_ARG;
   } else {
     *flag = smpi_process_index() == 0;
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -151,14 +147,12 @@ int PMPI_Address(void *location, MPI_Aint * address)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (!address) {
     retval = MPI_ERR_ARG;
   } else {
     *address = (MPI_Aint) location;
     retval = MPI_SUCCESS;
   }
   if (!address) {
     retval = MPI_ERR_ARG;
   } else {
     *address = (MPI_Aint) location;
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -171,14 +165,12 @@ int PMPI_Type_free(MPI_Datatype * datatype)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (!datatype) {
     retval = MPI_ERR_ARG;
   } else {
     smpi_datatype_free(datatype);
     retval = MPI_SUCCESS;
   }
   if (!datatype) {
     retval = MPI_ERR_ARG;
   } else {
     smpi_datatype_free(datatype);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -186,7 +178,6 @@ int PMPI_Type_size(MPI_Datatype datatype, int *size)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (size == NULL) {
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (size == NULL) {
@@ -195,7 +186,6 @@ int PMPI_Type_size(MPI_Datatype datatype, int *size)
     *size = (int) smpi_datatype_size(datatype);
     retval = MPI_SUCCESS;
   }
     *size = (int) smpi_datatype_size(datatype);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -203,7 +193,6 @@ int PMPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (lb == NULL || extent == NULL) {
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (lb == NULL || extent == NULL) {
@@ -211,7 +200,6 @@ int PMPI_Type_get_extent(MPI_Datatype datatype, MPI_Aint * lb, MPI_Aint * extent
   } else {
     retval = smpi_datatype_extent(datatype, lb, extent);
   }
   } else {
     retval = smpi_datatype_extent(datatype, lb, extent);
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -224,7 +212,6 @@ int PMPI_Type_extent(MPI_Datatype datatype, MPI_Aint * extent)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (extent == NULL) {
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (extent == NULL) {
@@ -233,7 +220,6 @@ int PMPI_Type_extent(MPI_Datatype datatype, MPI_Aint * extent)
     *extent = smpi_datatype_get_extent(datatype);
     retval = MPI_SUCCESS;
   }
     *extent = smpi_datatype_get_extent(datatype);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -241,7 +227,6 @@ int PMPI_Type_lb(MPI_Datatype datatype, MPI_Aint * disp)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (disp == NULL) {
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (disp == NULL) {
@@ -250,7 +235,6 @@ int PMPI_Type_lb(MPI_Datatype datatype, MPI_Aint * disp)
     *disp = smpi_datatype_lb(datatype);
     retval = MPI_SUCCESS;
   }
     *disp = smpi_datatype_lb(datatype);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -258,7 +242,6 @@ int PMPI_Type_ub(MPI_Datatype datatype, MPI_Aint * disp)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (disp == NULL) {
   if (datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (disp == NULL) {
@@ -267,7 +250,6 @@ int PMPI_Type_ub(MPI_Datatype datatype, MPI_Aint * disp)
     *disp = smpi_datatype_ub(datatype);
     retval = MPI_SUCCESS;
   }
     *disp = smpi_datatype_ub(datatype);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -275,14 +257,12 @@ int PMPI_Op_create(MPI_User_function * function, int commute, MPI_Op * op)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (function == NULL || op == NULL) {
     retval = MPI_ERR_ARG;
   } else {
     *op = smpi_op_new(function, commute);
     retval = MPI_SUCCESS;
   }
   if (function == NULL || op == NULL) {
     retval = MPI_ERR_ARG;
   } else {
     *op = smpi_op_new(function, commute);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -290,7 +270,6 @@ int PMPI_Op_free(MPI_Op * op)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (op == NULL) {
     retval = MPI_ERR_ARG;
   } else if (*op == MPI_OP_NULL) {
   if (op == NULL) {
     retval = MPI_ERR_ARG;
   } else if (*op == MPI_OP_NULL) {
@@ -300,7 +279,6 @@ int PMPI_Op_free(MPI_Op * op)
     *op = MPI_OP_NULL;
     retval = MPI_SUCCESS;
   }
     *op = MPI_OP_NULL;
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -308,7 +286,6 @@ int PMPI_Group_free(MPI_Group * group)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (group == NULL) {
     retval = MPI_ERR_ARG;
   } else {
   if (group == NULL) {
     retval = MPI_ERR_ARG;
   } else {
@@ -316,7 +293,6 @@ int PMPI_Group_free(MPI_Group * group)
     *group = MPI_GROUP_NULL;
     retval = MPI_SUCCESS;
   }
     *group = MPI_GROUP_NULL;
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -324,7 +300,6 @@ int PMPI_Group_size(MPI_Group group, int *size)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (size == NULL) {
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (size == NULL) {
@@ -333,7 +308,6 @@ int PMPI_Group_size(MPI_Group group, int *size)
     *size = smpi_group_size(group);
     retval = MPI_SUCCESS;
   }
     *size = smpi_group_size(group);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -341,7 +315,6 @@ int PMPI_Group_rank(MPI_Group group, int *rank)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (rank == NULL) {
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (rank == NULL) {
@@ -350,7 +323,6 @@ int PMPI_Group_rank(MPI_Group group, int *rank)
     *rank = smpi_group_rank(group, smpi_process_index());
     retval = MPI_SUCCESS;
   }
     *rank = smpi_group_rank(group, smpi_process_index());
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -358,7 +330,6 @@ int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
                               MPI_Group group2, int *ranks2)
 {
   int retval, i, index;
                               MPI_Group group2, int *ranks2)
 {
   int retval, i, index;
-  smpi_bench_end();
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else {
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else {
@@ -372,7 +343,6 @@ int PMPI_Group_translate_ranks(MPI_Group group1, int n, int *ranks1,
     }
     retval = MPI_SUCCESS;
   }
     }
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -380,7 +350,6 @@ int PMPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (result == NULL) {
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (result == NULL) {
@@ -389,7 +358,6 @@ int PMPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result)
     *result = smpi_group_compare(group1, group2);
     retval = MPI_SUCCESS;
   }
     *result = smpi_group_compare(group1, group2);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -398,7 +366,6 @@ int PMPI_Group_union(MPI_Group group1, MPI_Group group2,
 {
   int retval, i, proc1, proc2, size, size2;
 
 {
   int retval, i, proc1, proc2, size, size2;
 
-  smpi_bench_end();
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
@@ -429,7 +396,6 @@ int PMPI_Group_union(MPI_Group group1, MPI_Group group2,
     }
     retval = MPI_SUCCESS;
   }
     }
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -438,7 +404,6 @@ int PMPI_Group_intersection(MPI_Group group1, MPI_Group group2,
 {
   int retval, i, proc1, proc2, size;
 
 {
   int retval, i, proc1, proc2, size;
 
-  smpi_bench_end();
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
@@ -468,7 +433,6 @@ int PMPI_Group_intersection(MPI_Group group1, MPI_Group group2,
     }
     retval = MPI_SUCCESS;
   }
     }
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -476,7 +440,6 @@ int PMPI_Group_difference(MPI_Group group1, MPI_Group group2, MPI_Group * newgro
 {
   int retval, i, proc1, proc2, size, size2;
 
 {
   int retval, i, proc1, proc2, size, size2;
 
-  smpi_bench_end();
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
   if (group1 == MPI_GROUP_NULL || group2 == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
@@ -504,7 +467,6 @@ int PMPI_Group_difference(MPI_Group group1, MPI_Group group2, MPI_Group * newgro
     }
     retval = MPI_SUCCESS;
   }
     }
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -512,7 +474,6 @@ int PMPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
 {
   int retval, i, index;
 
 {
   int retval, i, index;
 
-  smpi_bench_end();
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
@@ -536,7 +497,6 @@ int PMPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
     }
     retval = MPI_SUCCESS;
   }
     }
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -544,7 +504,6 @@ int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
 {
   int retval, i, j, newsize, oldsize, index;
 
 {
   int retval, i, j, newsize, oldsize, index;
 
-  smpi_bench_end();
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
@@ -583,7 +542,6 @@ int PMPI_Group_excl(MPI_Group group, int n, int *ranks, MPI_Group * newgroup)
     }
     retval = MPI_SUCCESS;
   }
     }
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -592,7 +550,6 @@ int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
 {
   int retval, i, j, rank, size, index;
 
 {
   int retval, i, j, rank, size, index;
 
-  smpi_bench_end();
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
@@ -641,7 +598,6 @@ int PMPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
     }
     retval = MPI_SUCCESS;
   }
     }
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -650,7 +606,6 @@ int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
 {
   int retval, i, rank, newrank,oldrank, size, index, add;
 
 {
   int retval, i, rank, newrank,oldrank, size, index, add;
 
-  smpi_bench_end();
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
   if (group == MPI_GROUP_NULL) {
     retval = MPI_ERR_GROUP;
   } else if (newgroup == NULL) {
@@ -719,15 +674,12 @@ int PMPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
 
     retval = MPI_SUCCESS;
   }
 
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
 int PMPI_Comm_rank(MPI_Comm comm, int *rank)
 {
   int retval = 0;
   return retval;
 }
 
 int PMPI_Comm_rank(MPI_Comm comm, int *rank)
 {
   int retval = 0;
-
-  smpi_bench_end();
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (rank == NULL) {
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (rank == NULL) {
@@ -736,15 +688,12 @@ int PMPI_Comm_rank(MPI_Comm comm, int *rank)
     *rank = smpi_comm_rank(comm);
     retval = MPI_SUCCESS;
   }
     *rank = smpi_comm_rank(comm);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
 int PMPI_Comm_size(MPI_Comm comm, int *size)
 {
   int retval = 0;
   return retval;
 }
 
 int PMPI_Comm_size(MPI_Comm comm, int *size)
 {
   int retval = 0;
-
-  smpi_bench_end();
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (size == NULL) {
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (size == NULL) {
@@ -753,7 +702,6 @@ int PMPI_Comm_size(MPI_Comm comm, int *size)
     *size = smpi_comm_size(comm);
     retval = MPI_SUCCESS;
   }
     *size = smpi_comm_size(comm);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -761,7 +709,6 @@ int PMPI_Comm_get_name (MPI_Comm comm, char* name, int* len)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (comm == MPI_COMM_NULL)  {
     retval = MPI_ERR_COMM;
   } else if (name == NULL || len == NULL)  {
   if (comm == MPI_COMM_NULL)  {
     retval = MPI_ERR_COMM;
   } else if (name == NULL || len == NULL)  {
@@ -770,7 +717,6 @@ int PMPI_Comm_get_name (MPI_Comm comm, char* name, int* len)
     smpi_comm_get_name(comm, name, len);
     retval = MPI_SUCCESS;
   }
     smpi_comm_get_name(comm, name, len);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -778,7 +724,6 @@ int PMPI_Comm_group(MPI_Comm comm, MPI_Group * group)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (group == NULL) {
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (group == NULL) {
@@ -792,7 +737,6 @@ int PMPI_Comm_group(MPI_Comm comm, MPI_Group * group)
     smpi_group_use(*group);
     retval = MPI_SUCCESS;
   }
     smpi_group_use(*group);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -800,7 +744,6 @@ int PMPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (comm1 == MPI_COMM_NULL || comm2 == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (result == NULL) {
   if (comm1 == MPI_COMM_NULL || comm2 == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (result == NULL) {
@@ -818,7 +761,6 @@ int PMPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result)
     }
     retval = MPI_SUCCESS;
   }
     }
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -826,7 +768,6 @@ int PMPI_Comm_dup(MPI_Comm comm, MPI_Comm * newcomm)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (newcomm == NULL) {
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (newcomm == NULL) {
@@ -835,7 +776,6 @@ int PMPI_Comm_dup(MPI_Comm comm, MPI_Comm * newcomm)
     *newcomm = smpi_comm_new(smpi_comm_group(comm));
     retval = MPI_SUCCESS;
   }
     *newcomm = smpi_comm_new(smpi_comm_group(comm));
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -843,7 +783,6 @@ int PMPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (group == MPI_GROUP_NULL) {
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else if (group == MPI_GROUP_NULL) {
@@ -858,7 +797,6 @@ int PMPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm)
     *newcomm = smpi_comm_new(group);
     retval = MPI_SUCCESS;
   }
     *newcomm = smpi_comm_new(group);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -866,7 +804,6 @@ int PMPI_Comm_free(MPI_Comm * comm)
 {
   int retval = 0;
 
 {
   int retval = 0;
 
-  smpi_bench_end();
   if (comm == NULL) {
     retval = MPI_ERR_ARG;
   } else if (*comm == MPI_COMM_NULL) {
   if (comm == NULL) {
     retval = MPI_ERR_ARG;
   } else if (*comm == MPI_COMM_NULL) {
@@ -876,7 +813,6 @@ int PMPI_Comm_free(MPI_Comm * comm)
     *comm = MPI_COMM_NULL;
     retval = MPI_SUCCESS;
   }
     *comm = MPI_COMM_NULL;
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -885,7 +821,6 @@ int PMPI_Comm_disconnect(MPI_Comm * comm)
   /* TODO: wait until all communication in comm are done */
   int retval = 0;
 
   /* TODO: wait until all communication in comm are done */
   int retval = 0;
 
-  smpi_bench_end();
   if (comm == NULL) {
     retval = MPI_ERR_ARG;
   } else if (*comm == MPI_COMM_NULL) {
   if (comm == NULL) {
     retval = MPI_ERR_ARG;
   } else if (*comm == MPI_COMM_NULL) {
@@ -895,15 +830,14 @@ int PMPI_Comm_disconnect(MPI_Comm * comm)
     *comm = MPI_COMM_NULL;
     retval = MPI_SUCCESS;
   }
     *comm = MPI_COMM_NULL;
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
 int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
 {
   int retval = 0;
   return retval;
 }
 
 int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
 {
   int retval = 0;
-
   smpi_bench_end();
   smpi_bench_end();
+
   if (comm_out == NULL) {
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
   if (comm_out == NULL) {
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
@@ -913,6 +847,7 @@ int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
     retval = MPI_SUCCESS;
   }
   smpi_bench_begin();
     retval = MPI_SUCCESS;
   }
   smpi_bench_begin();
+
   return retval;
 }
 
   return retval;
 }
 
@@ -2425,7 +2360,6 @@ int PMPI_Get_processor_name(char *name, int *resultlen)
 {
   int retval = MPI_SUCCESS;
 
 {
   int retval = MPI_SUCCESS;
 
-  smpi_bench_end();
   strncpy(name, SIMIX_host_get_name(SIMIX_host_self()),
           strlen(SIMIX_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ?
           strlen(SIMIX_host_get_name(SIMIX_host_self())) +1 :
   strncpy(name, SIMIX_host_get_name(SIMIX_host_self()),
           strlen(SIMIX_host_get_name(SIMIX_host_self())) < MPI_MAX_PROCESSOR_NAME - 1 ?
           strlen(SIMIX_host_get_name(SIMIX_host_self())) +1 :
@@ -2434,7 +2368,6 @@ int PMPI_Get_processor_name(char *name, int *resultlen)
       strlen(name) >
       MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
 
       strlen(name) >
       MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
 
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -2443,7 +2376,6 @@ int PMPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
   int retval = MPI_SUCCESS;
   size_t size;
 
   int retval = MPI_SUCCESS;
   size_t size;
 
-  smpi_bench_end();
   if (status == NULL || count == NULL) {
     retval = MPI_ERR_ARG;
   } else if (datatype == MPI_DATATYPE_NULL) {
   if (status == NULL || count == NULL) {
     retval = MPI_ERR_ARG;
   } else if (datatype == MPI_DATATYPE_NULL) {
@@ -2458,14 +2390,12 @@ int PMPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
       *count = smpi_mpi_get_count(status, datatype);
     }
   }
       *count = smpi_mpi_get_count(status, datatype);
     }
   }
-  smpi_bench_begin();
   return retval;
 }
 
 int PMPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
   return retval;
 }
 
 int PMPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
-  smpi_bench_end();
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
@@ -2473,21 +2403,18 @@ int PMPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_typ
   } else {
     retval = smpi_datatype_contiguous(count, old_type, new_type, 0);
   }
   } else {
     retval = smpi_datatype_contiguous(count, old_type, new_type, 0);
   }
-  smpi_bench_begin();
   return retval;
 }
 
 int PMPI_Type_commit(MPI_Datatype* datatype) {
   int retval = 0;
 
   return retval;
 }
 
 int PMPI_Type_commit(MPI_Datatype* datatype) {
   int retval = 0;
 
-  smpi_bench_end();
   if (datatype == NULL || *datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else {
     smpi_datatype_commit(datatype);
     retval = MPI_SUCCESS;
   }
   if (datatype == NULL || *datatype == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else {
     smpi_datatype_commit(datatype);
     retval = MPI_SUCCESS;
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -2495,7 +2422,6 @@ int PMPI_Type_commit(MPI_Datatype* datatype) {
 int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
 int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
-  smpi_bench_end();
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0 || blocklen<0){
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0 || blocklen<0){
@@ -2503,14 +2429,12 @@ int PMPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type,
   } else {
     retval = smpi_datatype_vector(count, blocklen, stride, old_type, new_type);
   }
   } else {
     retval = smpi_datatype_vector(count, blocklen, stride, old_type, new_type);
   }
-  smpi_bench_begin();
   return retval;
 }
 
 int PMPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
   return retval;
 }
 
 int PMPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
-  smpi_bench_end();
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0 || blocklen<0){
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0 || blocklen<0){
@@ -2518,7 +2442,6 @@ int PMPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old
   } else {
     retval = smpi_datatype_hvector(count, blocklen, stride, old_type, new_type);
   }
   } else {
     retval = smpi_datatype_hvector(count, blocklen, stride, old_type, new_type);
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -2529,7 +2452,6 @@ int PMPI_Type_create_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datat
 int PMPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
 int PMPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
-  smpi_bench_end();
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
@@ -2537,14 +2459,12 @@ int PMPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_
   } else {
     retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
   }
   } else {
     retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
   }
-  smpi_bench_begin();
   return retval;
 }
 
 int PMPI_Type_create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
   return retval;
 }
 
 int PMPI_Type_create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
-  smpi_bench_end();
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
@@ -2552,14 +2472,12 @@ int PMPI_Type_create_indexed(int count, int* blocklens, int* indices, MPI_Dataty
   } else {
     retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
   }
   } else {
     retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
   }
-  smpi_bench_begin();
   return retval;
 }
 
 int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval,i;
 
   return retval;
 }
 
 int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval,i;
 
-  smpi_bench_end();
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
@@ -2570,7 +2488,6 @@ int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI
     retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
     xbt_free(blocklens);
   }
     retval = smpi_datatype_indexed(count, blocklens, indices, old_type, new_type);
     xbt_free(blocklens);
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -2578,7 +2495,6 @@ int PMPI_Type_create_indexed_block(int count, int blocklength, int* indices, MPI
 int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
 int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval = 0;
 
-  smpi_bench_end();
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
@@ -2586,7 +2502,6 @@ int PMPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatyp
   } else {
     retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
   }
   } else {
     retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -2597,7 +2512,6 @@ int PMPI_Type_create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_
 int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval,i;
 
 int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type) {
   int retval,i;
 
-  smpi_bench_end();
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
   if (old_type == MPI_DATATYPE_NULL) {
     retval = MPI_ERR_TYPE;
   } else if (count<0){
@@ -2608,7 +2522,6 @@ int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indice
     retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
     xbt_free(blocklens);
   }
     retval = smpi_datatype_hindexed(count, blocklens, indices, old_type, new_type);
     xbt_free(blocklens);
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
@@ -2616,13 +2529,11 @@ int PMPI_Type_create_hindexed_block(int count, int blocklength, MPI_Aint* indice
 int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
   int retval = 0;
 
 int PMPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type) {
   int retval = 0;
 
-  smpi_bench_end();
   if (count<0){
     retval = MPI_ERR_COUNT;
   } else {
     retval = smpi_datatype_struct(count, blocklens, indices, old_types, new_type);
   }
   if (count<0){
     retval = MPI_ERR_COUNT;
   } else {
     retval = smpi_datatype_struct(count, blocklens, indices, old_types, new_type);
   }
-  smpi_bench_begin();
   return retval;
 }
 
   return retval;
 }
 
index 736b29e..246f48f 100644 (file)
@@ -25,8 +25,8 @@ CpuPtr getActionCpu(CpuActionPtr action) {
 
 surf_callback(void, CpuPtr) cpuCreatedCallbacks;
 surf_callback(void, CpuPtr) cpuDestructedCallbacks;
 
 surf_callback(void, CpuPtr) cpuCreatedCallbacks;
 surf_callback(void, CpuPtr) cpuDestructedCallbacks;
-surf_callback(void, CpuPtr) cpuStateChangedCallbacks;
-surf_callback(void, CpuActionPtr) cpuActionStateChangedCallbacks;
+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;
 
 /*********
  * Model *
 
 /*********
  * Model *
@@ -203,8 +203,9 @@ int Cpu::getCore()
 
 void Cpu::setState(e_surf_resource_state_t state)
 {
 
 void Cpu::setState(e_surf_resource_state_t state)
 {
+  e_surf_resource_state_t old = Resource::getState();
   Resource::setState(state);
   Resource::setState(state);
-  surf_callback_emit(cpuStateChangedCallbacks, this);
+  surf_callback_emit(cpuStateChangedCallbacks, this, old, state);
 }
 /**********
  * Action *
 }
 /**********
  * Action *
@@ -309,6 +310,7 @@ void CpuAction::setAffinity(CpuPtr cpu, unsigned long mask)
 }
 
 void CpuAction::setState(e_surf_action_state_t state){
 }
 
 void CpuAction::setState(e_surf_action_state_t state){
+  e_surf_action_state_t old = getState();
   Action::setState(state);
   Action::setState(state);
-  surf_callback_emit(cpuActionStateChangedCallbacks, this);
+  surf_callback_emit(cpuActionStateChangedCallbacks, this, old, state);
 }
 }
index c72e0f5..7e2203f 100644 (file)
@@ -31,28 +31,28 @@ typedef CpuPlugin *CpuPluginPtr;
 CpuPtr getActionCpu(CpuActionPtr action);
 
 /** @ingroup SURF_callbacks
 CpuPtr getActionCpu(CpuActionPtr action);
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Cpu creation * 
+ * @brief Callbacks handler which emit the callbacks after Cpu creation *
  * @details Callback functions have the following signature: `void(CpuPtr)`
  */
 extern surf_callback(void, CpuPtr) cpuCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @details Callback functions have the following signature: `void(CpuPtr)`
  */
 extern surf_callback(void, CpuPtr) cpuCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Cpu destruction * 
+ * @brief Callbacks handler which emit the callbacks after Cpu destruction *
  * @details Callback functions have the following signature: `void(CpuPtr)`
  */
 extern surf_callback(void, CpuPtr) cpuDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @details Callback functions have the following signature: `void(CpuPtr)`
  */
 extern surf_callback(void, CpuPtr) cpuDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Cpu State changed * 
- * @details Callback functions have the following signature: `void(CpuActionPtr)`
+ * @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)`
  */
  */
-extern surf_callback(void, CpuPtr) cpuStateChangedCallbacks;
+extern surf_callback(void, CpuPtr, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after CpuAction State changed * 
- * @details Callback functions have the following signature: `void(CpuActionPtr)`
+ * @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)`
  */
  */
-extern surf_callback(void, CpuActionPtr) cpuActionStateChangedCallbacks;
+extern surf_callback(void, CpuActionPtr, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks;
 
 /*********
  * Model *
 
 /*********
  * Model *
@@ -66,16 +66,16 @@ class CpuModel : public Model {
 public:
   /**
    * @brief CpuModel constructor
 public:
   /**
    * @brief CpuModel constructor
-   * 
+   *
    * @param name The name of the model
    */
   CpuModel(const char *name) : Model(name) {};
 
   /**
    * @brief Create a Cpu
    * @param name The name of the model
    */
   CpuModel(const char *name) : Model(name) {};
 
   /**
    * @brief Create a Cpu
-   * 
+   *
    * @param name The name of the Cpu
    * @param name The name of the Cpu
-   * 
+   *
    * @return The created Cpu
    */
   CpuPtr createResource(string name);
    * @return The created Cpu
    */
   CpuPtr createResource(string name);
@@ -105,7 +105,7 @@ public:
 
   /**
    * @brief Cpu constructor
 
   /**
    * @brief Cpu constructor
-   * 
+   *
    * @param model The CpuModel associated to this Cpu
    * @param name The name of the Cpu
    * @param props Dictionary of properties associated to this Cpu
    * @param model The CpuModel associated to this Cpu
    * @param name The name of the Cpu
    * @param props Dictionary of properties associated to this Cpu
@@ -119,7 +119,7 @@ public:
 
   /**
    * @brief Cpu constructor
 
   /**
    * @brief Cpu constructor
-   * 
+   *
    * @param model The CpuModel associated to this Cpu
    * @param name The name of the Cpu
    * @param props Dictionary of properties associated to this Cpu
    * @param model The CpuModel associated to this Cpu
    * @param name The name of the Cpu
    * @param props Dictionary of properties associated to this Cpu
@@ -137,7 +137,7 @@ public:
 
   /**
    * @brief Execute some quantity of computation
 
   /**
    * @brief Execute some quantity of computation
-   * 
+   *
    * @param size The value of the processing amount (in flop) needed to process
    * @return The CpuAction corresponding to the processing
    */
    * @param size The value of the processing amount (in flop) needed to process
    * @return The CpuAction corresponding to the processing
    */
@@ -145,7 +145,7 @@ public:
 
   /**
    * @brief Make a process sleep for duration (in seconds)
 
   /**
    * @brief Make a process sleep for duration (in seconds)
-   * 
+   *
    * @param duration The number of seconds to sleep
    * @return The CpuAction corresponding to the sleeping
    */
    * @param duration The number of seconds to sleep
    * @return The CpuAction corresponding to the sleeping
    */
@@ -153,7 +153,7 @@ public:
 
   /**
    * @brief Get the number of cores of the current Cpu
 
   /**
    * @brief Get the number of cores of the current Cpu
-   * 
+   *
    * @return The number of cores of the current Cpu
    */
   virtual int getCore();
    * @return The number of cores of the current Cpu
    */
   virtual int getCore();
@@ -161,9 +161,9 @@ public:
   /**
    * @brief Get the speed of the current Cpu
    * @details [TODO] load * m_powerPeak
   /**
    * @brief Get the speed of the current Cpu
    * @details [TODO] load * m_powerPeak
-   * 
+   *
    * @param load [TODO]
    * @param load [TODO]
-   * 
+   *
    * @return The speed of the current Cpu
    */
   virtual double getSpeed(double load);
    * @return The speed of the current Cpu
    */
   virtual double getSpeed(double load);
@@ -171,23 +171,23 @@ public:
   /**
    * @brief Get the available speed of the current Cpu
    * @details [TODO]
   /**
    * @brief Get the available speed of the current Cpu
    * @details [TODO]
-   * 
+   *
    * @return The available speed of the current Cpu
    */
   virtual double getAvailableSpeed();
 
   /**
    * @brief Get the current Cpu power peak
    * @return The available speed of the current Cpu
    */
   virtual double getAvailableSpeed();
 
   /**
    * @brief Get the current Cpu power peak
-   * 
+   *
    * @return The current Cpu power peak
    */
   virtual double getCurrentPowerPeak()=0;
 
 
   virtual double getPowerPeakAt(int pstate_index)=0;
    * @return The current Cpu power peak
    */
   virtual double getCurrentPowerPeak()=0;
 
 
   virtual double getPowerPeakAt(int pstate_index)=0;
-  
+
   virtual int getNbPstates()=0;
   virtual int getNbPstates()=0;
-  
+
   virtual void setPowerPeakAt(int pstate_index)=0;
 
   void setState(e_surf_resource_state_t state);
   virtual void setPowerPeakAt(int pstate_index)=0;
 
   void setState(e_surf_resource_state_t state);
@@ -220,7 +220,7 @@ public:
 
   /**
    * @brief CpuAction constructor
 
   /**
    * @brief CpuAction constructor
-   * 
+   *
    * @param model The CpuModel associated to this CpuAction
    * @param cost [TODO]
    * @param failed [TODO]
    * @param model The CpuModel associated to this CpuAction
    * @param cost [TODO]
    * @param failed [TODO]
@@ -230,7 +230,7 @@ public:
 
   /**
    * @brief CpuAction constructor
 
   /**
    * @brief CpuAction constructor
-   * 
+   *
    * @param model The CpuModel associated to this CpuAction
    * @param cost [TODO]
    * @param failed [TODO]
    * @param model The CpuModel associated to this CpuAction
    * @param cost [TODO]
    * @param failed [TODO]
@@ -242,7 +242,7 @@ public:
   /**
    * @brief Set the affinity of the current CpuAction
    * @details [TODO]
   /**
    * @brief Set the affinity of the current CpuAction
    * @details [TODO]
-   * 
+   *
    * @param cpu [TODO]
    * @param mask [TODO]
    */
    * @param cpu [TODO]
    * @param mask [TODO]
    */
index b80ddfd..66e5883 100644 (file)
@@ -482,6 +482,7 @@ ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
   xbt_dynar_free(&route);
   XBT_OUT();
 
   xbt_dynar_free(&route);
   XBT_OUT();
 
+  surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate);
   return action;
 }
 
   return action;
 }
 
@@ -530,59 +531,11 @@ void NetworkCm02Link::updateState(tmgr_trace_event_t event_type,
   /*     value, event_type); */
 
   if (event_type == p_power.event) {
   /*     value, event_type); */
 
   if (event_type == p_power.event) {
-    double delta =
-        sg_weight_S_parameter / value - sg_weight_S_parameter /
-        (p_power.peak * p_power.scale);
-    lmm_variable_t var = NULL;
-    lmm_element_t elem = NULL;
-    NetworkCm02ActionPtr action = NULL;
-
-    p_power.peak = value;
-    lmm_update_constraint_bound(getModel()->getMaxminSystem(),
-                                   getConstraint(),
-                                sg_bandwidth_factor *
-                                (p_power.peak * p_power.scale));
-#ifdef HAVE_TRACING
-    TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_power.peak * p_power.scale);
-#endif
-    if (sg_weight_S_parameter > 0) {
-      while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
-        action = (NetworkCm02ActionPtr) lmm_variable_id(var);
-        action->m_weight += delta;
-        if (!action->isSuspended())
-          lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
-      }
-    }
+    updateBandwidth(value, date);
     if (tmgr_trace_event_free(event_type))
       p_power.event = NULL;
   } else if (event_type == p_latEvent) {
     if (tmgr_trace_event_free(event_type))
       p_power.event = NULL;
   } else if (event_type == p_latEvent) {
-    double delta = value - m_latCurrent;
-    lmm_variable_t var = NULL;
-    lmm_element_t elem = NULL;
-    NetworkCm02ActionPtr action = NULL;
-
-    m_latCurrent = value;
-    while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
-      action = (NetworkCm02ActionPtr) lmm_variable_id(var);
-      action->m_latCurrent += delta;
-      action->m_weight += delta;
-      if (action->m_rate < 0)
-        lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), sg_tcp_gamma / (2.0 * action->m_latCurrent));
-      else {
-        lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(),
-                                  min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)));
-
-        if (action->m_rate < sg_tcp_gamma / (2.0 * action->m_latCurrent)) {
-          XBT_INFO("Flow is limited BYBANDWIDTH");
-        } else {
-          XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f",
-                   action->m_latCurrent);
-        }
-      }
-      if (!action->isSuspended())
-        lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
-
-    }
+    updateLatency(value, date);
     if (tmgr_trace_event_free(event_type))
       p_latEvent = NULL;
   } else if (event_type == p_stateEvent) {
     if (tmgr_trace_event_free(event_type))
       p_latEvent = NULL;
   } else if (event_type == p_stateEvent) {
@@ -617,6 +570,60 @@ void NetworkCm02Link::updateState(tmgr_trace_event_t event_type,
   return;
 }
 
   return;
 }
 
+void NetworkCm02Link::updateBandwidth(double value, double date){
+  double delta = sg_weight_S_parameter / value - sg_weight_S_parameter /
+                 (p_power.peak * p_power.scale);
+  lmm_variable_t var = NULL;
+  lmm_element_t elem = NULL;
+  NetworkCm02ActionPtr action = NULL;
+
+  p_power.peak = value;
+  lmm_update_constraint_bound(getModel()->getMaxminSystem(),
+                              getConstraint(),
+                              sg_bandwidth_factor *
+                              (p_power.peak * p_power.scale));
+#ifdef HAVE_TRACING
+  TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_power.peak * p_power.scale);
+#endif
+  if (sg_weight_S_parameter > 0) {
+    while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
+      action = (NetworkCm02ActionPtr) lmm_variable_id(var);
+      action->m_weight += delta;
+      if (!action->isSuspended())
+        lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
+    }
+  }
+}
+
+void NetworkCm02Link::updateLatency(double value, double date){
+  double delta = value - m_latCurrent;
+  lmm_variable_t var = NULL;
+  lmm_element_t elem = NULL;
+  NetworkCm02ActionPtr action = NULL;
+
+  m_latCurrent = value;
+  while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
+    action = (NetworkCm02ActionPtr) lmm_variable_id(var);
+    action->m_latCurrent += delta;
+    action->m_weight += delta;
+    if (action->m_rate < 0)
+      lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), sg_tcp_gamma / (2.0 * action->m_latCurrent));
+    else {
+      lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(),
+                                min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)));
+
+      if (action->m_rate < sg_tcp_gamma / (2.0 * action->m_latCurrent)) {
+        XBT_INFO("Flow is limited BYBANDWIDTH");
+      } else {
+        XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f",
+                 action->m_latCurrent);
+      }
+    }
+    if (!action->isSuspended())
+      lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
+  }
+}
+
 /**********
  * Action *
  **********/
 /**********
  * Action *
  **********/
index b4d4048..c31c1c9 100644 (file)
@@ -80,6 +80,8 @@ public:
                                   tmgr_trace_t lat_trace,
                                e_surf_link_sharing_policy_t policy);
   void updateState(tmgr_trace_event_t event_type, double value, double date);
                                   tmgr_trace_t lat_trace,
                                e_surf_link_sharing_policy_t policy);
   void updateState(tmgr_trace_event_t event_type, double value, double date);
+  void updateBandwidth(double value, double date=surf_get_clock());
+  void updateLatency(double value, double date=surf_get_clock());
 };
 
 
 };
 
 
index d9f36dd..e813122 100644 (file)
@@ -88,6 +88,7 @@ ActionPtr NetworkConstantModel::communicate(RoutingEdgePtr src, RoutingEdgePtr d
   NetworkConstantActionPtr action = new NetworkConstantAction(this, size, sg_latency_factor);
   XBT_OUT();
 
   NetworkConstantActionPtr action = new NetworkConstantAction(this, size, sg_latency_factor);
   XBT_OUT();
 
+  surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate);
   return action;
 }
 
   return action;
 }
 
index 49e4c6d..39195ef 100644 (file)
@@ -19,8 +19,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf,
 
 surf_callback(void, NetworkLinkPtr) networkLinkCreatedCallbacks;
 surf_callback(void, NetworkLinkPtr) networkLinkDestructedCallbacks;
 
 surf_callback(void, NetworkLinkPtr) networkLinkCreatedCallbacks;
 surf_callback(void, NetworkLinkPtr) networkLinkDestructedCallbacks;
-surf_callback(void, NetworkLinkPtr) networkLinkStateChangedCallbacks;
-surf_callback(void, NetworkActionPtr) networkActionStateChangedCallbacks;
+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;
 
 /*********
  * Model *
 
 /*********
  * Model *
@@ -89,8 +90,9 @@ bool NetworkLink::isShared()
 }
 
 void NetworkLink::setState(e_surf_resource_state_t state){
 }
 
 void NetworkLink::setState(e_surf_resource_state_t state){
+  e_surf_resource_state_t old = Resource::getState();
   Resource::setState(state);
   Resource::setState(state);
-  surf_callback_emit(networkLinkStateChangedCallbacks, this);
+  surf_callback_emit(networkLinkStateChangedCallbacks, this, old, state);
 }
 
 /**********
 }
 
 /**********
@@ -98,8 +100,9 @@ void NetworkLink::setState(e_surf_resource_state_t state){
  **********/
 
 void NetworkAction::setState(e_surf_action_state_t state){
  **********/
 
 void NetworkAction::setState(e_surf_action_state_t state){
+  e_surf_action_state_t old = getState();
   Action::setState(state);
   Action::setState(state);
-  surf_callback_emit(networkActionStateChangedCallbacks, this);
+  surf_callback_emit(networkActionStateChangedCallbacks, this, old, state);
 }
 
 #endif /* NETWORK_INTERFACE_CPP_ */
 }
 
 #endif /* NETWORK_INTERFACE_CPP_ */
index 8988357..05792b2 100644 (file)
@@ -27,28 +27,34 @@ typedef NetworkAction *NetworkActionPtr;
  *************/
 
 /** @ingroup SURF_callbacks
  *************/
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after NetworkLink creation *
+ * @brief Callbacks handler which emit the callbacks after NetworkLink creation
  * @details Callback functions have the following signature: `void(NetworkLinkPtr)`
  */
 extern surf_callback(void, NetworkLinkPtr) networkLinkCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @details Callback functions have the following signature: `void(NetworkLinkPtr)`
  */
 extern surf_callback(void, NetworkLinkPtr) networkLinkCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after NetworkLink destruction *
+ * @brief Callbacks handler which emit the callbacks after NetworkLink destruction
  * @details Callback functions have the following signature: `void(NetworkLinkPtr)`
  */
 extern surf_callback(void, NetworkLinkPtr) networkLinkDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @details Callback functions have the following signature: `void(NetworkLinkPtr)`
  */
 extern surf_callback(void, NetworkLinkPtr) networkLinkDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after NetworkLink State changed *
- * @details Callback functions have the following signature: `void(NetworkLinkActionPtr)`
+ * @brief Callbacks handler which emit 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)`
  */
  */
-extern surf_callback(void, NetworkLinkPtr) networkLinkStateChangedCallbacks;
+extern surf_callback(void, NetworkLinkPtr, e_surf_resource_state_t, e_surf_resource_state_t) networkLinkStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
 
 /** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after NetworkAction State changed *
- * @details Callback functions have the following signature: `void(NetworkActionPtr)`
+ * @brief Callbacks handler which emit 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)`
  */
  */
-extern surf_callback(void, NetworkActionPtr) networkActionStateChangedCallbacks;
+extern surf_callback(void, NetworkActionPtr, e_surf_action_state_t, e_surf_action_state_t) networkActionStateChangedCallbacks;
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after communication created
+ * @details Callback functions have the following signature: `void(NetworkActionPtr action, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate)`
+ */
+extern surf_callback(void, NetworkActionPtr, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate) networkCommunicateCallbacks;
 
 /*********
  * Tools *
 
 /*********
  * Tools *
@@ -73,7 +79,7 @@ public:
 
   /**
    * @brief NetworkModel constructor
 
   /**
    * @brief NetworkModel constructor
-   * 
+   *
    * @param name The name of the NetworkModel
    */
   NetworkModel(const char *name) : Model(name) {
    * @param name The name of the NetworkModel
    */
   NetworkModel(const char *name) : Model(name) {
@@ -95,7 +101,7 @@ public:
 
   /**
    * @brief Create a NetworkLink
 
   /**
    * @brief Create a NetworkLink
-   * 
+   *
    * @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 [TODO]
    * @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 [TODO]
@@ -123,11 +129,11 @@ public:
   /**
    * @brief Create a communication between two [TODO]
    * @details [TODO]
   /**
    * @brief Create a communication between two [TODO]
    * @details [TODO]
-   * 
+   *
    * @param src The source [TODO]
    * @param dst The destination [TODO]
    * @param size The size of the communication in bytes
    * @param src The source [TODO]
    * @param dst The destination [TODO]
    * @param size The size of the communication in bytes
-   * @param rate The 
+   * @param rate The
    * @return The action representing the communication
    */
   virtual ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
    * @return The action representing the communication
    */
   virtual ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
@@ -135,7 +141,7 @@ public:
 
   /**
    * @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);
    * @param system The lmm_system_t to solve
    */
   void (*f_networkSolve)(lmm_system_t);
@@ -143,7 +149,7 @@ public:
   /**
    * @brief [brief description]
    * @details [long description]
   /**
    * @brief [brief description]
    * @details [long description]
-   * 
+   *
    * @param size [description]
    * @return [description]
    */
    * @param size [description]
    * @return [description]
    */
@@ -152,7 +158,7 @@ public:
   /**
    * @brief [brief description]
    * @details [long description]
   /**
    * @brief [brief description]
    * @details [long description]
-   * 
+   *
    * @param size [description]
    * @return [description]
    */
    * @param size [description]
    * @return [description]
    */
@@ -161,7 +167,7 @@ public:
   /**
    * @brief [brief description]
    * @details [long description]
   /**
    * @brief [brief description]
    * @details [long description]
-   * 
+   *
    * @param rate [description]
    * @param bound [description]
    * @param size [description]
    * @param rate [description]
    * @param bound [description]
    * @param size [description]
@@ -182,7 +188,7 @@ class NetworkLink : public Resource {
 public:
   /**
    * @brief NetworkLink constructor
 public:
   /**
    * @brief NetworkLink constructor
-   * 
+   *
    * @param model The CpuModel associated to this NetworkLink
    * @param name The name of the NetworkLink
    * @param props Dictionary of properties associated to this NetworkLink
    * @param model The CpuModel associated to this NetworkLink
    * @param name The name of the NetworkLink
    * @param props Dictionary of properties associated to this NetworkLink
@@ -191,7 +197,7 @@ public:
 
   /**
    * @brief NetworkLink constructor
 
   /**
    * @brief NetworkLink constructor
-   * 
+   *
    * @param model The CpuModel associated to this NetworkLink
    * @param name The name of the NetworkLink
    * @param props Dictionary of properties associated to this NetworkLink
    * @param model The CpuModel associated to this NetworkLink
    * @param name The name of the NetworkLink
    * @param props Dictionary of properties associated to this NetworkLink
@@ -211,29 +217,39 @@ public:
 
   /**
    * @brief Get the bandwidth in bytes per second of current NetworkLink
 
   /**
    * @brief Get the bandwidth in bytes per second of current NetworkLink
-   * 
+   *
    * @return The bandwith in bytes per second of the current NetworkLink
    */
   virtual double getBandwidth();
 
    * @return The bandwith in bytes per second of the current NetworkLink
    */
   virtual double getBandwidth();
 
+  /**
+   * @brief Update the bandwidth in bytes per second of current NetworkLink
+   */
+  virtual void updateBandwidth(double value, double date=surf_get_clock())=0;
+
   /**
    * @brief Get the latency in seconds of current NetworkLink
   /**
    * @brief Get the latency in seconds of current NetworkLink
-   * 
+   *
    * @return The latency in seconds of the current NetworkLink
    */
   virtual double getLatency();
 
    * @return The latency in seconds of the current NetworkLink
    */
   virtual double getLatency();
 
+  /**
+   * @brief Update the latency in seconds of current NetworkLink
+   */
+  virtual void updateLatency(double value, double date=surf_get_clock())=0;
+
   /**
    * @brief Check if the NetworkLink is shared
    * @details [long description]
   /**
    * @brief Check if the NetworkLink is shared
    * @details [long description]
-   * 
+   *
    * @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 shared, false otherwise
    */
   virtual bool isShared();
 
   /**
    * @brief Check if the NetworkLink is used
-   * 
+   *
    * @return true if the current NetwokrLink is used, false otherwise
    */
   bool isUsed();
    * @return true if the current NetwokrLink is used, false otherwise
    */
   bool isUsed();
@@ -261,7 +277,7 @@ class NetworkAction : public Action {
 public:
   /**
    * @brief NetworkAction constructor
 public:
   /**
    * @brief NetworkAction constructor
-   * 
+   *
    * @param model The NetworkModel associated to this NetworkAction
    * @param cost The cost of this  NetworkAction in [TODO]
    * @param failed [description]
    * @param model The NetworkModel associated to this NetworkAction
    * @param cost The cost of this  NetworkAction in [TODO]
    * @param failed [description]
@@ -271,7 +287,7 @@ public:
 
   /**
    * @brief NetworkAction constructor
 
   /**
    * @brief NetworkAction constructor
-   * 
+   *
    * @param model The NetworkModel associated to this NetworkAction
    * @param cost The cost of this  NetworkAction in [TODO]
    * @param failed [description]
    * @param model The NetworkModel associated to this NetworkAction
    * @param cost The cost of this  NetworkAction in [TODO]
    * @param failed [description]
index 4fecb0f..b133fb8 100644 (file)
@@ -331,6 +331,7 @@ ActionPtr NetworkNS3Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
   action->p_srcElm = src;
   action->p_dstElm = dst;
 #endif
   action->p_srcElm = src;
   action->p_dstElm = dst;
 #endif
+  surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate);
 
   return (surf_action_t) action;
 }
 
   return (surf_action_t) action;
 }
@@ -427,8 +428,8 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
 NetworkNS3Link::NetworkNS3Link(NetworkNS3ModelPtr model, const char *name, xbt_dict_t props,
                                       double bw_initial, double lat_initial)
  : NetworkLink(model, name, props)
 NetworkNS3Link::NetworkNS3Link(NetworkNS3ModelPtr model, const char *name, xbt_dict_t props,
                                       double bw_initial, double lat_initial)
  : NetworkLink(model, name, props)
- , p_bdw(bprintf("%f", bw_initial))
  , p_lat(bprintf("%f", lat_initial))
  , p_lat(bprintf("%f", lat_initial))
+ , p_bdw(bprintf("%f", bw_initial))
  , m_created(1)
 {
 }
  , m_created(1)
 {
 }
@@ -440,14 +441,6 @@ NetworkNS3Link::~NetworkNS3Link()
 void NetworkNS3Link::updateState(tmgr_trace_event_t event_type, double value, double date)
 {
 
 void NetworkNS3Link::updateState(tmgr_trace_event_t event_type, double value, double date)
 {
 
-}
-double NetworkNS3Link::getLatency()
-{
-
-}
-double NetworkNS3Link::getBandwidth()
-{
-
 }
 
 /**********
 }
 
 /**********
index f5389b8..8aab263 100644 (file)
@@ -61,8 +61,10 @@ public:
   ~NetworkNS3Link();
 
   void updateState(tmgr_trace_event_t event_type, double value, double date);
   ~NetworkNS3Link();
 
   void updateState(tmgr_trace_event_t event_type, double value, double date);
-  double getLatency();
-  double getBandwidth();
+  double getLatency(){THROW_UNIMPLEMENTED;}
+  double getBandwidth(){THROW_UNIMPLEMENTED;}
+  void updateBandwidth(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
+  void updateLatency(double value, double date=surf_get_clock()){THROW_UNIMPLEMENTED;}
 
 //private:
  char *p_id;
 
 //private:
  char *p_id;
index 4c3d591..900f77b 100644 (file)
@@ -122,6 +122,7 @@ int ns3_initialize(const char* TcpProtocol){
   }
 
   XBT_ERROR("The ns3/TcpModel must be : NewReno or Reno or Tahoe");
   }
 
   XBT_ERROR("The ns3/TcpModel must be : NewReno or Reno or Tahoe");
+  return 0;
 }
 
 void * ns3_add_host(const char * id)
 }
 
 void * ns3_add_host(const char * id)
@@ -167,7 +168,7 @@ void * ns3_add_router(const char * id)
        return router;
 }
 
        return router;
 }
 
-void ns3_add_cluster(char * bw,char * lat,const char *id)
+void ns3_add_cluster(char * bw,char * lat,const char *id)
 {
 
        XBT_DEBUG("cluster_id: %s",id);
 {
 
        XBT_DEBUG("cluster_id: %s",id);
@@ -175,7 +176,7 @@ void * ns3_add_cluster(char * bw,char * lat,const char *id)
        XBT_DEBUG("Number of %s nodes: %d",id,Cluster_nodes.GetN() - number_of_clusters_nodes);
 
        NodeContainer Nodes;
        XBT_DEBUG("Number of %s nodes: %d",id,Cluster_nodes.GetN() - number_of_clusters_nodes);
 
        NodeContainer Nodes;
-       int i;
+       unsigned int i;
 
        for(i = number_of_clusters_nodes; i < Cluster_nodes.GetN() ; i++){
                Nodes.Add(Cluster_nodes.Get(i));
 
        for(i = number_of_clusters_nodes; i < Cluster_nodes.GetN() ; i++){
                Nodes.Add(Cluster_nodes.Get(i));
@@ -225,7 +226,7 @@ static char* transformIpv4Address (Ipv4Address from){
                return bprintf("%s",s.c_str());
 }
 
                return bprintf("%s",s.c_str());
 }
 
-void ns3_add_link(int src, e_ns3_network_element_type_t type_src,
+void ns3_add_link(int src, e_ns3_network_element_type_t type_src,
                                        int dst, e_ns3_network_element_type_t type_dst,
                                        char * bw,char * lat)
 {
                                        int dst, e_ns3_network_element_type_t type_dst,
                                        char * bw,char * lat)
 {
@@ -273,7 +274,7 @@ void * ns3_add_link(int src, e_ns3_network_element_type_t type_src,
        }
 }
 
        }
 }
 
-void ns3_end_platform(void)
+void ns3_end_platform(void)
 {
        XBT_DEBUG("InitializeRoutes");
        GlobalRouteManager::BuildGlobalRoutingDatabase();
 {
        XBT_DEBUG("InitializeRoutes");
        GlobalRouteManager::BuildGlobalRoutingDatabase();
index db6b193..8aaf466 100644 (file)
@@ -40,11 +40,11 @@ XBT_PUBLIC(void *) ns3_add_host(const char * id);
 XBT_PUBLIC(void *) ns3_add_host_cluster(const char * id);
 XBT_PUBLIC(void *) ns3_add_router(const char * id);
 XBT_PUBLIC(void *) ns3_add_AS(const char * id);
 XBT_PUBLIC(void *) ns3_add_host_cluster(const char * id);
 XBT_PUBLIC(void *) ns3_add_router(const char * id);
 XBT_PUBLIC(void *) ns3_add_AS(const char * id);
-XBT_PUBLIC(void *) ns3_add_link(int src, e_ns3_network_element_type_t type_src,
+XBT_PUBLIC(void) ns3_add_link(int src, e_ns3_network_element_type_t type_src,
                 int dst, e_ns3_network_element_type_t type_dst,
                 char * bw,char * lat);
                 int dst, e_ns3_network_element_type_t type_dst,
                 char * bw,char * lat);
-XBT_PUBLIC(void *) ns3_end_platform(void);
-XBT_PUBLIC(void *) ns3_add_cluster(char * bw,char * lat,const char *id);
+XBT_PUBLIC(void) ns3_end_platform(void);
+XBT_PUBLIC(void) ns3_add_cluster(char * bw,char * lat,const char *id);
 
 SG_END_DECL()
 
 
 SG_END_DECL()
 
index 993ac0b..4fd94ac 100644 (file)
@@ -8,8 +8,8 @@
 #include "../cpu_cas01.hpp"
 
 /** @addtogroup SURF_plugin_energy
 #include "../cpu_cas01.hpp"
 
 /** @addtogroup SURF_plugin_energy
- *    
- *  
+ *
+ *
  *  BlaBla energy
  */
 
  *  BlaBla energy
  */
 
@@ -31,7 +31,7 @@ static void energyCpuDestructedCallback(CpuPtr cpu){
   surf_energy->erase(cpuIt);
 }
 
   surf_energy->erase(cpuIt);
 }
 
-static void energyCpuActionStateChangedCallback(CpuActionPtr action){
+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];
 
   CpuPtr cpu  = getActionCpu(action);
   CpuEnergyPtr cpu_energy = (*surf_energy)[cpu];
 
index 5e1ef73..d1c824d 100644 (file)
@@ -26,8 +26,8 @@ StorageModelPtr surf_storage_model = NULL;
 
 surf_callback(void, StoragePtr) storageCreatedCallbacks;
 surf_callback(void, StoragePtr) storageDestructedCallbacks;
 
 surf_callback(void, StoragePtr) storageCreatedCallbacks;
 surf_callback(void, StoragePtr) storageDestructedCallbacks;
-surf_callback(void, StoragePtr) storageStateChangedCallbacks;
-surf_callback(void, StorageActionPtr) storageActionStateChangedCallbacks;
+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;
 
 /*********
  * Model *
 
 /*********
  * Model *
@@ -138,8 +138,9 @@ void Storage::updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, d
 
 void Storage::setState(e_surf_resource_state_t state)
 {
 
 void Storage::setState(e_surf_resource_state_t state)
 {
+  e_surf_resource_state_t old = Resource::getState();
   Resource::setState(state);
   Resource::setState(state);
-  surf_callback_emit(storageStateChangedCallbacks, this);
+  surf_callback_emit(storageStateChangedCallbacks, this, old, state);
 }
 
 xbt_dict_t Storage::getContent()
 }
 
 xbt_dict_t Storage::getContent()
@@ -179,6 +180,7 @@ StorageAction::StorageAction(ModelPtr model, double cost, bool failed, lmm_varia
 }
 
 void StorageAction::setState(e_surf_action_state_t state){
 }
 
 void StorageAction::setState(e_surf_action_state_t state){
+  e_surf_action_state_t old = getState();
   Action::setState(state);
   Action::setState(state);
-  surf_callback_emit(storageActionStateChangedCallbacks, this);
+  surf_callback_emit(storageActionStateChangedCallbacks, this, old, state);
 }
 }
index c63d044..d0e7df6 100644 (file)
@@ -48,15 +48,15 @@ extern surf_callback(void, StoragePtr) storageDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Storage State changed *
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Storage State changed *
- * @details Callback functions have the following signature: `void(StorageActionPtr)`
+ * @details Callback functions have the following signature: `void(StorageActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
  */
  */
-extern surf_callback(void, StoragePtr) storageStateChangedCallbacks;
+extern surf_callback(void, StoragePtr, 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 *
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after StorageAction State changed *
- * @details Callback functions have the following signature: `void(StorageActionPtr)`
+ * @details Callback functions have the following signature: `void(StorageActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
  */
  */
-extern surf_callback(void, StorageActionPtr) storageActionStateChangedCallbacks;
+extern surf_callback(void, StorageActionPtr, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks;
 
 /*********
  * Model *
 
 /*********
  * Model *
@@ -79,7 +79,7 @@ public:
 
   /**
    * @brief Create a Storage
 
   /**
    * @brief Create a Storage
-   * 
+   *
    * @param id [description]
    * @param type_id [description]
    * @param content_name [description]
    * @param id [description]
    * @param type_id [description]
    * @param content_name [description]
@@ -109,7 +109,7 @@ class Storage : public Resource {
 public:
   /**
    * @brief Storage constructor
 public:
   /**
    * @brief Storage constructor
-   * 
+   *
    * @param model StorageModel associated to this Storage
    * @param name The name of the Storage
    * @param props Dictionary of properties associated to this Storage
    * @param model StorageModel associated to this Storage
    * @param name The name of the Storage
    * @param props Dictionary of properties associated to this Storage
@@ -124,7 +124,7 @@ public:
 
   /**
    * @brief Storage constructor
 
   /**
    * @brief Storage constructor
-   * 
+   *
    * @param model StorageModel associated to this Storage
    * @param name The name of the Storage
    * @param props Dictionary of properties associated to this Storage
    * @param model StorageModel associated to this Storage
    * @param name The name of the Storage
    * @param props Dictionary of properties associated to this Storage
@@ -151,14 +151,14 @@ public:
 
   /**
    * @brief Check if the Storage is used
 
   /**
    * @brief Check if the Storage is used
-   * 
+   *
    * @return true if the current Storage is used, false otherwise
    */
   bool isUsed();
 
   /**
    * @brief Update the state of the current Storage
    * @return true if the current Storage is used, false otherwise
    */
   bool isUsed();
 
   /**
    * @brief Update the state of the current Storage
-   * 
+   *
    * @param event_type [description]
    * @param value [description]
    * @param date [description]
    * @param event_type [description]
    * @param value [description]
    * @param date [description]
@@ -176,17 +176,17 @@ public:
 
   /**
    * @brief Open a file
 
   /**
    * @brief Open a file
-   * 
+   *
    * @param mount The mount point
    * @param path The path to the file
    * @param mount The mount point
    * @param path The path to the file
-   * 
+   *
    * @return The StorageAction corresponding to the opening
    */
   virtual StorageActionPtr open(const char* mount, const char* path)=0;
 
   /**
    * @brief Close a file
    * @return The StorageAction corresponding to the opening
    */
   virtual StorageActionPtr open(const char* mount, const char* path)=0;
 
   /**
    * @brief Close a file
-   * 
+   *
    * @param fd The file descriptor to close
    * @return The StorageAction corresponding to the closing
    */
    * @param fd The file descriptor to close
    * @return The StorageAction corresponding to the closing
    */
@@ -195,7 +195,7 @@ public:
   /**
    * @brief List directory contents of a path
    * @details [long description]
   /**
    * @brief List directory contents of a path
    * @details [long description]
-   * 
+   *
    * @param path The path to the directory
    * @return The StorageAction corresponding to the ls action
    */
    * @param path The path to the directory
    * @return The StorageAction corresponding to the ls action
    */
@@ -203,7 +203,7 @@ public:
 
   /**
    * @brief Read a file
 
   /**
    * @brief Read a file
-   * 
+   *
    * @param fd The file descriptor to read
    * @param size The size in bytes to read
    * @return The StorageAction corresponding to the reading
    * @param fd The file descriptor to read
    * @param size The size in bytes to read
    * @return The StorageAction corresponding to the reading
@@ -212,7 +212,7 @@ public:
 
   /**
    * @brief Write a file
 
   /**
    * @brief Write a file
-   * 
+   *
    * @param fd The file descriptor to write
    * @param size The size in bytes to write
    * @return The StorageAction corresponding to the writing
    * @param fd The file descriptor to write
    * @param size The size in bytes to write
    * @return The StorageAction corresponding to the writing
@@ -221,14 +221,14 @@ public:
 
   /**
    * @brief Get the content of the current Storage
 
   /**
    * @brief Get the content of the current Storage
-   * 
+   *
    * @return A xbt_dict_t with path as keys and size in bytes as values
    */
   virtual xbt_dict_t getContent();
 
   /**
    * @brief Get the size in bytes of the current Storage
    * @return A xbt_dict_t with path as keys and size in bytes as values
    */
   virtual xbt_dict_t getContent();
 
   /**
    * @brief Get the size in bytes of the current Storage
-   * 
+   *
    * @return The size in bytes of the current Storage
    */
   virtual sg_size_t getSize();
    * @return The size in bytes of the current Storage
    */
   virtual sg_size_t getSize();
@@ -269,7 +269,7 @@ public:
 
   /**
    * @brief StorageAction constructor
 
   /**
    * @brief StorageAction constructor
-   * 
+   *
    * @param model The StorageModel associated to this StorageAction
    * @param cost The cost of this  NetworkAction in [TODO]
    * @param failed [description]
    * @param model The StorageModel associated to this StorageAction
    * @param cost The cost of this  NetworkAction in [TODO]
    * @param failed [description]
@@ -281,7 +281,7 @@ public:
 
     /**
    * @brief StorageAction constructor
 
     /**
    * @brief StorageAction constructor
-   * 
+   *
    * @param model The StorageModel associated to this StorageAction
    * @param cost The cost of this  StorageAction in [TODO]
    * @param failed [description]
    * @param model The StorageModel associated to this StorageAction
    * @param cost The cost of this  StorageAction in [TODO]
    * @param failed [description]
index 6be998b..56454da 100644 (file)
@@ -260,7 +260,7 @@ static const char *disk_drives_letter_table[MAX_DRIVE] = {
   "Y:\\",
   "Z:\\"
 };
   "Y:\\",
   "Z:\\"
 };
-#endif  
+#endif
 
 /*
  * Returns the initial path. On Windows the initial path is
 
 /*
  * Returns the initial path. On Windows the initial path is
@@ -872,8 +872,8 @@ void Action::setBound(double bound)
   if (p_variable)
     lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), bound);
 
   if (p_variable)
     lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), bound);
 
-  if (getModel()->getUpdateMechanism() == UM_LAZY)
-       heapRemove(getModel()->getActionHeap());
+  if (getModel()->getUpdateMechanism() == UM_LAZY && getLastUpdate()!=surf_get_clock())
+         heapRemove(getModel()->getActionHeap());
   XBT_OUT();
 }
 
   XBT_OUT();
 }
 
index b04b719..dae99c9 100644 (file)
@@ -22,8 +22,8 @@ WorkstationModelPtr surf_workstation_model = NULL;
 
 surf_callback(void, WorkstationPtr) workstationCreatedCallbacks;
 surf_callback(void, WorkstationPtr) workstationDestructedCallbacks;
 
 surf_callback(void, WorkstationPtr) workstationCreatedCallbacks;
 surf_callback(void, WorkstationPtr) workstationDestructedCallbacks;
-surf_callback(void, WorkstationPtr) workstationStateChangedCallbacks;
-surf_callback(void, WorkstationActionPtr) workstationActionStateChangedCallbacks;
+surf_callback(void, WorkstationPtr, e_surf_resource_state_t, e_surf_resource_state_t) workstationStateChangedCallbacks;
+surf_callback(void, WorkstationActionPtr, e_surf_action_state_t, e_surf_action_state_t) workstationActionStateChangedCallbacks;
 
 /*********
  * Model *
 
 /*********
  * Model *
@@ -112,8 +112,9 @@ Workstation::~Workstation(){
 }
 
 void Workstation::setState(e_surf_resource_state_t state){
 }
 
 void Workstation::setState(e_surf_resource_state_t state){
+  e_surf_resource_state_t old = Resource::getState();
   Resource::setState(state);
   Resource::setState(state);
-  surf_callback_emit(workstationStateChangedCallbacks, this);
+  surf_callback_emit(workstationStateChangedCallbacks, this, old, state);
 }
 
 int Workstation::getCore(){
 }
 
 int Workstation::getCore(){
@@ -507,6 +508,7 @@ void Workstation::setParams(ws_params_t params)
  **********/
 
 void WorkstationAction::setState(e_surf_action_state_t state){
  **********/
 
 void WorkstationAction::setState(e_surf_action_state_t state){
+  e_surf_action_state_t old = getState();
   Action::setState(state);
   Action::setState(state);
-  surf_callback_emit(workstationActionStateChangedCallbacks, this);
+  surf_callback_emit(workstationActionStateChangedCallbacks, this, old, state);
 }
 }
index c472d37..799ee13 100644 (file)
@@ -43,15 +43,15 @@ extern surf_callback(void, WorkstationPtr) workstationDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Workstation State changed *
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Workstation State changed *
- * @details Callback functions have the following signature: `void(WorkstationActionPtr)`
+ * @details Callback functions have the following signature: `void(WorkstationActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
  */
  */
-extern surf_callback(void, WorkstationPtr) workstationStateChangedCallbacks;
+extern surf_callback(void, WorkstationPtr, e_surf_resource_state_t, e_surf_resource_state_t) workstationStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after WorkstationAction State changed *
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after WorkstationAction State changed *
- * @details Callback functions have the following signature: `void(WorkstationActionPtr)`
+ * @details Callback functions have the following signature: `void(WorkstationActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
  */
  */
-extern surf_callback(void, WorkstationActionPtr) workstationActionStateChangedCallbacks;
+extern surf_callback(void, WorkstationActionPtr, e_surf_action_state_t, e_surf_action_state_t) workstationActionStateChangedCallbacks;
 
 /*********
  * Tools *
 
 /*********
  * Tools *
@@ -67,9 +67,9 @@ extern WorkstationModelPtr surf_workstation_model;
  */
 class WorkstationModel : public Model {
 public:
  */
 class WorkstationModel : public Model {
 public:
-    /** 
+    /**
    * @brief WorkstationModel constructor
    * @brief WorkstationModel constructor
-   * 
+   *
    * @param name the name of the model
    */
   WorkstationModel(const char *name);
    * @param name the name of the model
    */
   WorkstationModel(const char *name);
@@ -89,11 +89,11 @@ public:
    * @details [long description]
    */
   virtual void adjustWeightOfDummyCpuActions();
    * @details [long description]
    */
   virtual void adjustWeightOfDummyCpuActions();
-  
+
   /**
    * @brief [brief description]
    * @details [long description]
   /**
    * @brief [brief description]
    * @details [long description]
-   * 
+   *
    * @param workstation_nb [description]
    * @param workstation_list [description]
    * @param computation_amount [description]
    * @param workstation_nb [description]
    * @param workstation_list [description]
    * @param computation_amount [description]
@@ -110,7 +110,7 @@ public:
  /**
   * @brief [brief description]
   * @details [long description]
  /**
   * @brief [brief description]
   * @details [long description]
-  * 
+  *
   * @param src [description]
   * @param dst [description]
   * @param size [description]
   * @param src [description]
   * @param dst [description]
   * @param size [description]
@@ -138,7 +138,7 @@ public:
 
   /**
    * @brief Workstation constructor
 
   /**
    * @brief Workstation constructor
-   * 
+   *
    * @param model WorkstationModel associated to this Workstation
    * @param name The name of the Workstation
    * @param props Dictionary of properties associated to this Workstation
    * @param model WorkstationModel associated to this Workstation
    * @param name The name of the Workstation
    * @param props Dictionary of properties associated to this Workstation
@@ -151,7 +151,7 @@ public:
 
   /**
    * @brief Workstation constructor
 
   /**
    * @brief Workstation constructor
-   * 
+   *
    * @param model WorkstationModel associated to this Workstation
    * @param name The name of the Workstation
    * @param props Dictionary of properties associated to this Workstation
    * @param model WorkstationModel associated to this Workstation
    * @param name The name of the Workstation
    * @param props Dictionary of properties associated to this Workstation
@@ -179,7 +179,7 @@ public:
 
   /**
    * @brief Execute some quantity of computation
 
   /**
    * @brief Execute some quantity of computation
-   * 
+   *
    * @param size The value of the processing amount (in flop) needed to process
    * @return The CpuAction corresponding to the processing
    * @see Cpu
    * @param size The value of the processing amount (in flop) needed to process
    * @return The CpuAction corresponding to the processing
    * @see Cpu
@@ -188,7 +188,7 @@ public:
 
   /**
    * @brief Make a process sleep for duration seconds
 
   /**
    * @brief Make a process sleep for duration seconds
-   * 
+   *
    * @param duration The number of seconds to sleep
    * @return The CpuAction corresponding to the sleeping
    * @see Cpu
    * @param duration The number of seconds to sleep
    * @return The CpuAction corresponding to the sleeping
    * @see Cpu
@@ -197,7 +197,7 @@ public:
 
   /**
    * @brief Get the number of cores of the associated Cpu
 
   /**
    * @brief Get the number of cores of the associated Cpu
-   * 
+   *
    * @return The number of cores of the associated Cpu
    * @see Cpu
    */
    * @return The number of cores of the associated Cpu
    * @see Cpu
    */
@@ -205,7 +205,7 @@ public:
 
   /**
    * @brief Get the speed of the associated Cpu
 
   /**
    * @brief Get the speed of the associated Cpu
-   * 
+   *
    * @param load [TODO]
    * @return The speed of the associated Cpu
    * @see Cpu
    * @param load [TODO]
    * @return The speed of the associated Cpu
    * @see Cpu
@@ -215,7 +215,7 @@ public:
   /**
    * @brief Get the available speed of the associated Cpu
    * @details [TODO]
   /**
    * @brief Get the available speed of the associated Cpu
    * @details [TODO]
-   * 
+   *
    * @return The available speed of the associated Cpu
    * @see Cpu
    */
    * @return The available speed of the associated Cpu
    * @see Cpu
    */
@@ -223,7 +223,7 @@ public:
 
   /**
    * @brief Get the associated Cpu power peak
 
   /**
    * @brief Get the associated Cpu power peak
-   * 
+   *
    * @return The associated Cpu power peak
    * @see Cpu
    */
    * @return The associated Cpu power peak
    * @see Cpu
    */
@@ -235,7 +235,7 @@ public:
 
   /**
    * @brief Return the storage of corresponding mount point
 
   /**
    * @brief Return the storage of corresponding mount point
-   * 
+   *
    * @param storage The mount point
    * @return The corresponding Storage
    */
    * @param storage The mount point
    * @return The corresponding Storage
    */
@@ -243,7 +243,7 @@ public:
 
   /**
    * @brief Get the xbt_dict_t of mount_point: Storage
 
   /**
    * @brief Get the xbt_dict_t of mount_point: Storage
-   * 
+   *
    * @return The xbt_dict_t of mount_point: Storage
    */
   virtual xbt_dict_t getMountedStorageList();
    * @return The xbt_dict_t of mount_point: Storage
    */
   virtual xbt_dict_t getMountedStorageList();
@@ -257,16 +257,16 @@ public:
 
   /**
    * @brief Open a file
 
   /**
    * @brief Open a file
-   * 
+   *
    * @param fullpath The full path to the file
    * @param fullpath The full path to the file
-   * 
+   *
    * @return The StorageAction corresponding to the opening
    */
   virtual ActionPtr open(const char* fullpath);
 
   /**
    * @brief Close a file
    * @return The StorageAction corresponding to the opening
    */
   virtual ActionPtr open(const char* fullpath);
 
   /**
    * @brief Close a file
-   * 
+   *
    * @param fd The file descriptor to close
    * @return The StorageAction corresponding to the closing
    */
    * @param fd The file descriptor to close
    * @return The StorageAction corresponding to the closing
    */
@@ -275,7 +275,7 @@ public:
   /**
    * @brief Unlink a file
    * @details [long description]
   /**
    * @brief Unlink a file
    * @details [long description]
-   * 
+   *
    * @param fd [description]
    * @return [description]
    */
    * @param fd [description]
    * @return [description]
    */
@@ -284,7 +284,7 @@ public:
   /**
    * @brief List directory contents of a path
    * @details [long description]
   /**
    * @brief List directory contents of a path
    * @details [long description]
-   * 
+   *
    * @param mount [description]
    * @param path The path to the directory
    * @return The StorageAction corresponding to the ls action
    * @param mount [description]
    * @param path The path to the directory
    * @return The StorageAction corresponding to the ls action
@@ -293,7 +293,7 @@ public:
 
   /**
    * @brief Get the size in bytes of the file
 
   /**
    * @brief Get the size in bytes of the file
-   * 
+   *
    * @param fd The file descriptor to read
    * @return The size in bytes of the file
    */
    * @param fd The file descriptor to read
    * @return The size in bytes of the file
    */
@@ -301,7 +301,7 @@ public:
 
   /**
    * @brief Read a file
 
   /**
    * @brief Read a file
-   * 
+   *
    * @param fd The file descriptor to read
    * @param size The size in bytes to read
    * @return The StorageAction corresponding to the reading
    * @param fd The file descriptor to read
    * @param size The size in bytes to read
    * @return The StorageAction corresponding to the reading
@@ -310,7 +310,7 @@ public:
 
   /**
    * @brief Write a file
 
   /**
    * @brief Write a file
-   * 
+   *
    * @param fd The file descriptor to write
    * @param size The size in bytes to write
    * @return The StorageAction corresponding to the writing
    * @param fd The file descriptor to write
    * @param size The size in bytes to write
    * @return The StorageAction corresponding to the writing
@@ -325,7 +325,7 @@ public:
    *  - the storage name,
    *  - the storage typeId,
    *  - the storage content type
    *  - the storage name,
    *  - the storage typeId,
    *  - the storage content type
-   * 
+   *
    * @param fd The file descriptor
    * @return An xbt_dynar_t with the file informations
    */
    * @param fd The file descriptor
    * @return An xbt_dynar_t with the file informations
    */
@@ -333,15 +333,15 @@ public:
 
   /**
    * @brief Get the current position of the file descriptor
 
   /**
    * @brief Get the current position of the file descriptor
-   *  
+   *
    * @param fd The file descriptor
    * @return The current position of the file descriptor
    */
   virtual sg_size_t fileTell(surf_file_t fd);
 
   /**
    * @param fd The file descriptor
    * @return The current position of the file descriptor
    */
   virtual sg_size_t fileTell(surf_file_t fd);
 
   /**
-   * @brief Get the available space of the storage at the mount point 
-   * 
+   * @brief Get the available space of the storage at the mount point
+   *
    * @param name The mount point
    * @return The amount of availble space in bytes
    */
    * @param name The mount point
    * @return The amount of availble space in bytes
    */
@@ -349,7 +349,7 @@ public:
 
   /**
    * @brief Get the used space of the storage at the mount point
 
   /**
    * @brief Get the used space of the storage at the mount point
-   * 
+   *
    * @param name The mount point
    * @return The amount of used space in bytes
    */
    * @param name The mount point
    * @return The amount of used space in bytes
    */
@@ -358,7 +358,7 @@ public:
   /**
    * @brief Set the position indictator assiociated with the file descriptor to a new position
    * @details [long description]
   /**
    * @brief Set the position indictator assiociated with the file descriptor to a new position
    * @details [long description]
-   * 
+   *
    * @param fd The file descriptor
    * @param offset The offset from the origin
    * @param origin Position used as a reference for the offset
    * @param fd The file descriptor
    * @param offset The offset from the origin
    * @param origin Position used as a reference for the offset
@@ -398,7 +398,7 @@ public:
 
   /**
    * @brief Get the list of virtual machines on the current Workstation
 
   /**
    * @brief Get the list of virtual machines on the current Workstation
-   * 
+   *
    * @return The list of VMs
    */
   xbt_dynar_t getVms();
    * @return The list of VMs
    */
   xbt_dynar_t getVms();
@@ -407,7 +407,7 @@ public:
   /**
    * @brief [brief description]
    * @details [long description]
   /**
    * @brief [brief description]
    * @details [long description]
-   * 
+   *
    * @param params [description]
    */
   void getParams(ws_params_t params);
    * @param params [description]
    */
   void getParams(ws_params_t params);
@@ -415,7 +415,7 @@ public:
   /**
    * @brief [brief description]
    * @details [long description]
   /**
    * @brief [brief description]
    * @details [long description]
-   * 
+   *
    * @param params [description]
    */
   void setParams(ws_params_t params);
    * @param params [description]
    */
   void setParams(ws_params_t params);
@@ -433,7 +433,7 @@ class WorkstationAction : public Action {
 public:
   /**
    * @brief WorkstationAction constructor
 public:
   /**
    * @brief WorkstationAction constructor
-   * 
+   *
    * @param model The WorkstationModel associated to this WorkstationAction
    * @param cost The cost of this WorkstationAction in [TODO]
    * @param failed [description]
    * @param model The WorkstationModel associated to this WorkstationAction
    * @param cost The cost of this WorkstationAction in [TODO]
    * @param failed [description]
@@ -443,7 +443,7 @@ public:
 
   /**
    * @brief WorkstationAction constructor
 
   /**
    * @brief WorkstationAction constructor
-   * 
+   *
    * @param model The WorkstationModel associated to this WorkstationAction
    * @param cost The cost of this WorkstationAction in [TODO]
    * @param failed [description]
    * @param model The WorkstationModel associated to this WorkstationAction
    * @param cost The cost of this WorkstationAction in [TODO]
    * @param failed [description]
index f44c1a1..71d2a57 100644 (file)
@@ -502,20 +502,11 @@ void CpuL07::updateState(tmgr_trace_event_t event_type, double value, double /*d
 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) {
 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) {
-    m_bwCurrent = value;
-    lmm_update_constraint_bound(ptask_maxmin_system, getConstraint(), m_bwCurrent);
+    updateBandwidth(value, date);
     if (tmgr_trace_event_free(event_type))
       p_bwEvent = NULL;
   } else if (event_type == p_latEvent) {
     if (tmgr_trace_event_free(event_type))
       p_bwEvent = NULL;
   } else if (event_type == p_latEvent) {
-    lmm_variable_t var = NULL;
-    WorkstationL07ActionPtr action;
-    lmm_element_t elem = NULL;
-
-    m_latCurrent = value;
-    while ((var = lmm_get_var_from_cnst(ptask_maxmin_system, getConstraint(), &elem))) {
-      action = (WorkstationL07ActionPtr) lmm_variable_id(var);
-      action->updateBound();
-    }
+    updateLatency(value, date);
     if (tmgr_trace_event_free(event_type))
       p_latEvent = NULL;
   } else if (event_type == p_stateEvent) {
     if (tmgr_trace_event_free(event_type))
       p_latEvent = NULL;
   } else if (event_type == p_stateEvent) {
@@ -582,11 +573,31 @@ double LinkL07::getBandwidth()
   return m_bwCurrent;
 }
 
   return m_bwCurrent;
 }
 
+void LinkL07::updateBandwidth(double value, double date)
+{
+  m_bwCurrent = value;
+  lmm_update_constraint_bound(ptask_maxmin_system, getConstraint(), m_bwCurrent);
+}
+
 double LinkL07::getLatency()
 {
   return m_latCurrent;
 }
 
 double LinkL07::getLatency()
 {
   return m_latCurrent;
 }
 
+void LinkL07::updateLatency(double value, double date)
+{
+  lmm_variable_t var = NULL;
+  WorkstationL07ActionPtr action;
+  lmm_element_t elem = NULL;
+
+  m_latCurrent = value;
+  while ((var = lmm_get_var_from_cnst(ptask_maxmin_system, getConstraint(), &elem))) {
+    action = (WorkstationL07ActionPtr) lmm_variable_id(var);
+    action->updateBound();
+  }
+}
+
+
 bool LinkL07::isShared()
 {
   return lmm_constraint_is_shared(getConstraint());
 bool LinkL07::isShared()
 {
   return lmm_constraint_is_shared(getConstraint());
index 360a851..9bcac9f 100644 (file)
@@ -164,6 +164,8 @@ public:
   double getBandwidth();
   double getLatency();
   bool isShared();
   double getBandwidth();
   double getLatency();
   bool isShared();
+  void updateBandwidth(double value, double date=surf_get_clock());
+  void updateLatency(double value, double date=surf_get_clock());
 
   double m_latCurrent;
   tmgr_trace_event_t p_latEvent;
 
   double m_latCurrent;
   tmgr_trace_event_t p_latEvent;
index 014b8b8..74ed341 100644 (file)
@@ -123,6 +123,10 @@ void *mmorecore(struct mdesc *mdp, ssize_t size)
         abort();
       }
 
         abort();
       }
 
+#ifdef MADV_MERGEABLE
+      madvise(mapto, mapbytes, MADV_MERGEABLE);
+#endif
+
       if (mdp->top == 0)
         mdp->base = mdp->breakval = mapto;
 
       if (mdp->top == 0)
         mdp->base = mdp->breakval = mapto;
 
diff --git a/teshsuite/bug-17132/CMakeLists.txt b/teshsuite/bug-17132/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d2d8163
--- /dev/null
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 2.6)
+
+if(enable_smpi)
+  if(WIN32)
+      set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h")
+  else()
+      set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc")
+  endif()
+       
+       
+  set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+  add_executable(bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132.c)
+  target_link_libraries(bug-17132 simgrid)
+
+  set(tesh_files
+    ${tesh_files}
+    ${CMAKE_CURRENT_SOURCE_DIR}/bug-17132.tesh
+    PARENT_SCOPE)
+  set(xml_files
+    ${xml_files}
+    ${CMAKE_CURRENT_SOURCE_DIR}/small_platform.xml
+    PARENT_SCOPE)
+  set(teshsuite_src
+    ${teshsuite_src}
+    ${CMAKE_CURRENT_SOURCE_DIR}/bug-17132.c
+    PARENT_SCOPE)
+  set(bin_files
+    ${bin_files}
+    PARENT_SCOPE)
+  set(txt_files
+    ${txt_files}
+    ${CMAKE_CURRENT_SOURCE_DIR}/hostfile.txt
+    ${CMAKE_CURRENT_SOURCE_DIR}/README
+    PARENT_SCOPE)
+    
+endif(enable_smpi)
diff --git a/teshsuite/bug-17132/README b/teshsuite/bug-17132/README
new file mode 100644 (file)
index 0000000..22e35b9
--- /dev/null
@@ -0,0 +1,8 @@
+This is the bug #17132 described on gforge [1]. This small SMPI code
+triggers an issue in SURF, which is still to be debugged.
+
+The problem seems to be related to the order of events, as changing it
+(with another platform or another message size or a MPI_barrier in
+between) fixes the problem.
+
+[1] https://gforge.inria.fr/tracker/index.php?func=detail&aid=17132&group_id=12&atid=165
\ No newline at end of file
diff --git a/teshsuite/bug-17132/bug-17132.c b/teshsuite/bug-17132/bug-17132.c
new file mode 100644 (file)
index 0000000..cecb3e4
--- /dev/null
@@ -0,0 +1,40 @@
+#include "xbt/log.h"
+#include <stdio.h>
+#include <mpi.h>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(MM_mpi, "Messages for this SMPI test");
+
+int main(int argc, char ** argv)
+{
+  size_t err;
+  size_t M = 8*1024;
+  size_t N = 32*1024;
+
+  MPI_Init(&argc, &argv);
+
+  double *a = malloc(sizeof(double) * M);
+  double *b = malloc(sizeof(double) * N);
+
+  // A broadcast
+  err = MPI_Bcast(a, M, MPI_DOUBLE, 0, MPI_COMM_WORLD);
+  if (err != MPI_SUCCESS) {
+    perror("Error Bcast A\n"); MPI_Finalize(); exit(-1);
+  }
+
+//  Uncommenting this barrier fixes it!
+//  MPI_Barrier(MPI_COMM_WORLD);
+
+  // Another broadcast
+  err = MPI_Bcast(b, N, MPI_DOUBLE, 0, MPI_COMM_WORLD );
+  if (err != MPI_SUCCESS) {
+    perror("Error Bcast B\n"); MPI_Finalize(); exit(-1);
+  }
+
+  // Commenting out this barrier fixes it!!
+  MPI_Barrier(MPI_COMM_WORLD);
+
+  MPI_Finalize();
+  free(a);
+  free(b);
+  return 0;
+}
diff --git a/teshsuite/bug-17132/bug-17132.tesh b/teshsuite/bug-17132/bug-17132.tesh
new file mode 100644 (file)
index 0000000..d167f08
--- /dev/null
@@ -0,0 +1,8 @@
+$ ../../smpi_script/bin/smpirun -np 16 -platform ${srcdir:=.}/small_platform.xml -hostfile ${srcdir:=.}/hostfile.txt ./bug-17132 --cfg=smpi/cpu_threshold:-1 --log=smpi_kernel.thres:warning
+> You requested to use 16 processes, but there is only 2 processes in your hostfile...
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/cpu_threshold' to '-1'
+> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
+> (some sensible output)
diff --git a/teshsuite/bug-17132/hostfile.txt b/teshsuite/bug-17132/hostfile.txt
new file mode 100644 (file)
index 0000000..994b3e2
--- /dev/null
@@ -0,0 +1,2 @@
+host1
+host2
diff --git a/teshsuite/bug-17132/small_platform.xml b/teshsuite/bug-17132/small_platform.xml
new file mode 100644 (file)
index 0000000..a2b420d
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version='3'>
+ <AS id='AS0' routing='Full'>
+
+  <host id='host1' power='1.0'/>
+  <host id='host2' power='1.0'/>
+  <link id='link' bandwidth='1e+10' latency='1e-09'/>
+
+  <route src='host1' dst='host2' symmetrical="YES">
+       <link_ctn id='link'/>
+  </route>
+
+ </AS>
+</platform>
index 2606c83..a0df41e 100644 (file)
@@ -1,5 +1,10 @@
 ! expect signal SIGSEGV
 $ ./simix/stack_overflow --cfg=contexts/stack_size:96 ${srcdir:=.}/simix/stack_overflow.xml
 > [Tremblay:master:(0) 0.000000] [test/INFO] Launching our nice bugged recursive function...
 ! expect signal SIGSEGV
 $ ./simix/stack_overflow --cfg=contexts/stack_size:96 ${srcdir:=.}/simix/stack_overflow.xml
 > [Tremblay:master:(0) 0.000000] [test/INFO] Launching our nice bugged recursive function...
-> Access violation detected. This can result from a stack overflow.
+> Access violation detected.
+> This can result from a programming error in your code or, although less likely,
+> from a bug in SimGrid itself.  This can also be the sign of a bug in the OS or
+> in third-party libraries.  Failing hardware can sometimes generate such errors
+> too.
+> Finally, if nothing of the above applies, this can result from a stack overflow.
 > Try to increase stack size with --cfg=contexts/stack_size (current size is 96 KiB).
 > Try to increase stack size with --cfg=contexts/stack_size (current size is 96 KiB).
index 7def465..8fa09c5 100644 (file)
@@ -96,7 +96,7 @@ void test_deref(mc_expression_state_t state) {
 
   Dwarf_Op ops[60];
   ops[0].atom = DW_OP_const8u;
 
   Dwarf_Op ops[60];
   ops[0].atom = DW_OP_const8u;
-  ops[0].number = (Dwarf_Word) &foo;
+  ops[0].number = (uintptr_t) &foo;
   ops[1].atom = DW_OP_deref;
   state->stack_size = 0;
 
   ops[1].atom = DW_OP_deref;
   state->stack_size = 0;