1 /* Copyright (c) 2009-2015. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "src/msg/msg_private.h"
7 #include "xbt/replay.hpp"
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_action, msg, "MSG actions for trace driven simulation");
15 void MSG_action_init()
17 simgrid::xbt::replay_init();
18 MSG_function_register_default(simgrid::xbt::replay_runner);
21 void MSG_action_exit()
23 simgrid::xbt::replay_exit();
26 /** \ingroup msg_trace_driven
27 * \brief A trace loader
29 * If path!=nullptr, load a trace file containing actions, and execute them.
30 * Else, assume that each process gets the path in its deployment file
32 msg_error_t MSG_action_trace_run(char *path)
35 simgrid::xbt::action_fs = new std::ifstream(path, std::ifstream::in);
38 msg_error_t res = MSG_main();
40 if (!simgrid::xbt::action_queues.empty()) {
41 XBT_WARN("Not all actions got consumed. If the simulation ended successfully (without deadlock),"
42 " you may want to add new processes to your deployment file.");
44 for (auto actions_of : simgrid::xbt::action_queues) {
45 XBT_WARN("Still %zu actions for %s", actions_of.second->size(), actions_of.first.c_str());
50 delete simgrid::xbt::action_fs;
51 simgrid::xbt::action_fs = nullptr;