10 #ifndef WRENCH_SIMULATIONOUTPUT_H
11 #define WRENCH_SIMULATIONOUTPUT_H
17 #include "wrench/simulation/SimulationTimestamp.h"
18 #include "wrench/simulation/SimulationTrace.h"
38 std::vector<SimulationTimestamp<T> *>
getTrace() {
39 std::type_index type_index = std::type_index(
typeid(T));
42 if (this->traces.find(type_index) == this->traces.end()) {
46 std::vector<SimulationTimestamp<T> *> non_generic_vector;
47 auto trace = (SimulationTrace<T> *) (this->traces[type_index]);
48 for (
auto ts : trace->getTrace()) {
51 return non_generic_vector;
55 bool generate_host_utilization_layout =
false,
bool writing_file =
true);
57 void dumpWorkflowGraphJSON(std::shared_ptr<Workflow> workflow, std::string file_path,
bool writing_file =
true);
67 void dumpUnifiedJSON(std::shared_ptr<Workflow> workflow, std::string file_path,
68 bool include_platform =
false,
69 bool include_workflow_exec =
true,
70 bool include_workflow_graph =
false,
71 bool include_energy =
false,
72 bool generate_host_utilization_layout =
false,
73 bool include_disk =
false,
74 bool include_bandwidth =
false);
90 void addTimestampTaskStart(
double date, std::shared_ptr<WorkflowTask>task);
92 void addTimestampTaskFailure(
double date, std::shared_ptr<WorkflowTask>task);
94 void addTimestampTaskCompletion(
double date, std::shared_ptr<WorkflowTask>task);
96 void addTimestampTaskTermination(
double date, std::shared_ptr<WorkflowTask>task);
98 void addTimestampFileReadStart(
double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service,
99 std::shared_ptr<WorkflowTask>task =
nullptr);
101 void addTimestampFileReadFailure(
double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service,
102 std::shared_ptr<WorkflowTask>task =
nullptr);
104 void addTimestampFileReadCompletion(
double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service,
105 std::shared_ptr<WorkflowTask>task =
nullptr);
107 void addTimestampFileWriteStart(
double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service,
108 std::shared_ptr<WorkflowTask>task =
nullptr);
110 void addTimestampFileWriteFailure(
double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service,
111 std::shared_ptr<WorkflowTask>task =
nullptr);
113 void addTimestampFileWriteCompletion(
double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service,
114 std::shared_ptr<WorkflowTask>task =
nullptr);
116 void addTimestampFileCopyStart(
double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src,
117 std::shared_ptr<FileLocation> dst);
119 void addTimestampFileCopyFailure(
double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src,
120 std::shared_ptr<FileLocation> dst);
122 void addTimestampFileCopyCompletion(
double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src,
123 std::shared_ptr<FileLocation> dst);
126 addTimestampDiskReadStart(
double date, std::string hostname, std::string mount,
double bytes,
int unique_sequence_number);
129 addTimestampDiskReadFailure(
double date, std::string hostname, std::string mount,
double bytes,
int unique_sequence_number);
131 void addTimestampDiskReadCompletion(
double date, std::string hostname, std::string mount,
double bytes,
132 int unique_sequence_number);
135 addTimestampDiskWriteStart(
double date, std::string hostname, std::string mount,
double bytes,
int unique_sequence_number);
138 addTimestampDiskWriteFailure(
double date, std::string hostname, std::string mount,
double bytes,
int unique_sequence_number);
140 void addTimestampDiskWriteCompletion(
double date, std::string hostname, std::string mount,
double bytes,
141 int unique_sequence_number);
143 void addTimestampPstateSet(
double date, std::string hostname,
int pstate);
145 void addTimestampEnergyConsumption(
double date, std::string hostname,
double joules);
147 void addTimestampLinkUsage(
double date, std::string linkname,
double bytes_per_second);
156 void addTimestamp(T *timestamp) {
157 std::type_index type_index = std::type_index(
typeid(T));
158 if (this->traces.find(type_index) == this->traces.end()) {
159 this->traces[type_index] =
new SimulationTrace<T>();
161 ((SimulationTrace<T> *) (this->traces[type_index]))->addTimestamp(
new SimulationTimestamp<T>(timestamp));
181 std::map<std::type_index, GenericSimulationTrace *> traces;
182 nlohmann::json platform_json_part;
183 nlohmann::json workflow_exec_json_part;
184 nlohmann::json workflow_graph_json_part;
185 nlohmann::json energy_json_part;
186 nlohmann::json disk_json_part;
187 nlohmann::json bandwidth_json_part;
189 std::map<std::type_index, bool> enabledStatus;
198 std::type_index type_index = std::type_index(
typeid(T));
199 return this->enabledStatus[type_index];
208 void setEnabled(
bool enabled) {
209 std::type_index type_index = std::type_index(
typeid(T));
210 this->enabledStatus[type_index] = enabled;
215 #endif //WRENCH_SIMULATIONOUTPUT_H