Commit 95c231e0 authored by Millian Poquet's avatar Millian Poquet
Browse files

[code] sim_begins: nb_resources added

parent 3da59143
......@@ -114,7 +114,7 @@ void JsonProtocolWriter::append_query_request(void *anything,
void JsonProtocolWriter::append_simulation_begins(double date)
void JsonProtocolWriter::append_simulation_begins(int nb_resources, double date)
{
/* {
"timestamp": 0.0,
......@@ -125,10 +125,13 @@ void JsonProtocolWriter::append_simulation_begins(double date)
xbt_assert(date >= _last_date, "Date inconsistency");
_last_date = date;
Value data(rapidjson::kObjectType);
data.AddMember("nb_resources", Value().SetInt(nb_resources), _alloc);
Value event(rapidjson::kObjectType);
event.AddMember("timestamp", Value().SetDouble(date), _alloc);
event.AddMember("type", Value().SetString("SIMULATION_BEGINS"), _alloc);
event.AddMember("data", Value().SetObject(), _alloc);
event.AddMember("data", data, _alloc);
_events.PushBack(event, _alloc);
}
......@@ -317,7 +320,7 @@ bool test_json_writer()
printf("NOP content:\n%s\n", proto_writer->generate_current_message(42).c_str());
proto_writer->clear();
proto_writer->append_simulation_begins(10);
proto_writer->append_simulation_begins(4, 10);
printf("SIM_BEGINS content:\n%s\n", proto_writer->generate_current_message(42).c_str());
proto_writer->clear();
......
......@@ -128,9 +128,10 @@ public:
// Messages from Batsim to the Scheduler
/**
* @brief Appends a SIMULATION_BEGINS event.
* @param[in] nb_resources The number of simulated resources
* @param[in] date The event date. Must be greater than or equal to the previous event.
*/
virtual void append_simulation_begins(double date) = 0;
virtual void append_simulation_begins(int nb_resources, double date) = 0;
/**
* @brief Appends a SIMULATION_ENDS event.
......@@ -325,9 +326,10 @@ public:
// Messages from Batsim to the Scheduler
/**
* @brief Appends a SIMULATION_STARTS event.
* @param[in] nb_resources The number of simulated resources
* @param[in] date The event date. Must be greater than or equal to the previous event.
*/
void append_simulation_begins(double date);
void append_simulation_begins(int nb_resources, double date);
/**
* @brief Appends a SIMULATION_ENDS event.
......
......@@ -56,10 +56,8 @@ int server_process(int argc, char *argv[])
// Let's store the origin of wait queries
map<std::pair<int,double>, Submitter*> origin_of_wait_queries;
string send_buffer;
// Let's tell the Decision process that the simulation is about to begin (and that some data can be read from the data storage)
context->proto_writer->append_simulation_begins(MSG_get_clock());
context->proto_writer->append_simulation_begins(context->machines.nb_machines(), MSG_get_clock());
RequestReplyProcessArguments * req_rep_args = new RequestReplyProcessArguments;
req_rep_args->context = context;
......
Supports Markdown
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