event_list.push_back(val);
}
Profile::~Profile() = default;
-FutureEvtSet::FutureEvtSet() = default;
-FutureEvtSet::~FutureEvtSet()
-{
- while (not heap_.empty()) {
- delete heap_.top().second;
- heap_.pop();
- }
-}
-} // namespace profile
-} // namespace kernel
-} // namespace simgrid
-
-simgrid::kernel::profile::Profile* tmgr_trace_new_from_string(std::string name, std::string input, double periodicity)
+Profile* Profile::from_string(std::string name, std::string input, double periodicity)
{
int linecount = 0;
simgrid::kernel::profile::Profile* trace = new simgrid::kernel::profile::Profile();
return trace;
}
-
-simgrid::kernel::profile::Profile* tmgr_trace_new_from_file(std::string filename)
+Profile* Profile::from_file(std::string path)
{
- xbt_assert(not filename.empty(), "Cannot parse a trace from an empty filename");
- xbt_assert(trace_list.find(filename) == trace_list.end(), "Refusing to define trace %s twice", filename.c_str());
+ xbt_assert(not path.empty(), "Cannot parse a trace from an empty filename");
+ xbt_assert(trace_list.find(path) == trace_list.end(), "Refusing to define trace %s twice", path.c_str());
- std::ifstream* f = surf_ifsopen(filename);
- xbt_assert(not f->fail(), "Cannot open file '%s' (path=%s)", filename.c_str(), (boost::join(surf_path, ":")).c_str());
+ std::ifstream* f = surf_ifsopen(path);
+ xbt_assert(not f->fail(), "Cannot open file '%s' (path=%s)", path.c_str(), (boost::join(surf_path, ":")).c_str());
std::stringstream buffer;
buffer << f->rdbuf();
delete f;
- return tmgr_trace_new_from_string(filename, buffer.str(), -1);
+ return Profile::from_string(path, buffer.str(), -1);
+}
+FutureEvtSet::FutureEvtSet() = default;
+FutureEvtSet::~FutureEvtSet()
+{
+ while (not heap_.empty()) {
+ delete heap_.top().second;
+ heap_.pop();
+ }
}
-namespace simgrid {
-namespace kernel {
-namespace profile {
/** @brief Registers a new trace into the future event set, and get an iterator over the integrated trace */
Event* FutureEvtSet::add_trace(Profile* profile, resource::Resource* resource)
XBT_PUBLIC void tmgr_finalize();
-XBT_PUBLIC simgrid::kernel::profile::Profile* tmgr_trace_new_from_file(std::string filename);
-XBT_PUBLIC simgrid::kernel::profile::Profile* tmgr_trace_new_from_string(std::string id, std::string input,
- double periodicity);
-
namespace simgrid {
namespace kernel {
namespace profile {
/** Creates an empty trace */
explicit Profile();
virtual ~Profile();
+
+ static Profile* from_file(std::string path);
+ static Profile* from_string(std::string name, std::string input, double periodicity);
// private:
std::vector<DatedValue> event_list;
};
{
std::vector<simgrid::kernel::profile::DatedValue> res;
- simgrid::kernel::profile::Profile* trace = tmgr_trace_new_from_string("TheName", str, 0);
+ simgrid::kernel::profile::Profile* trace = simgrid::kernel::profile::Profile::from_string("TheName", str, 0);
XBT_VERB("---------------------------------------------------------");
XBT_VERB("data>>\n%s<<data\n", str);
for (auto const& evt : trace->event_list)
{
simgrid::kernel::profile::Profile* mgr_profile;
if (not profile->file.empty()) {
- mgr_profile = tmgr_trace_new_from_file(profile->file);
+ mgr_profile = simgrid::kernel::profile::Profile::from_file(profile->file);
} else {
xbt_assert(not profile->pc_data.empty(), "Trace '%s' must have either a content, or point to a file on disk.",
profile->id.c_str());
- mgr_profile = tmgr_trace_new_from_string(profile->id, profile->pc_data, profile->periodicity);
+ mgr_profile = simgrid::kernel::profile::Profile::from_string(profile->id, profile->pc_data, profile->periodicity);
}
traces_set_list.insert({profile->id, mgr_profile});
}
XBT_DEBUG("pstate: %s", A_surfxml_host_pstate);
host.core_amount = surf_parse_get_int(A_surfxml_host_core);
- host.speed_trace = A_surfxml_host_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_availability___file) : nullptr;
- host.state_trace = A_surfxml_host_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_state___file) : nullptr;
+ host.speed_trace = A_surfxml_host_availability___file[0]
+ ? simgrid::kernel::profile::Profile::from_file(A_surfxml_host_availability___file)
+ : nullptr;
+ host.state_trace = A_surfxml_host_state___file[0]
+ ? simgrid::kernel::profile::Profile::from_file(A_surfxml_host_state___file)
+ : nullptr;
host.pstate = surf_parse_get_int(A_surfxml_host_pstate);
host.coord = A_surfxml_host_coordinates;
peer.bw_in = surf_parse_get_bandwidth(A_surfxml_peer_bw___in, "bw_in of peer", peer.id.c_str());
peer.bw_out = surf_parse_get_bandwidth(A_surfxml_peer_bw___out, "bw_out of peer", peer.id.c_str());
peer.coord = A_surfxml_peer_coordinates;
- peer.speed_trace = A_surfxml_peer_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_availability___file) : nullptr;
- peer.state_trace = A_surfxml_peer_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_state___file) : nullptr;
+ peer.speed_trace = A_surfxml_peer_availability___file[0]
+ ? simgrid::kernel::profile::Profile::from_file(A_surfxml_peer_availability___file)
+ : nullptr;
+ peer.state_trace = A_surfxml_peer_state___file[0]
+ ? simgrid::kernel::profile::Profile::from_file(A_surfxml_peer_state___file)
+ : nullptr;
if (A_surfxml_peer_lat[0] != '\0')
XBT_WARN("The latency parameter in <peer> is now deprecated. Use the z coordinate instead of '%s'.",
link.id = std::string(A_surfxml_link_id);
link.bandwidth = surf_parse_get_bandwidth(A_surfxml_link_bandwidth, "bandwidth of link", link.id.c_str());
- link.bandwidth_trace = A_surfxml_link_bandwidth___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_bandwidth___file) : nullptr;
+ link.bandwidth_trace = A_surfxml_link_bandwidth___file[0]
+ ? simgrid::kernel::profile::Profile::from_file(A_surfxml_link_bandwidth___file)
+ : nullptr;
link.latency = surf_parse_get_time(A_surfxml_link_latency, "latency of link", link.id.c_str());
- link.latency_trace = A_surfxml_link_latency___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_latency___file) : nullptr;
- link.state_trace = A_surfxml_link_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_state___file):nullptr;
+ link.latency_trace = A_surfxml_link_latency___file[0]
+ ? simgrid::kernel::profile::Profile::from_file(A_surfxml_link_latency___file)
+ : nullptr;
+ link.state_trace = A_surfxml_link_state___file[0]
+ ? simgrid::kernel::profile::Profile::from_file(A_surfxml_link_state___file)
+ : nullptr;
switch (A_surfxml_link_sharing___policy) {
case A_surfxml_link_sharing___policy_SHARED: