wrench::SimulationOutput

class wrench::SimulationOutput

A class that contains post-mortem simulation-generated data.

Public Functions

template<class T>
inline void addTimestamp(T *timestamp)

Append a simulation timestamp to a simulation output trace.

Template Parameters

a – particular SimulationTimestampXXXX class (defined in SimulationTimestampTypes.h)

Parameters

timestamp – a pointer to a SimulationTimestampXXXX object

void addTimestampDiskReadCompletion(double date, const std::string &hostname, const std::string &mount, double bytes, int unique_sequence_number)

Add a file read completion timestamp.

Parameters
  • date – the date

  • hostname – hostname being read from

  • mount – mountpoint of disk

  • bytes – number of bytes read

  • unique_sequence_number – an integer id

void addTimestampDiskReadFailure(double date, const std::string &hostname, const std::string &mount, double bytes, int unique_sequence_number)

Add a file read failure timestamp.

Parameters
  • date – the date

  • hostname – hostname being read from

  • mount – mountpoint of disk

  • bytes – number of bytes read

  • unique_sequence_number – an integer id

void addTimestampDiskReadStart(double date, std::string hostname, std::string mount, double bytes, int unique_sequence_number)

Add a file read start timestamp.

Parameters
  • date – the date

  • hostname – hostname being read from

  • mount – mountpoint of disk

  • bytes – number of bytes read

  • unique_sequence_number – an integer id

void addTimestampDiskWriteCompletion(double date, const std::string &hostname, const std::string &mount, double bytes, int unique_sequence_number)

Add a file write completion timestamp.

Parameters
  • date – the date

  • hostname – hostname being read from

  • mount – mountpoint of disk

  • bytes – number of bytes read

  • unique_sequence_number – an integer id

void addTimestampDiskWriteFailure(double date, const std::string &hostname, const std::string &mount, double bytes, int unique_sequence_number)

Add a file write failure timestamp.

Parameters
  • date – the date

  • hostname – hostname being read from

  • mount – mountpoint of disk

  • bytes – number of bytes read

  • unique_sequence_number – an integer id

void addTimestampDiskWriteStart(double date, std::string hostname, std::string mount, double bytes, int unique_sequence_number)

Add a file write start timestamp.

Parameters
  • date – the date

  • hostname – hostname being read from

  • mount – mountpoint of disk

  • bytes – number of bytes read

  • unique_sequence_number – an integer id

void addTimestampEnergyConsumption(double date, const std::string &hostname, double joules)

Add an energy consumption timestamp.

Parameters
  • date – the date

  • hostname – a hostname

  • joules – consumption in joules

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.

Parameters
  • date – the date

  • file – a workflow file

  • src – the source location

  • dst – the target location

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.

Parameters
  • date – the date

  • file – a workflow file

  • src – the source location

  • dst – the target location

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.

Parameters
  • date – the date

  • file – a workflow file

  • src – the source location

  • dst – the target location

void addTimestampFileReadCompletion(double date, const std::shared_ptr<DataFile> &file, const std::shared_ptr<FileLocation> &src, const std::shared_ptr<StorageService> &service, std::shared_ptr<WorkflowTask> task = nullptr)

Add a file read completion timestamp.

Parameters
  • date – the date

  • file – a workflow file

  • src – the source location

  • service – the source storage service

  • task – the workflow task for which this read is done (or nullptr);

void addTimestampFileReadFailure(double date, const std::shared_ptr<DataFile> &file, const std::shared_ptr<FileLocation> &src, const std::shared_ptr<StorageService> &service, std::shared_ptr<WorkflowTask> task = nullptr)

Add a file read failure timestamp.

Parameters
  • date – the date

  • file – a workflow file

  • src – the source location

  • service – the source storage service

  • task – the workflow task for which this read is done (or nullptr);

void addTimestampFileReadStart(double date, const std::shared_ptr<DataFile> &file, const std::shared_ptr<FileLocation> &src, const std::shared_ptr<StorageService> &service, std::shared_ptr<WorkflowTask> task = nullptr)

Add a file read start timestamp.

Parameters
  • date – the date

  • file – a workflow file

  • src – the source location

  • service – the source storage service

  • task – the workflow task for which this read is done (or nullptr);

void addTimestampFileWriteCompletion(double date, const std::shared_ptr<DataFile> &file, const std::shared_ptr<FileLocation> &src, const std::shared_ptr<StorageService> &service, std::shared_ptr<WorkflowTask> task = nullptr)

Add a file write completion timestamp.

Parameters
  • date – the date

  • file – a workflow file

  • src – the target location

  • service – the target storage service

  • task – the workflow task for which this write is done (or nullptr);

void addTimestampFileWriteFailure(double date, const std::shared_ptr<DataFile> &file, const std::shared_ptr<FileLocation> &src, const std::shared_ptr<StorageService> &service, std::shared_ptr<WorkflowTask> task = nullptr)

Add a file write failure timestamp.

Parameters
  • date – the date

  • file – a workflow file

  • src – the target location

  • service – the target storage service

  • task – the workflow task for which this write is done (or nullptr);

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.

Parameters
  • date – the date

  • file – a workflow file

  • src – the target location

  • service – the target storage service

  • task – the workflow task for which this write is done (or nullptr);

void addTimestampLinkUsage(double date, const std::string &linkname, double bytes_per_second)

Add a link usage timestamp.

Parameters
  • date – the date

  • linkname – a linkname

  • bytes_per_second – link usage in bytes_per_second

void addTimestampPstateSet(double date, const std::string &hostname, int pstate)

Add a pstate change/set timestamp.

Parameters
  • date – the date

  • hostname – a hostname

  • pstate – a pstate index

void addTimestampTaskCompletion(double date, const std::shared_ptr<WorkflowTask> &task)

Add a task start completion.

Parameters
  • date – the date

  • task – a workflow task

void addTimestampTaskFailure(double date, const std::shared_ptr<WorkflowTask> &task)

Add a task start failure.

Parameters
  • date – the date

  • task – a workflow task

void addTimestampTaskStart(double date, const std::shared_ptr<WorkflowTask> &task)

Add a task start timestamp.

Parameters
  • date – the date

  • task – a workflow task

void addTimestampTaskTermination(double date, const std::shared_ptr<WorkflowTask> &task)

Add a task start termination.

Parameters
  • date – the date

  • task – a workflow task

void dumpDiskOperationsJSON(const std::string &file_path, bool writing_file = true)

Writes a JSON file containing disk operation information as a JSON array.

>>>>NOTE<<<< The timestamps the JSON is generated from are disabled by default. Enable them with SimulationOutput::enableDiskTimestamps() to use.

The JSON array has the following format:

Parameters
  • file_path – - path to save JSON at

  • writing_file – - boolean, default true, to write the JSON to the specified file path. Used for unified output.

Throws

invalid_argument

void dumpHostEnergyConsumptionJSON(const std::string &file_path, bool writing_file = true)

Writes a JSON file containing host energy consumption information as a JSON array.

The JSON array has the following format:

Parameters
  • file_path – the path to write the file

  • writing_file – whether or not the file is written, true by default but will be false when utilized as part of dumpUnifiedJSON

Throws
  • std::invalid_argument

  • std::runtime_error

void dumpLinkUsageJSON(const std::string &file_path, bool writing_file = true)

Writes a JSON file containing link usage information as a JSON array.

This information will not be generated without using the bandwidth meter service and providing it with linknames to monitor.

Parameters
  • file_path – path where json file is written

  • writing_file – whether to write file to disk. Enabled by default.

Throws
  • std::invalid_argument

  • std::runtime_error

void dumpPlatformGraphJSON(const std::string &file_path, bool writing_file = true)

Writes a JSON file containing all hosts, network links, and the routes between each host.

The JSON array has the following format:

Parameters
  • file_path – the path to write the file

  • writing_file – whether or not the file is written, true by default but will be false when utilized as part of dumpUnifiedJSON

Throws

std::invalid_argument

void dumpUnifiedJSON(const 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.

Any pieces not specified in the arguments are left out. For full structure see documentation of specific sections.

Parameters
  • workflow – a pointer to the Workflow

  • file_path – path for generated JSON

  • include_platform – boolean whether to include platform in JSON

  • include_workflow_exec – boolean whether to include workflow execution in JSON

  • include_workflow_graph – boolean whether to include workflow graph in JSON

  • include_energy – boolean whether to include energy consumption in JSON

  • generate_host_utilization_layout – boolean specifying whether or not you would like a possible host utilization layout to be generated

  • include_disk – boolean specifying whether to include disk operation in JSON (disk timestamps must be enabled)

  • include_bandwidth – boolean specifying whether to include link bandwidth measurements in JSON

void dumpWorkflowExecutionJSON(const std::shared_ptr<Workflow> &workflow, const 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.

The JSON array has the following format:

If generate_host_utilization_layout is set to true, a recursive function searches for a possible host utilization layout where tasks are assumed to use contiguous numbers of cores on their execution hosts. Note that each ComputeService does not enforce this, and such a layout may not exist for some workflow executions. In this situation, the function will go through the entire search space until all possible layouts are evaluated. For a large Workflow, this may take a very long time.

If a host utilization layout is able to be generated, the ‘vertical_position’ values will be set for each task run, and the task can be plotted as a rectangle on a graph where the y-axis denotes the number of cores - 1, and the x-axis denotes the workflow execution timeline. The vertical_position specifies the bottom of the rectangle. num_cores_allocated specifies the height of the rectangle.

Parameters
  • workflow – a pointer to the Workflow

  • file_path – the path to write the file

  • generate_host_utilization_layout – boolean specifying whether or not you would like a possible host utilization layout to be generated

  • writing_file – whether or not the file is written, true by default but will be false when utilized as part of dumpUnifiedJSON

Throws

std::invalid_argument

void dumpWorkflowGraphJSON(const std::shared_ptr<Workflow> &workflow, const std::string &file_path, bool writing_file = true)

Writes a JSON graph representation of the Workflow to a file, in the WfFormat format which is defined at: https://wfcommons.org/format.

Note that in the output JSON, the machines::cpu::speed is give as a GHz clock rate while in WRENCH core speeds are in Flop/sec. The GHz clock rate is computed by dividing the flop rate by 10^9 (so it’s not really a clock rate).

Parameters
  • workflow – a pointer to the workflow

  • file_path – the path to write the file

  • writing_file – whether or not the file is written, true by default but will be false when utilized as part of dumpUnifiedJSON

Throws

std::invalid_argument

void enableBandwidthTimestamps(bool enabled)

Enable or Disable the insertion of link-usage-related timestamps in the simulation output (enabled by default)

Parameters

enabled – true to enable, false to disable

void enableDiskTimestamps(bool enabled)

Enable or Disable the insertion of disk-related timestamps in the simulation output (enabled by default)

Parameters

enabled – true to enable, false to disable

void enableEnergyTimestamps(bool enabled)

Enable or Disable the insertion of energy-related timestamps in the simulation output (enabled by default)

Parameters

enabled – true to enable, false to disable

void enableFileReadWriteCopyTimestamps(bool enabled)

Enable or Disable the insertion of file-related timestamps in the simulation output (enabled by default)

Parameters

enabled – true to enable, false to disable

void enableWorkflowTaskTimestamps(bool enabled)

Enable or Disable the insertion of task-related timestamps in the simulation output (enabled by default)

Parameters

enabled – true to enable, false to disable

template<class T>
inline std::vector<SimulationTimestamp<T>*> getTrace()

Retrieve a copy of a simulation output trace once the simulation has completed.

Template Parameters

a – particular SimulationTimestampXXXX class (defined in SimulationTimestampTypes.h)

Returns

a vector of pointers to SimulationTimestampXXXX instances