SimulationTimestampTypes.h
1 
10 #ifndef WRENCH_SIMULATIONTIMESTAMPTYPES_H
11 #define WRENCH_SIMULATIONTIMESTAMPTYPES_H
12 
13 
14 #include "wrench/workflow/WorkflowTask.h"
15 #include <unordered_map>
16 
17 using namespace std;
18 /***********************/
20 /***********************/
21 
22 typedef std::tuple<void *, void *, void *> File;
23 typedef std::tuple<std::string, std::string, int> DiskAccess;
24 
25 namespace std {
26  template <>
27  struct hash<File>{
28  public :
29  size_t operator()(const File &file ) const
30  {
31  return std::hash<void *>()(std::get<0>(file)) ^ std::hash<void *>()(std::get<1>(file)) ^ std::hash<void *>()(std::get<2>(file));
32  }
33  };
34 
35  template <>
36  struct hash<DiskAccess>{
37  public :
38  size_t operator()(const DiskAccess &diskAccess ) const
39  {
40  return std::hash<std::string>()(std::get<0>(diskAccess)) ^ std::hash<std::string>()(std::get<1>(diskAccess)) ^ std::hash<int>()(std::get<2>(diskAccess));
41  }
42  };
43 };
44 
45 /***********************/
47 /***********************/
48 
49 namespace wrench {
50 
51 
52  class WorkflowTask;
53  class StorageService;
54  class FileLocation;
55 
59 
66 
72  public:
74  double getDate();
75 
76  private:
77  double date = -0.1;
78  };
79 
84  public:
85  /***********************/
87  /***********************/
90  virtual ~SimulationTimestampPair() = default;
91  /***********************/
93  /***********************/
94 
95  virtual SimulationTimestampPair *getEndpoint();
96 
97  protected:
99  SimulationTimestampPair *endpoint = nullptr;
100  };
101 
106 
107  public:
108 
109  WorkflowTask *getTask();
110  SimulationTimestampTask *getEndpoint() override;
111 
112  protected:
113  static std::map<std::string, SimulationTimestampTask *> pending_task_timestamps;
114  void setEndpoints();
116 
117  private:
118  friend class SimulationOutput;
119  WorkflowTask *task;
120  };
121 
126  private:
127  friend class SimulationOutput;
129  };
130 
135  private:
136  friend class SimulationOutput;
138  };
139 
144  private:
145  friend class SimulationOutput;
147  };
148 
153  private:
154  friend class SimulationOutput;
156  };
157 
159 
160 
165  public:
166 
170  SimulationTimestampFileRead *getEndpoint() override;
171  WorkflowFile *getFile();
172  FileLocation *getSource();
173  StorageService *getService();
174  WorkflowTask *getTask();
175 
176  protected:
181 
186 
191 
196 
200  static std::unordered_multimap<File, std::pair<SimulationTimestampFileRead *, WorkflowTask *>> pending_file_reads;
202 
203  void setEndpoints();
204  friend class SimulationOutput;
205  SimulationTimestampFileRead(WorkflowFile *file, FileLocation *src, StorageService *service, WorkflowTask *task = nullptr);
206  };
207 
210 
215  public:
216  friend class SimulationOutput;
218 
221  };
222 
227  private:
228  friend class SimulationOutput;
230  };
231 
236  private:
237  friend class SimulationOutput;
239  };
240 
242 
243 
248  public:
249 
253  SimulationTimestampFileWrite *getEndpoint() override;
254  WorkflowFile *getFile();
255  FileLocation *getDestination();
256  StorageService *getService();
257  WorkflowTask *getTask();
258 
259  protected:
264 
269 
274 
279 
283  static std::unordered_multimap<File, std::pair<SimulationTimestampFileWrite *, WorkflowTask *>> pending_file_writes;
285 
286  void setEndpoints();
287 
288  friend class SimulationOutput;
289  SimulationTimestampFileWrite(WorkflowFile *file, FileLocation *dst, StorageService *service, WorkflowTask *task = nullptr);
290  };
291 
294 
299  private:
300  friend class SimulationOutput;
304  };
305 
310  private:
311  friend class SimulationOutput;
313  };
314 
319  private:
320  friend class SimulationOutput;
322  };
323 
325  class FileLocation;
326 
331  public:
332 
336  SimulationTimestampFileCopy *getEndpoint() override;
337  WorkflowFile *getFile();
338  std::shared_ptr<FileLocation> getSource();
339  std::shared_ptr<FileLocation> getDestination();
340 
341  protected:
342  SimulationTimestampFileCopy(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
343 
348 
352  std::shared_ptr<FileLocation> source;
353 
357  std::shared_ptr<FileLocation> destination;
358 
362  static std::unordered_multimap<File, SimulationTimestampFileCopy *> pending_file_copies;
363 
364  void setEndpoints();
365  };
366 
369 
374  private:
375  friend class SimulationOutput;
378  SimulationTimestampFileCopyStart(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
379  };
380 
385  private:
386  friend class SimulationOutput;
387  SimulationTimestampFileCopyFailure(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
388  };
389 
394  private:
395  friend class SimulationOutput;
396  SimulationTimestampFileCopyCompletion(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
397  };
398 
400 
401 
406  public:
407 
411  SimulationTimestampDiskRead *getEndpoint() override;
412  double getBytes();
413  std::string getHostname();
414  std::string getMount();
415  int getCounter();
416 
417  protected:
421  std::string hostname;
422 
426  std::string mount;
427 
431  double bytes;
432 
436  int counter;
437 
438 
442  static std::unordered_multimap<DiskAccess, SimulationTimestampDiskRead *> pending_disk_reads;
443 
444  void setEndpoints();
445  friend class SimulationOutput;
446  SimulationTimestampDiskRead(std::string hostname, std::string mount, double bytes, int counter);
447  };
448 
451 
456  public:
457  friend class SimulationOutput;
458  SimulationTimestampDiskReadStart(std::string hostname, std::string mount, double bytes, int counter);
459 
462  };
463 
468  private:
469  friend class SimulationOutput;
470  SimulationTimestampDiskReadFailure(std::string hostname, std::string mount, double bytes, int counter);
471  };
472 
477  private:
478  friend class SimulationOutput;
479  SimulationTimestampDiskReadCompletion(std::string hostname, std::string mount, double bytes, int counter);
480  };
481 
483 
484 
489  public:
490 
494  SimulationTimestampDiskWrite *getEndpoint() override;
495  double getBytes();
496  std::string getHostname();
497  std::string getMount();
498  int getCounter();
499 
500  protected:
501 
505  std::string hostname;
506 
510  std::string mount;
511 
515  double bytes;
516 
520  int counter;
521 
525  static std::unordered_multimap<DiskAccess, SimulationTimestampDiskWrite *> pending_disk_writes;
526 
527  void setEndpoints();
528  friend class SimulationOutput;
529  SimulationTimestampDiskWrite(std::string hostname, std::string mount, double bytes, int counter);
530  };
531 
534 
539  public:
540  friend class SimulationOutput;
541  SimulationTimestampDiskWriteStart(std::string hostname, std::string mount, double bytes, int counter);
542 
545  };
546 
551  private:
552  friend class SimulationOutput;
553  SimulationTimestampDiskWriteFailure(std::string hostname, std::string mount, double bytes, int counter);
554  };
555 
560  private:
561  friend class SimulationOutput;
562  SimulationTimestampDiskWriteCompletion(std::string hostname, std::string mount, double bytes, int counter);
563  };
564 
569  public:
570  std::string getHostname();
571  int getPstate();
572 
573  private:
574  friend class SimulationOutput;
575  SimulationTimestampPstateSet(std::string hostname, int pstate);
576  std::string hostname;
577  int pstate;
578  };
579 
584  public:
585  std::string getHostname();
586  double getConsumption();
587 
588  private:
589  friend class SimulationOutput;
590  SimulationTimestampEnergyConsumption(std::string hostname, double joules);
591  std::string hostname;
592  double joules;
593  };
594 };
595 
596 #endif //WRENCH_SIMULATIONTIMESTAMPTYPES_H
A base class for simulation timestamps regarding disk reads.
Definition: SimulationTimestampTypes.h:405
A simulation timestamp class for file read failure times.
Definition: SimulationTimestampTypes.h:226
int counter
counter to differentiate reads
Definition: SimulationTimestampTypes.h:436
A simulation timestamp class for file read start times.
Definition: SimulationTimestampTypes.h:214
A simulation timestamp class for file read completions.
Definition: SimulationTimestampTypes.h:235
A base class for simulation timestamps.
Definition: SimulationTimestampTypes.h:83
A simulation timestamp class for disk read completions.
Definition: SimulationTimestampTypes.h:476
A simulation timestamp class for WorkflowTask termination times.
Definition: SimulationTimestampTypes.h:152
A simulation timestamp class for WorkflowTask start times.
Definition: SimulationTimestampTypes.h:125
static std::unordered_multimap< DiskAccess, SimulationTimestampDiskWrite * > pending_disk_writes
the data structure that holds the ongoing disk writes.
Definition: SimulationTimestampTypes.h:525
A simulation timestamp class for file write completions.
Definition: SimulationTimestampTypes.h:318
A simulation timestamp class for file copy completions.
Definition: SimulationTimestampTypes.h:393
A simulation timestamp class for disk write start times.
Definition: SimulationTimestampTypes.h:538
static std::map< std::string, SimulationTimestampTask * > pending_task_timestamps
A static map of SimulationTimestampTaskStart objects that have yet to matched with SimulationTimestam...
Definition: SimulationTimestampTypes.h:113
A base class for simulation timestamps regarding file reads.
Definition: SimulationTimestampTypes.h:164
A simulation timestamp class for disk read failure times.
Definition: SimulationTimestampTypes.h:467
The storage service base class.
Definition: StorageService.h:36
int counter
counter to differentiate writes
Definition: SimulationTimestampTypes.h:520
A base class for simulation timestamps regarding file copies.
Definition: SimulationTimestampTypes.h:330
std::string mount
mount point of disk being written to
Definition: SimulationTimestampTypes.h:510
A simulation timestamp class for file copy failure times.
Definition: SimulationTimestampTypes.h:384
Definition: Alarm.cpp:20
FileLocation * source
The location where the WorkflowFile was being read from.
Definition: SimulationTimestampTypes.h:185
FileLocation * destination
The location where the WorkflowFile was being write from.
Definition: SimulationTimestampTypes.h:268
WorkflowTask * task
Task associated with write.
Definition: SimulationTimestampTypes.h:278
A simulation timestamp class for file copy start times.
Definition: SimulationTimestampTypes.h:373
File, Source, Whoami used to be hashed as key for unordered multimap for ongoing file operations.
Definition: SimulationTimestampTypes.h:71
A base class for simulation timestamps regarding workflow tasks.
Definition: SimulationTimestampTypes.h:105
A simulation timestamp class for disk write completions.
Definition: SimulationTimestampTypes.h:559
A simulation timestamp class for file write failure times.
Definition: SimulationTimestampTypes.h:309
double bytes
amount of bytes being written
Definition: SimulationTimestampTypes.h:515
std::string mount
mount point of disk being read from
Definition: SimulationTimestampTypes.h:426
static std::unordered_multimap< DiskAccess, SimulationTimestampDiskRead * > pending_disk_reads
the data structure that holds the ongoing disk reads.
Definition: SimulationTimestampTypes.h:442
A computational task in a Workflow.
Definition: WorkflowTask.h:27
std::string hostname
hostname of disk being read from
Definition: SimulationTimestampTypes.h:421
A simulation timestamp class for disk write failure times.
Definition: SimulationTimestampTypes.h:550
WorkflowTask * task
Task tied to read.
Definition: SimulationTimestampTypes.h:195
WorkflowFile * file
The WorkflowFile that was being write.
Definition: SimulationTimestampTypes.h:263
A class that encodes a file location.
Definition: FileLocation.h:28
A simulation timestamp class for WorkflowTask completion times.
Definition: SimulationTimestampTypes.h:143
double bytes
amount of bytes being read
Definition: SimulationTimestampTypes.h:431
StorageService * service
Service that initiated the write.
Definition: SimulationTimestampTypes.h:273
std::shared_ptr< FileLocation > source
The location where the WorkflowFile was being copied from.
Definition: SimulationTimestampTypes.h:352
WorkflowFile * file
The WorkflowFile that was being read.
Definition: SimulationTimestampTypes.h:180
WorkflowFile * file
The WorkflowFile that was being copied.
Definition: SimulationTimestampTypes.h:347
A simulation timestamp class for disk read start times.
Definition: SimulationTimestampTypes.h:455
A base class for simulation timestamps regarding file writes.
Definition: SimulationTimestampTypes.h:247
A base class for simulation timestamps regarding disk writes.
Definition: SimulationTimestampTypes.h:488
StorageService * service
Service that initiated the read.
Definition: SimulationTimestampTypes.h:190
A simulation timestamp class for file write start times.
Definition: SimulationTimestampTypes.h:298
std::string hostname
hostname of disk being written to
Definition: SimulationTimestampTypes.h:505
std::shared_ptr< FileLocation > destination
The location where the WorkflowFile was being copied to.
Definition: SimulationTimestampTypes.h:357
A class that contains post-mortem simulation-generated data.
Definition: SimulationOutput.h:27
A simulation timestamp class for WorkflowTask failure times.
Definition: SimulationTimestampTypes.h:134
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
A simulation timestamp class for changes in a host's pstate.
Definition: SimulationTimestampTypes.h:568
static std::unordered_multimap< File, SimulationTimestampFileCopy * > pending_file_copies
the data structure that holds the ongoing file writes.
Definition: SimulationTimestampTypes.h:362
A simulation timestamp class for energy consumption.
Definition: SimulationTimestampTypes.h:583