10 #ifndef WRENCH_SIMULATIONTRACE_H
11 #define WRENCH_SIMULATIONTRACE_H
19 #include "wrench/simulation/SimulationTimestamp.h"
29 class GenericSimulationTrace {
32 virtual ~GenericSimulationTrace() {}
59 this->trace.push_back(timestamp);
69 std::vector<SimulationTimestamp<T> *>
getTrace() {
77 for (
auto ×tamp : this->trace) {
84 std::vector<SimulationTimestamp<T> *> trace;
100 auto hostname = new_timestamp->
getContent()->getHostname();
102 auto hostname_search = latest_timestamps_by_host.find(hostname);
103 if (hostname_search == latest_timestamps_by_host.end()) {
105 this->trace.push_back(new_timestamp);
106 this->latest_timestamps_by_host[hostname] = this->trace.size() - 1;
114 if (std::fabs(new_timestamp->
getDate() - latest_timestamp->
getDate()) < DBL_EPSILON) {
115 std::swap(new_timestamp, latest_timestamp);
120 delete new_timestamp;
123 this->trace.push_back(new_timestamp);
124 this->latest_timestamps_by_host[hostname] = this->trace.size() - 1;
126 throw std::runtime_error(
127 "SimulationTrace<SimulationTimestampPstateSet>::addTimestamp() timestamps out of order");
137 std::vector<SimulationTimestamp<SimulationTimestampPstateSet> *>
getTrace() {
145 for (
auto ×tamp: this->trace) {
151 std::map<std::string, size_t> latest_timestamps_by_host;
152 std::vector<SimulationTimestamp<SimulationTimestampPstateSet> *> trace;
162 #endif //WRENCH_SIMULATIONTRACE_H
std::vector< SimulationTimestamp< T > * > getTrace()
Retrieve the trace as a vector of timestamps.
Definition: SimulationTrace.h:69
A template class to represent a trace of timestamps.
Definition: SimulationTrace.h:48
A time-stamped simulation event stored in SimulationOutput.
Definition: SimulationTimestamp.h:26
void addTimestamp(SimulationTimestamp< SimulationTimestampPstateSet > *new_timestamp)
Append a SimulationTimestampPstateSet timestamp to the trace.
Definition: SimulationTrace.h:99
std::vector< SimulationTimestamp< SimulationTimestampPstateSet > * > getTrace()
Retrieve the trace as a vector of SimulationTimestamp<SimulationTimestampPstateSet> timestamps.
Definition: SimulationTrace.h:137
A specialized class to represent a trace of SimulationTimestampPstateSet timestamps.
Definition: SimulationTrace.h:92
void addTimestamp(SimulationTimestamp< T > *timestamp)
Append a timestamp to the trace.
Definition: SimulationTrace.h:58
double getDate()
Definition: SimulationTimestamp.h:44
A simulation timestamp class for changes in a host's pstate.
Definition: SimulationTimestampTypes.h:569
T *const getContent()
Definition: SimulationTimestamp.h:35