A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
overall optimization of map usage
[simgrid.git]
/
src
/
xbt
/
xbt_replay.cpp
diff --git
a/src/xbt/xbt_replay.cpp
b/src/xbt/xbt_replay.cpp
index
408c7f4
..
74bc5a3
100644
(file)
--- a/
src/xbt/xbt_replay.cpp
+++ b/
src/xbt/xbt_replay.cpp
@@
-23,7
+23,7
@@
static void read_and_trim_line(std::ifstream* fs, std::string* line)
do {
std::getline(*fs, *line);
boost::trim(*line);
do {
std::getline(*fs, *line);
boost::trim(*line);
- } while (
!
fs->eof() && (line->length() == 0 || line->front() == '#'));
+ } while (
not
fs->eof() && (line->length() == 0 || line->front() == '#'));
XBT_DEBUG("got from trace: %s", line->c_str());
}
XBT_DEBUG("got from trace: %s", line->c_str());
}
@@
-34,7
+34,9
@@
class ReplayReader {
public:
explicit ReplayReader(const char* filename)
{
public:
explicit ReplayReader(const char* filename)
{
+ XBT_VERB("Prepare to replay file '%s'", filename);
fs = new std::ifstream(filename, std::ifstream::in);
fs = new std::ifstream(filename, std::ifstream::in);
+ xbt_assert(fs->is_open(), "Cannot read replay file '%s'", filename);
}
~ReplayReader()
{
}
~ReplayReader()
{
@@
-48,7
+50,7
@@
bool ReplayReader::get(ReplayAction* action)
read_and_trim_line(fs, &line);
boost::split(*action, line, boost::is_any_of(" \t"), boost::token_compress_on);
read_and_trim_line(fs, &line);
boost::split(*action, line, boost::is_any_of(" \t"), boost::token_compress_on);
- return
!
fs->eof();
+ return
not
fs->eof();
}
static ReplayAction* get_action(char* name)
}
static ReplayAction* get_action(char* name)
@@
-76,9
+78,9
@@
static ReplayAction* get_action(char* name)
} else {
// Else, I have to store it for the relevant colleague
std::queue<ReplayAction*>* otherqueue = nullptr;
} else {
// Else, I have to store it for the relevant colleague
std::queue<ReplayAction*>* otherqueue = nullptr;
- if (action_queues.find(evtname) != action_queues.end())
+ try {
otherqueue = action_queues.at(evtname);
otherqueue = action_queues.at(evtname);
-
else
{ // Damn. Create the queue of that guy
+
} catch (std::out_of_range& unfound)
{ // Damn. Create the queue of that guy
otherqueue = new std::queue<ReplayAction*>();
action_queues.insert({evtname, otherqueue});
}
otherqueue = new std::queue<ReplayAction*>();
action_queues.insert({evtname, otherqueue});
}
@@
-123,9
+125,6
@@
static void handle_action(ReplayAction* action)
/**
* \ingroup XBT_replay
* \brief function used internally to actually run the replay
/**
* \ingroup XBT_replay
* \brief function used internally to actually run the replay
-
- * \param argc argc .
- * \param argv argv
*/
int replay_runner(int argc, char* argv[])
{
*/
int replay_runner(int argc, char* argv[])
{