/* 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. */
/* 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. */
* This flag indicates whether the structure is still used somewhere or not.
* When the structure is freed, the argument is set to nullptr
*/
* This flag indicates whether the structure is still used somewhere or not.
* When the structure is freed, the argument is set to nullptr
*/
-XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_file(std::string filename);
-XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(std::string id, std::string input, double periodicity);
-}
+XBT_PUBLIC tmgr_trace_t tmgr_trace_new_from_file(std::string filename);
+XBT_PUBLIC tmgr_trace_t tmgr_trace_new_from_string(std::string id, std::string input, double periodicity);
std::ostream& operator<<(std::ostream& out, const DatedValue& e);
/** @brief A trace_iterator links a trace to a resource */
std::ostream& operator<<(std::ostream& out, const DatedValue& e);
/** @brief A trace_iterator links a trace to a resource */
* It is useful to model dynamic platforms, where an external load that makes the resource availability change over time.
* To model that, you have to set several traces per resource: one for the on/off state and one for each numerical value (computational speed, bandwidth and latency).
*/
* It is useful to model dynamic platforms, where an external load that makes the resource availability change over time.
* To model that, you have to set several traces per resource: one for the on/off state and one for each numerical value (computational speed, bandwidth and latency).
*/
/** @brief Future Event Set (collection of iterators over the traces)
* That's useful to quickly know which is the next occurring event in a set of traces. */
/** @brief Future Event Set (collection of iterators over the traces)
* That's useful to quickly know which is the next occurring event in a set of traces. */
- tmgr_trace_event_t pop_leq(double date, double* value, simgrid::surf::Resource** resource);
- tmgr_trace_event_t add_trace(tmgr_trace_t trace, simgrid::surf::Resource * resource);
+ tmgr_trace_event_t pop_leq(double date, double* value, simgrid::kernel::resource::Resource** resource);
+ tmgr_trace_event_t add_trace(tmgr_trace_t trace, simgrid::kernel::resource::Resource * resource);
- // TODO: use a boost type for the heap (or a ladder queue)
- xbt_heap_t heap_ = xbt_heap_new(8, xbt_free_f); /* Content: only trace_events (yep, 8 is an arbitrary value) */
+ typedef std::pair<double, tmgr_trace_event_t> Qelt;
+ std::priority_queue<Qelt, std::vector<Qelt>, std::greater<Qelt>> heap_;