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;
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);
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);
117 std::shared_ptr<FileLocation> dst);
120 std::shared_ptr<FileLocation> dst);
123 std::shared_ptr<FileLocation> dst);
126 addTimestampDiskReadStart(
double date, std::string hostname, std::string mount,
double bytes,
int unique_sequence_number);
132 int unique_sequence_number);
141 int unique_sequence_number);
157 std::type_index type_index = std::type_index(
typeid(T));
158 if (this->traces.find(type_index) == this->traces.end()) {
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
void addTimestamp(T *timestamp)
Append a simulation timestamp to a simulation output trace.
Definition: SimulationOutput.h:156
void enableFileReadWriteCopyTimestamps(bool enabled)
Enable or Disable the insertion of file-related timestamps in the simulation output (enabled by defau...
Definition: SimulationOutput.cpp:2031
void addTimestampDiskReadStart(double date, std::string hostname, std::string mount, double bytes, int unique_sequence_number)
Add a file read start timestamp.
Definition: SimulationOutput.cpp:1811
void addTimestampTaskFailure(double date, std::shared_ptr< WorkflowTask >task)
Add a task start failure.
Definition: SimulationOutput.cpp:1608
void enableBandwidthTimestamps(bool enabled)
Enable or Disable the insertion of link-usage-related timestamps in the simulation output (enabled by...
Definition: SimulationOutput.cpp:2058
void addTimestampTaskCompletion(double date, std::shared_ptr< WorkflowTask >task)
Add a task start completion.
Definition: SimulationOutput.cpp:1619
void addTimestampTaskTermination(double date, std::shared_ptr< WorkflowTask >task)
Add a task start termination.
Definition: SimulationOutput.cpp:1630
void addTimestampFileCopyStart(double date, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src, std::shared_ptr< FileLocation > dst)
Add a file copy start timestamp.
Definition: SimulationOutput.cpp:1760
A template class to represent a trace of timestamps.
Definition: SimulationTrace.h:48
void addTimestampFileCopyFailure(double date, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src, std::shared_ptr< FileLocation > dst)
Add a file copy failure timestamp.
Definition: SimulationOutput.cpp:1776
void enableDiskTimestamps(bool enabled)
Enable or Disable the insertion of disk-related timestamps in the simulation output (enabled by defau...
Definition: SimulationOutput.cpp:2017
void addTimestampDiskWriteCompletion(double date, std::string hostname, std::string mount, double bytes, int unique_sequence_number)
Add a file write completion timestamp.
Definition: SimulationOutput.cpp:1902
void addTimestampDiskReadFailure(double date, std::string hostname, std::string mount, double bytes, int unique_sequence_number)
Add a file read failure timestamp.
Definition: SimulationOutput.cpp:1830
void addTimestampDiskReadCompletion(double date, std::string hostname, std::string mount, double bytes, int unique_sequence_number)
Add a file read completion timestamp.
Definition: SimulationOutput.cpp:1848
void addTimestampPstateSet(double date, std::string hostname, int pstate)
Add a pstate change/set timestamp.
Definition: SimulationOutput.cpp:1918
A time-stamped simulation event stored in SimulationOutput.
Definition: SimulationTimestamp.h:26
void dumpPlatformGraphJSON(std::string file_path, bool writing_file=true)
Writes a JSON file containing all hosts, network links, and the routes between each host.
Definition: SimulationOutput.cpp:1032
void addTimestampEnergyConsumption(double date, std::string hostname, double joules)
Add an energy consumption timestamp.
Definition: SimulationOutput.cpp:1931
void dumpUnifiedJSON(std::shared_ptr< Workflow > workflow, std::string file_path, bool include_platform=false, bool include_workflow_exec=true, bool include_workflow_graph=false, bool include_energy=false, bool generate_host_utilization_layout=false, bool include_disk=false, bool include_bandwidth=false)
Function that generates a unified JSON file containing the information specified by boolean arguments...
Definition: SimulationOutput.cpp:169
void addTimestampFileReadCompletion(double date, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src, std::shared_ptr< StorageService > service, std::shared_ptr< WorkflowTask >task=nullptr)
Add a file read completion timestamp.
Definition: SimulationOutput.cpp:1683
std::vector< SimulationTimestamp< T > * > getTrace()
Retrieve a copy of a simulation output trace once the simulation has completed.
Definition: SimulationOutput.h:38
Definition: Action.cpp:28
void enableEnergyTimestamps(bool enabled)
Enable or Disable the insertion of energy-related timestamps in the simulation output (enabled by def...
Definition: SimulationOutput.cpp:2048
void dumpHostEnergyConsumptionJSON(std::string file_path, bool writing_file=true)
Writes a JSON file containing host energy consumption information as a JSON array.
Definition: SimulationOutput.cpp:877
void dumpWorkflowExecutionJSON(std::shared_ptr< Workflow > workflow, std::string file_path, bool generate_host_utilization_layout=false, bool writing_file=true)
Writes WorkflowTask execution history for each task to a file, formatted as a JSON array.
Definition: SimulationOutput.cpp:527
void addTimestampFileCopyCompletion(double date, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src, std::shared_ptr< FileLocation > dst)
Add a file copy completion timestamp.
Definition: SimulationOutput.cpp:1793
void addTimestampDiskWriteStart(double date, std::string hostname, std::string mount, double bytes, int unique_sequence_number)
Add a file write start timestamp.
Definition: SimulationOutput.cpp:1866
void addTimestampFileWriteFailure(double date, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src, std::shared_ptr< StorageService > service, std::shared_ptr< WorkflowTask >task=nullptr)
Add a file write failure timestamp.
Definition: SimulationOutput.cpp:1722
void addTimestampTaskStart(double date, std::shared_ptr< WorkflowTask >task)
Add a task start timestamp.
Definition: SimulationOutput.cpp:1597
void addTimestampLinkUsage(double date, std::string linkname, double bytes_per_second)
Add a link usage timestamp.
Definition: SimulationOutput.cpp:1969
void addTimestampFileReadStart(double date, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src, std::shared_ptr< StorageService > service, std::shared_ptr< WorkflowTask >task=nullptr)
Add a file read start timestamp.
Definition: SimulationOutput.cpp:1644
void dumpLinkUsageJSON(std::string file_path, bool writing_file=true)
Definition: SimulationOutput.cpp:1492
void addTimestampFileWriteCompletion(double date, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src, std::shared_ptr< StorageService > service, std::shared_ptr< WorkflowTask >task=nullptr)
Add a file write completion timestamp.
Definition: SimulationOutput.cpp:1742
void addTimestampDiskWriteFailure(double date, std::string hostname, std::string mount, double bytes, int unique_sequence_number)
Add a file write failure timestamp.
Definition: SimulationOutput.cpp:1884
void addTimestampFileWriteStart(double date, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src, std::shared_ptr< StorageService > service, std::shared_ptr< WorkflowTask >task=nullptr)
Add a file write start timestamp.
Definition: SimulationOutput.cpp:1703
A class that contains post-mortem simulation-generated data.
Definition: SimulationOutput.h:27
void enableWorkflowTaskTimestamps(bool enabled)
Enable or Disable the insertion of task-related timestamps in the simulation output (enabled by defau...
Definition: SimulationOutput.cpp:2005
void dumpDiskOperationsJSON(std::string file_path, bool writing_file=true)
Writes a JSON file containing disk operation information as a JSON array.
Definition: SimulationOutput.cpp:1328
void dumpWorkflowGraphJSON(std::shared_ptr< Workflow > workflow, std::string file_path, bool writing_file=true)
Writes a JSON graph representation of the Workflow to a file.
Definition: SimulationOutput.cpp:752
void addTimestampFileReadFailure(double date, std::shared_ptr< DataFile >file, std::shared_ptr< FileLocation > src, std::shared_ptr< StorageService > service, std::shared_ptr< WorkflowTask >task=nullptr)
Add a file read failure timestamp.
Definition: SimulationOutput.cpp:1663