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  friend class SimulationOutput;
78  void setDate(double date);
79  double date = -0.1;
80  };
81 
86  public:
87  /***********************/
89  /***********************/
92  virtual ~SimulationTimestampPair() = default;
93  /***********************/
95  /***********************/
96 
97  virtual SimulationTimestampPair *getEndpoint();
98 
99  protected:
101  SimulationTimestampPair *endpoint = nullptr;
102  };
103 
108 
109  public:
110 
111  WorkflowTask *getTask();
112  SimulationTimestampTask *getEndpoint() override;
113 
114  protected:
115  static std::map<std::string, SimulationTimestampTask *> pending_task_timestamps;
116  void setEndpoints();
118 
119  private:
120  friend class SimulationOutput;
121  WorkflowTask *task;
122  };
123 
128  private:
129  friend class SimulationOutput;
131  };
132 
137  private:
138  friend class SimulationOutput;
140  };
141 
146  private:
147  friend class SimulationOutput;
149  };
150 
155  private:
156  friend class SimulationOutput;
158  };
159 
161 
162 
167  public:
168 
172  SimulationTimestampFileRead *getEndpoint() override;
173  WorkflowFile *getFile();
174  FileLocation *getSource();
175  StorageService *getService();
176  WorkflowTask *getTask();
177 
178  protected:
183 
188 
193 
198 
202  static std::unordered_multimap<File, std::pair<SimulationTimestampFileRead *, WorkflowTask *>> pending_file_reads;
204 
205  void setEndpoints();
206  friend class SimulationOutput;
207  SimulationTimestampFileRead(WorkflowFile *file, FileLocation *src, StorageService *service, WorkflowTask *task = nullptr);
208  };
209 
212 
217  public:
218  friend class SimulationOutput;
220 
223  };
224 
229  private:
230  friend class SimulationOutput;
232  };
233 
238  private:
239  friend class SimulationOutput;
241  };
242 
244 
245 
250  public:
251 
255  SimulationTimestampFileWrite *getEndpoint() override;
256  WorkflowFile *getFile();
257  FileLocation *getDestination();
258  StorageService *getService();
259  WorkflowTask *getTask();
260 
261  protected:
266 
271 
276 
281 
285  static std::unordered_multimap<File, std::pair<SimulationTimestampFileWrite *, WorkflowTask *>> pending_file_writes;
287 
288  void setEndpoints();
289 
290  friend class SimulationOutput;
291  SimulationTimestampFileWrite(WorkflowFile *file, FileLocation *dst, StorageService *service, WorkflowTask *task = nullptr);
292  };
293 
296 
301  private:
302  friend class SimulationOutput;
306  };
307 
312  private:
313  friend class SimulationOutput;
315  };
316 
321  private:
322  friend class SimulationOutput;
324  };
325 
327  class FileLocation;
328 
333  public:
334 
338  SimulationTimestampFileCopy *getEndpoint() override;
339  WorkflowFile *getFile();
340  std::shared_ptr<FileLocation> getSource();
341  std::shared_ptr<FileLocation> getDestination();
342 
343  protected:
344  SimulationTimestampFileCopy(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
345 
350 
354  std::shared_ptr<FileLocation> source;
355 
359  std::shared_ptr<FileLocation> destination;
360 
364  static std::unordered_multimap<File, SimulationTimestampFileCopy *> pending_file_copies;
365 
366  void setEndpoints();
367  };
368 
371 
376  private:
377  friend class SimulationOutput;
380  SimulationTimestampFileCopyStart(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
381  };
382 
387  private:
388  friend class SimulationOutput;
389  SimulationTimestampFileCopyFailure(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
390  };
391 
396  private:
397  friend class SimulationOutput;
398  SimulationTimestampFileCopyCompletion(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
399  };
400 
402 
403 
408  public:
409 
413  SimulationTimestampDiskRead *getEndpoint() override;
414  double getBytes();
415  std::string getHostname();
416  std::string getMount();
417  int getCounter();
418 
419  protected:
423  std::string hostname;
424 
428  std::string mount;
429 
433  double bytes;
434 
438  int counter;
439 
440 
444  static std::unordered_multimap<DiskAccess, SimulationTimestampDiskRead *> pending_disk_reads;
445 
446  void setEndpoints();
447  friend class SimulationOutput;
448  SimulationTimestampDiskRead(std::string hostname, std::string mount, double bytes, int counter);
449  };
450 
453 
458  public:
459  friend class SimulationOutput;
460  SimulationTimestampDiskReadStart(std::string hostname, std::string mount, double bytes, int counter);
461 
464  };
465 
470  private:
471  friend class SimulationOutput;
472  SimulationTimestampDiskReadFailure(std::string hostname, std::string mount, double bytes, int counter);
473  };
474 
479  private:
480  friend class SimulationOutput;
481  SimulationTimestampDiskReadCompletion(std::string hostname, std::string mount, double bytes, int counter);
482  };
483 
485 
486 
491  public:
492 
496  SimulationTimestampDiskWrite *getEndpoint() override;
497  double getBytes();
498  std::string getHostname();
499  std::string getMount();
500  int getCounter();
501 
502  protected:
503 
507  std::string hostname;
508 
512  std::string mount;
513 
517  double bytes;
518 
522  int counter;
523 
527  static std::unordered_multimap<DiskAccess, SimulationTimestampDiskWrite *> pending_disk_writes;
528 
529  void setEndpoints();
530  friend class SimulationOutput;
531  SimulationTimestampDiskWrite(std::string hostname, std::string mount, double bytes, int counter);
532  };
533 
536 
541  public:
542  friend class SimulationOutput;
543  SimulationTimestampDiskWriteStart(std::string hostname, std::string mount, double bytes, int counter);
544 
547  };
548 
553  private:
554  friend class SimulationOutput;
555  SimulationTimestampDiskWriteFailure(std::string hostname, std::string mount, double bytes, int counter);
556  };
557 
562  private:
563  friend class SimulationOutput;
564  SimulationTimestampDiskWriteCompletion(std::string hostname, std::string mount, double bytes, int counter);
565  };
566 
571  public:
572  std::string getHostname();
573  int getPstate();
574 
575  private:
576  friend class SimulationOutput;
577  SimulationTimestampPstateSet(std::string hostname, int pstate);
578  std::string hostname;
579  int pstate;
580  };
581 
586  public:
587  std::string getHostname();
588  double getConsumption();
589 
590  private:
591  friend class SimulationOutput;
592  SimulationTimestampEnergyConsumption(std::string hostname, double joules);
593  std::string hostname;
594  double joules;
595  };
596 
601  public:
602  std::string getLinkname();
603  double getUsage();
604 
605  private:
606  friend class SimulationOutput;
607  SimulationTimestampLinkUsage(std::string linkname, double bytes_per_second);
608  std::string linkname;
609  double bytes_per_second;
610  };
611 };
612 
613 #endif //WRENCH_SIMULATIONTIMESTAMPTYPES_H
A base class for simulation timestamps regarding disk reads.
Definition: SimulationTimestampTypes.h:407
A simulation timestamp class for file read failure times.
Definition: SimulationTimestampTypes.h:228
int counter
counter to differentiate reads
Definition: SimulationTimestampTypes.h:438
A simulation timestamp class for file read start times.
Definition: SimulationTimestampTypes.h:216
A simulation timestamp class for file read completions.
Definition: SimulationTimestampTypes.h:237
A base class for simulation timestamps.
Definition: SimulationTimestampTypes.h:85
A simulation timestamp class for disk read completions.
Definition: SimulationTimestampTypes.h:478
A simulation timestamp class for WorkflowTask termination times.
Definition: SimulationTimestampTypes.h:154
A simulation timestamp class for WorkflowTask start times.
Definition: SimulationTimestampTypes.h:127
static std::unordered_multimap< DiskAccess, SimulationTimestampDiskWrite * > pending_disk_writes
the data structure that holds the ongoing disk writes.
Definition: SimulationTimestampTypes.h:527
A simulation timestamp class for file write completions.
Definition: SimulationTimestampTypes.h:320
A simulation timestamp class for file copy completions.
Definition: SimulationTimestampTypes.h:395
A simulation timestamp class for disk write start times.
Definition: SimulationTimestampTypes.h:540
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:115
A base class for simulation timestamps regarding file reads.
Definition: SimulationTimestampTypes.h:166
A simulation timestamp class for disk read failure times.
Definition: SimulationTimestampTypes.h:469
The storage service base class.
Definition: StorageService.h:36
int counter
counter to differentiate writes
Definition: SimulationTimestampTypes.h:522
A base class for simulation timestamps regarding file copies.
Definition: SimulationTimestampTypes.h:332
std::string mount
mount point of disk being written to
Definition: SimulationTimestampTypes.h:512
A simulation timestamp class for file copy failure times.
Definition: SimulationTimestampTypes.h:386
Definition: Alarm.cpp:20
FileLocation * source
The location where the WorkflowFile was being read from.
Definition: SimulationTimestampTypes.h:187
FileLocation * destination
The location where the WorkflowFile was being write from.
Definition: SimulationTimestampTypes.h:270
WorkflowTask * task
Task associated with write.
Definition: SimulationTimestampTypes.h:280
A simulation timestamp class for file copy start times.
Definition: SimulationTimestampTypes.h:375
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:107
A simulation timestamp class for disk write completions.
Definition: SimulationTimestampTypes.h:561
A simulation timestamp class for file write failure times.
Definition: SimulationTimestampTypes.h:311
double bytes
amount of bytes being written
Definition: SimulationTimestampTypes.h:517
std::string mount
mount point of disk being read from
Definition: SimulationTimestampTypes.h:428
static std::unordered_multimap< DiskAccess, SimulationTimestampDiskRead * > pending_disk_reads
the data structure that holds the ongoing disk reads.
Definition: SimulationTimestampTypes.h:444
A computational task in a Workflow.
Definition: WorkflowTask.h:31
std::string hostname
hostname of disk being read from
Definition: SimulationTimestampTypes.h:423
A simulation timestamp class for disk write failure times.
Definition: SimulationTimestampTypes.h:552
WorkflowTask * task
Task tied to read.
Definition: SimulationTimestampTypes.h:197
WorkflowFile * file
The WorkflowFile that was being write.
Definition: SimulationTimestampTypes.h:265
A class that encodes a file location.
Definition: FileLocation.h:28
A simulation timestamp class for WorkflowTask completion times.
Definition: SimulationTimestampTypes.h:145
double bytes
amount of bytes being read
Definition: SimulationTimestampTypes.h:433
StorageService * service
Service that initiated the write.
Definition: SimulationTimestampTypes.h:275
std::shared_ptr< FileLocation > source
The location where the WorkflowFile was being copied from.
Definition: SimulationTimestampTypes.h:354
WorkflowFile * file
The WorkflowFile that was being read.
Definition: SimulationTimestampTypes.h:182
WorkflowFile * file
The WorkflowFile that was being copied.
Definition: SimulationTimestampTypes.h:349
A simulation timestamp class for disk read start times.
Definition: SimulationTimestampTypes.h:457
A base class for simulation timestamps regarding file writes.
Definition: SimulationTimestampTypes.h:249
A base class for simulation timestamps regarding disk writes.
Definition: SimulationTimestampTypes.h:490
StorageService * service
Service that initiated the read.
Definition: SimulationTimestampTypes.h:192
A simulation timestamp class for file write start times.
Definition: SimulationTimestampTypes.h:300
std::string hostname
hostname of disk being written to
Definition: SimulationTimestampTypes.h:507
std::shared_ptr< FileLocation > destination
The location where the WorkflowFile was being copied to.
Definition: SimulationTimestampTypes.h:359
A class that contains post-mortem simulation-generated data.
Definition: SimulationOutput.h:27
A simulation timestamp class for WorkflowTask failure times.
Definition: SimulationTimestampTypes.h:136
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:570
static std::unordered_multimap< File, SimulationTimestampFileCopy * > pending_file_copies
the data structure that holds the ongoing file writes.
Definition: SimulationTimestampTypes.h:364
A simulation timestamp class for energy consumption.
Definition: SimulationTimestampTypes.h:585