Commit d37642fe authored by Millian Poquet's avatar Millian Poquet

The previous version actually worked with larger MSG workloads. Added some...

The previous version actually worked with larger MSG workloads. Added some debug display for machines
parent 33a854c5
......@@ -142,6 +142,7 @@ int main(int argc, char * argv[])
const Machine * masterMachine = context.machines.masterMachine();
context.machines.setTracer(&context.tracer);
context.tracer.initialize(&context, MSG_get_clock());
//context.machines.displayDebug();
// Socket
context.socket.create_socket(mainArgs.socketFilename);
......
......@@ -4,10 +4,15 @@
#include <iterator>
#include <map>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/join.hpp>
#include "export.hpp"
using namespace std;
XBT_LOG_NEW_DEFAULT_CATEGORY(machines, "machines");
Machines::Machines()
{
......@@ -66,6 +71,25 @@ bool Machines::exists(int machineID) const
return machineID >= 0 && machineID < (int)_machines.size();
}
void Machines::displayDebug() const
{
// Let us traverse machines to display some information about them
vector<string> machinesVector;
for (const Machine * m : _machines)
{
machinesVector.push_back(m->name + "(" + to_string(m->id) + ")");
}
// Let us create the string that will be sent to XBT_INFO
string s = "Machines debug information:\n";
s += "There are " + to_string(_machines.size()) + " machines.\n";
s += "Mobs : [" + boost::algorithm::join(machinesVector, ", ") + "]";
// Let us display the string which has been built
XBT_INFO("%s", s.c_str());
}
const std::vector<Machine *> &Machines::machines() const
{
return _machines;
......
......@@ -42,6 +42,7 @@ public:
Machine * operator[](int machineID);
bool exists(int machineID) const;
void displayDebug() const;
const std::vector<Machine *> & machines() const;
const Machine * masterMachine() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment