Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 10 Oct 2017 06:11:14 +0000 (08:11 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 10 Oct 2017 06:11:14 +0000 (08:11 +0200)
21 files changed:
examples/java/app/pingpong/Main.java
examples/java/cloud/masterworker/Main.java
examples/java/cloud/migration/Daemon.java
examples/java/cloud/migration/XVM.java
examples/java/dht/kademlia/Node.java
examples/java/process/kill/Main.java
examples/java/process/suspend/Main.java
examples/java/trace/pingpong/Main.java
examples/java/trace/pingpong/Receiver.java
examples/java/trace/pingpong/Sender.java
include/simgrid/chrono.hpp
include/simgrid/kernel/future.hpp
include/simgrid/simix.h
include/xbt/backtrace.h
src/mc/DwarfExpression.hpp
src/mc/VisitedState.hpp
src/mc/checker/LivenessChecker.hpp
src/mc/mc_state.h
src/surf/ns3/ns3_simulator.cpp [moved from src/surf/ns3/ns3_simulator.cc with 96% similarity]
src/xbt/config.cpp
tools/cmake/DefinePackages.cmake

index 8e56aed..2030da9 100644 (file)
@@ -25,8 +25,8 @@ class Main {
     
     File f = new File(platfFile); 
     if (!f.exists()) {
-       System.err.println("File "+platfFile+" does not exist in "+System.getProperty("user.dir"));
-       System.err.println("Usage  : Main ../platforms/platform.xml");
+      Msg.error("File " + platfFile + " does not exist in " + System.getProperty("user.dir"));
+      Msg.error("Usage  : Main ../platforms/platform.xml");
     }
     
     Msg.createEnvironment(platfFile);
index a99dc21..5623ffa 100644 (file)
@@ -29,8 +29,8 @@ class Main {
     
     File f = new File(platfFile); 
     if (!f.exists()) {
-       System.err.println("File "+platfFile+" does not exist in "+System.getProperty("user.dir"));
-       System.err.println("Usage  : Main ../platforms/platform.xml");
+      Msg.error("File " + platfFile + " does not exist in " + System.getProperty("user.dir"));
+      Msg.error("Usage  : Main ../platforms/platform.xml");
     }
     
     Msg.createEnvironment(platfFile);
index d3c2af2..6e1bae9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014. The SimGrid Team.
+/* Copyright (c) 2014-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@ public class Daemon extends Process {
     } catch (HostFailureException e) {
       e.printStackTrace();
     } catch (TaskCancelledException e) {
-      System.out.println("task cancelled");
+      Msg.info("task cancelled");
       suspend(); // Suspend the process
     }
     currentTask = new Task(this.getHost().getName()+"-daemon-"+(i++), this.getHost().getSpeed()*100, 0);
index 414c980..10407a6 100644 (file)
@@ -47,7 +47,7 @@ public class XVM extends VM {
   }
 
   public int getLoad(){
-    System.out.println("Remaining comp:" + this.daemon.getRemaining());
+    Msg.info("Remaining comp:" + this.daemon.getRemaining());
     return this.currentLoad;
   }
 
index 841e9d1..a690a01 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, 2016. The SimGrid Team.
+/* Copyright (c) 2012-2014, 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -77,6 +77,7 @@ public class Node extends Process {
         }
       }
       catch (Exception e) {
+        Msg.debug("Caught exception: " + e);
       }
     }
     Msg.info(findNodeSuccedded + "/"  + (findNodeSuccedded + findNodeFailed) + " FIND_NODE have succedded.");
@@ -256,6 +257,7 @@ public class Node extends Process {
         waitFor(1);
       }
       catch (Exception ex) {
+        Msg.debug("Caught exception: " + ex);
       }
     } while (Msg.getClock() < timeout && !destinationFound);
   }
index 71d281b..96cf864 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2014. The SimGrid Team.
+/* Copyright (c) 2006-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@ public class Main {
       Killer killer = new Killer("Jacquelin","killer");
       killer.start();
     } catch (MsgException e){
-      System.out.println("Create processes failed!");
+      Msg.error("Create processes failed!");
     }
 
     /*  execute the simulation. */
index 04510e8..3eb4064 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2014, 2016. The SimGrid Team.
+/* Copyright (c) 2006-2014, 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -25,9 +25,9 @@ public class Main {
     try {
         DreamMaster process1 = new DreamMaster("Jacquelin","DreamMaster");
         process1.start();
-      } catch (MsgException e){
-        System.out.println("Create processes failed!");
-      }
+    } catch (MsgException e){
+      Msg.error("Create processes failed!");
+    }
 
     /*  execute the simulation. */
     Msg.run();
index 782f68f..37f866f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2007, 2012-2014, 2016. The SimGrid Team.
+/* Copyright (c) 2006-2007, 2012-2014, 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -10,6 +10,8 @@ import org.simgrid.msg.MsgException;
 import org.simgrid.trace.Trace;
 
 public class Main  {
+  public static final String PM_STATE = "PM_STATE";
+
   private Main() {
     throw new IllegalAccessError("Utility class");
   }
@@ -29,11 +31,11 @@ public class Main  {
     new Receiver ("Tremblay", "Receiver", null).start();
 
     /* Initialize some state for the hosts */
-    Trace.hostStateDeclare ("PM_STATE"); 
-    Trace.hostStateDeclareValue ("PM_STATE", "waitingPing", "0 0 1");
-    Trace.hostStateDeclareValue ("PM_STATE", "sendingPong", "0 1 0");
-    Trace.hostStateDeclareValue ("PM_STATE", "sendingPing", "0 1 1");
-    Trace.hostStateDeclareValue ("PM_STATE", "waitingPong", "1 0 0");
+    Trace.hostStateDeclare (PM_STATE);
+    Trace.hostStateDeclareValue (PM_STATE, "waitingPing", "0 0 1");
+    Trace.hostStateDeclareValue (PM_STATE, "sendingPong", "0 1 0");
+    Trace.hostStateDeclareValue (PM_STATE, "sendingPing", "0 1 1");
+    Trace.hostStateDeclareValue (PM_STATE, "waitingPong", "1 0 0");
 
     /*  execute the simulation. */
     Msg.run();
index 4a1f26e..58e82b9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2007, 2012-2014, 2016. The SimGrid Team.
+/* Copyright (c) 2006-2007, 2012-2014, 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -15,6 +15,7 @@ import org.simgrid.trace.Trace;
 public class Receiver extends Process {
   private static final double COMM_SIZE_LAT = 1;
   private static final double COMM_SIZE_BW = 100000000;
+  private static final String PM_STATE = Main.PM_STATE;
 
   public Receiver(String hostname, String name, String[]args) throws HostNotFoundException {
     super(hostname,name,args);
@@ -22,7 +23,7 @@ public class Receiver extends Process {
 
   public void main(String[] args) throws MsgException {
     Msg.info("hello!");
-    Trace.hostPushState (getHost().getName(), "PM_STATE", "waitingPing");
+    Trace.hostPushState (getHost().getName(), PM_STATE, "waitingPing");
 
     /* Wait for the ping */ 
     Msg.info("try to get a task");
@@ -41,15 +42,15 @@ public class Receiver extends Process {
     Msg.info(" --- bw "+ COMM_SIZE_BW/communicationTime + " ----");
 
     /* Send the pong */
-    Trace.hostPushState (getHost().getName(), "PM_STATE", "sendingPong");
+    Trace.hostPushState (getHost().getName(), PM_STATE, "sendingPong");
     double computeDuration = 0;
     PingPongTask pong = new PingPongTask("no name",computeDuration,COMM_SIZE_LAT);
     pong.setTime(time);
     pong.send(ping.getSource().getName());
 
     /* Pop the two states */
-    Trace.hostPopState (getHost().getName(), "PM_STATE");
-    Trace.hostPopState (getHost().getName(), "PM_STATE");
+    Trace.hostPopState (getHost().getName(), PM_STATE);
+    Trace.hostPopState (getHost().getName(), PM_STATE);
 
     Msg.info("goodbye!");
   }
index 6af47fa..c97be48 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2014, 2016. The SimGrid Team.
+/* Copyright (c) 2006-2014, 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -16,7 +16,7 @@ import org.simgrid.trace.Trace;
 public class Sender extends Process {
   private static final double COMM_SIZE_LAT = 1;
   private static final double COMM_SIZE_BW = 100000000;
-  private static final String PM_STATE = "PM_STATE";
+  private static final String PM_STATE = Main.PM_STATE;
 
   public Sender(String hostname, String name, String[] args) throws HostNotFoundException {
     super(hostname,name,args);
index d3759ca..8f5b480 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2016-2017. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -37,7 +37,8 @@ namespace simgrid {
  * @endcode
  *
  */
-struct SimulationClock {
+class SimulationClock {
+public:
   using rep        = double;
   using period     = std::ratio<1>;
   using duration   = std::chrono::duration<rep, period>;
index 766d425..a4db6ec 100644 (file)
@@ -207,7 +207,7 @@ public:
 template<class T>
 void bindPromise(Promise<T> promise, Future<T> future)
 {
-  struct PromiseBinder {
+  class PromiseBinder {
   public:
     PromiseBinder(Promise<T> promise) : promise_(std::move(promise)) {}
     void operator()(Future<T> future)
index 4d55193..976487a 100644 (file)
 #include "simgrid/host.h"
 #include "xbt/ex.h"
 #include "xbt/parmap.h"
+#ifdef __cplusplus
 #include <map>
+#endif
+
 /* ******************************** Host ************************************ */
 /** @brief Host datatype
     @ingroup simix_host_management
@@ -138,9 +141,11 @@ XBT_PUBLIC(void) SIMIX_process_set_function(const char* process_host,
  */
 
 XBT_PUBLIC(void) SIMIX_maestro_create(void (*code)(void*), void* data);
+#ifdef __cplusplus
 XBT_PUBLIC(smx_actor_t)
 SIMIX_process_attach(const char* name, void* data, const char* hostname, std::map<std::string, std::string>* properties,
                      smx_actor_t parent_process);
+#endif
 XBT_PUBLIC(void) SIMIX_process_detach();
 
 /*********************************** Host *************************************/
@@ -195,9 +200,11 @@ XBT_PUBLIC(e_smx_state_t) simcall_execution_wait(smx_activity_t execution);
 /**************************** Process simcalls ********************************/
 SG_BEGIN_DECL()
 /* Constructor and Destructor */
+#ifdef __cplusplus
 XBT_PUBLIC(smx_actor_t)
 simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host, int argc, char** argv,
                        std::map<std::string, std::string>* properties);
+#endif
 
 XBT_PUBLIC(void) simcall_process_killall(int reset_pid);
 XBT_PUBLIC(void) SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char *msg);
@@ -219,6 +226,7 @@ SG_END_DECL()
 
 /************************** Comunication simcalls *****************************/
 
+#ifdef __cplusplus
 XBT_PUBLIC(void)
 simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
                   size_t src_buff_size, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
@@ -243,6 +251,7 @@ simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, siz
 XBT_PUBLIC(smx_activity_t)
 simcall_comm_iprobe(smx_mailbox_t mbox, int type, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                     void* data);
+#endif
 XBT_PUBLIC(void) simcall_comm_cancel(smx_activity_t comm);
 
 /* FIXME: waitany is going to be a vararg function, and should take a timeout */
index 90df0a3..dd4fb3d 100644 (file)
@@ -1,9 +1,11 @@
-/* Copyright (c) 2005-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2005-2017. The SimGrid Team. All rights reserved.          */
 
 #ifndef XBT_BACKTRACE_H
 #define XBT_BACKTRACE_H
 
+#ifdef __cplusplus
 #include <cstddef>
+#endif
 
 #include <xbt/base.h>
 
index 1bf89d8..09160c8 100644 (file)
@@ -41,7 +41,8 @@ typedef std::vector<Dwarf_Op> DwarfExpression;
  *  the process memory, etc. All those informations are gathered in
  *  the evaluation context.
  */
-struct ExpressionContext {
+class ExpressionContext {
+public:
   ExpressionContext() :
     cursor(nullptr), frame_base(nullptr), address_space(nullptr),
     object_info(nullptr), process_index(simgrid::mc::ProcessIndexMissing) {}
index 7028f4d..a9a1b82 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2016. The SimGrid Team.
+/* Copyright (c) 2007-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -17,7 +17,8 @@
 namespace simgrid {
 namespace mc {
 
-struct XBT_PRIVATE VisitedState {
+class XBT_PRIVATE VisitedState {
+public:
   std::shared_ptr<simgrid::mc::Snapshot> system_state = nullptr;
   std::size_t heap_bytes_used = 0;
   int actors_count            = 0;
index 16bfff7..ed4994e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2015. The SimGrid Team.
+/* Copyright (c) 2007-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -27,7 +27,8 @@ SG_END_DECL()
 namespace simgrid {
 namespace mc {
 
-struct XBT_PRIVATE Pair {
+class XBT_PRIVATE Pair {
+public:
   int num = 0;
   bool search_cycle = false;
   std::shared_ptr<simgrid::mc::State> graph_state = nullptr; /* System state included */
@@ -44,7 +45,8 @@ struct XBT_PRIVATE Pair {
   Pair& operator=(Pair const&) = delete;
 };
 
-struct XBT_PRIVATE VisitedPair {
+class XBT_PRIVATE VisitedPair {
+public:
   int num;
   int other_num = 0; /* Dot output for */
   std::shared_ptr<simgrid::mc::State> graph_state = nullptr; /* System state included */
index d6ee814..7e6a78d 100644 (file)
@@ -22,7 +22,8 @@ enum class PatternCommunicationType {
   receive = 2,
 };
 
-struct PatternCommunication {
+class PatternCommunication {
+public:
   int num = 0;
   simgrid::kernel::activity::CommImpl* comm_addr;
   PatternCommunicationType type = PatternCommunicationType::send;
@@ -104,8 +105,8 @@ public:
 
 /* A node in the exploration graph (kind-of)
  */
-struct XBT_PRIVATE State {
-
+class XBT_PRIVATE State {
+public:
   /** Sequential state number (used for debugging) */
   int num = 0;
 
similarity index 96%
rename from src/surf/ns3/ns3_simulator.cc
rename to src/surf/ns3/ns3_simulator.cpp
index 55df59e..7ba6d97 100644 (file)
@@ -55,7 +55,7 @@ static void WriteUntilBufferFull(ns3::Ptr<ns3::Socket> sock, uint32_t txSpace)
     uint32_t toWrite = std::min({flow->remaining_, sock->GetTxAvailable()});
     if (toWrite == 0) // buffer full
       return;
-    int amountSent   = sock->Send(0, toWrite, 0);
+    int amountSent = sock->Send(0, toWrite, 0);
 
     xbt_assert(amountSent > 0, "Since TxAvailable>0, amountSent should also >0");
     flow->bufferedBytes_ += amountSent;
@@ -113,19 +113,18 @@ void StartFlow(ns3::Ptr<ns3::Socket> sock, const char* to, uint16_t port_number)
   sock->Connect(serverAddr);
   // tell the tcp implementation to call WriteUntilBufferFull again
   // if we blocked and new tx buffer space becomes available
-  sock->SetSendCallback (MakeCallback(&WriteUntilBufferFull));
+  sock->SetSendCallback(MakeCallback(&WriteUntilBufferFull));
   // Note when the send is over
   sock->SetRecvCallback(MakeCallback(&receive_callback));
   // Keep track of what was used (for the TRACING module)
   sock->SetDataSentCallback(MakeCallback(&datasent_callback));
   XBT_DEBUG("startFlow of F[%p, %p, %u] dest=%s port=%d", flow, flow->action_, flow->totalBytes_, to, port_number);
 
-  //WriteUntilBufferFull (sock, sock->GetTxAvailable ());
+  // WriteUntilBufferFull (sock, sock->GetTxAvailable ());
   /*
   sock->SetSendCallback(MakeCallback(&send_callback));
   sock->SetConnectCallback(MakeCallback(&succeededConnect_callback), MakeCallback(&failedConnect_callback));
   sock->SetCloseCallbacks(MakeCallback(&normalClose_callback), MakeCallback(&errorClose_callback));
   send_callback(sock, sock->GetTxAvailable ());
    */
-
 }
index 3947248..cb6c810 100644 (file)
@@ -96,30 +96,34 @@ static long int parseLong(const char* value)
 // ***** ConfigType *****
 
 /// A trait which define possible options types:
-template<class T> struct ConfigType;
+template <class T> class ConfigType;
 
-template<> struct ConfigType<int> {
+template <> class ConfigType<int> {
+public:
   static constexpr const char* type_name = "int";
   static inline double parse(const char* value)
   {
     return parseLong(value);
   }
 };
-template<> struct ConfigType<double> {
+template <> class ConfigType<double> {
+public:
   static constexpr const char* type_name = "double";
   static inline double parse(const char* value)
   {
     return parseDouble(value);
   }
 };
-template<> struct ConfigType<std::string> {
+template <> class ConfigType<std::string> {
+public:
   static constexpr const char* type_name = "string";
   static inline std::string parse(const char* value)
   {
     return std::string(value);
   }
 };
-template<> struct ConfigType<bool> {
+template <> class ConfigType<bool> {
+public:
   static constexpr const char* type_name = "boolean";
   static inline bool parse(const char* value)
   {
index 5f9b6d7..ba462e5 100644 (file)
@@ -303,7 +303,7 @@ if(HAVE_MMALLOC)
 endif()
 
 set(NS3_SRC  src/surf/network_ns3.cpp
-             src/surf/ns3/ns3_simulator.cc )
+             src/surf/ns3/ns3_simulator.cpp )
 
 set(SURF_SRC
   src/kernel/routing/ClusterZone.cpp