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);
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);
-/* 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
} 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);
}
public int getLoad(){
- System.out.println("Remaining comp:" + this.daemon.getRemaining());
+ Msg.info("Remaining comp:" + this.daemon.getRemaining());
return this.currentLoad;
}
-/* 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
}
}
catch (Exception e) {
+ Msg.debug("Caught exception: " + e);
}
}
Msg.info(findNodeSuccedded + "/" + (findNodeSuccedded + findNodeFailed) + " FIND_NODE have succedded.");
waitFor(1);
}
catch (Exception ex) {
+ Msg.debug("Caught exception: " + ex);
}
} while (Msg.getClock() < timeout && !destinationFound);
}
-/* 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
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. */
-/* 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
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();
-/* 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
import org.simgrid.trace.Trace;
public class Main {
+ public static final String PM_STATE = "PM_STATE";
+
private Main() {
throw new IllegalAccessError("Utility class");
}
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();
-/* 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
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);
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");
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!");
}
-/* 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
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);
-/* 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. */
* @endcode
*
*/
-struct SimulationClock {
+class SimulationClock {
+public:
using rep = double;
using period = std::ratio<1>;
using duration = std::chrono::duration<rep, period>;
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)
#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
*/
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 *************************************/
/**************************** 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);
/************************** 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*),
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 */
-/* 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>
* 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) {}
-/* 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
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;
-/* 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
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 */
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 */
receive = 2,
};
-struct PatternCommunication {
+class PatternCommunication {
+public:
int num = 0;
simgrid::kernel::activity::CommImpl* comm_addr;
PatternCommunicationType type = PatternCommunicationType::send;
/* 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;
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;
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 ());
*/
-
}
// ***** 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)
{
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