WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
SimulationTimestampTypes.h
1 
10 #ifndef WRENCH_SIMULATIONTIMESTAMPTYPES_H
11 #define WRENCH_SIMULATIONTIMESTAMPTYPES_H
12 
13 
14 #include "wrench/data_file//DataFile.h"
15 #include "wrench/workflow/WorkflowTask.h"
16 #include <unordered_map>
17 
18 using namespace std;
19 /***********************/
21 /***********************/
22 
23 typedef std::tuple<std::shared_ptr<wrench::DataFile>, std::shared_ptr<wrench::FileLocation>, std::shared_ptr<wrench::StorageService>> FileReadWrite;
24 typedef std::tuple<std::shared_ptr<wrench::DataFile>, std::shared_ptr<wrench::FileLocation>, std::shared_ptr<wrench::FileLocation>> FileCopy;
25 
26 //struct FileCopy {
27 // std::shared_ptr<wrench::DataFile> file;
28 // std::shared_ptr<wrench::FileLocation> src;
29 // std::shared_ptr<wrench::FileLocation> dst;
30 //};
31 
32 typedef std::tuple<std::string, std::string, int> DiskAccess;
33 
34 namespace std {
35  template <>
36  struct hash<FileCopy>{
37  public :
38  size_t operator()(const FileCopy &file ) const
39  {
40  return std::hash<void *>()(std::get<0>(file).get()) ^ std::hash<void *>()(std::get<1>(file).get()) ^ std::hash<void *>()(std::get<2>(file).get());
41 // return std::hash<void *>()(file.file.get()) ^ std::hash<void *>()(file.src.get()) ^ std::hash<void *>()(file.dst.get());
42  }
43  };
44 
45  template <>
46  struct hash<FileReadWrite>{
47  public :
48  size_t operator()(const FileReadWrite &file ) const
49  {
50  return std::hash<void *>()(std::get<0>(file).get()) ^ std::hash<void *>()(std::get<1>(file).get()) ^ std::hash<void *>()(std::get<2>(file).get());
51  }
52  };
53 
54 
55  template <>
56  struct hash<DiskAccess>{
57  public :
58  size_t operator()(const DiskAccess &diskAccess ) const
59  {
60  return std::hash<std::string>()(std::get<0>(diskAccess)) ^ std::hash<std::string>()(std::get<1>(diskAccess)) ^ std::hash<int>()(std::get<2>(diskAccess));
61  }
62  };
63 };
64 
65 /***********************/
67 /***********************/
68 
69 namespace wrench {
70 
71 
72  class WorkflowTask;
73  class StorageService;
74  class FileLocation;
75 
79 
86 
92  public:
94  double getDate();
95 
96  protected:
100  double date = -0.1;
101 
102  private:
103  friend class SimulationOutput;
104  void setDate(double date);
105  };
106 
111  public:
112  /***********************/
114  /***********************/
116  SimulationTimestampPair(double date, SimulationTimestampPair *endpoint);
117  virtual ~SimulationTimestampPair() = default;
118  /***********************/
120  /***********************/
121 
122  virtual SimulationTimestampPair *getEndpoint();
123 
124  protected:
126  SimulationTimestampPair *endpoint = nullptr;
127  };
128 
133 
134  public:
135  std::shared_ptr<WorkflowTask>getTask();
136  SimulationTimestampTask *getEndpoint() override;
137 
138  protected:
139  static std::map<std::string, SimulationTimestampTask *> pending_task_timestamps;
140  void setEndpoints();
141  SimulationTimestampTask(double date, std::shared_ptr<WorkflowTask>task);
142 
143  private:
144  friend class SimulationOutput;
145  std::shared_ptr<WorkflowTask>task;
146  };
147 
152  private:
153  friend class SimulationOutput;
154  SimulationTimestampTaskStart(double date, std::shared_ptr<WorkflowTask>task);
155  };
156 
161  private:
162  friend class SimulationOutput;
163  SimulationTimestampTaskFailure(double date, std::shared_ptr<WorkflowTask>task);
164  };
165 
170  private:
171  friend class SimulationOutput;
172  SimulationTimestampTaskCompletion(double date, std::shared_ptr<WorkflowTask>task);
173  };
174 
179  private:
180  friend class SimulationOutput;
181  SimulationTimestampTaskTermination(double date, std::shared_ptr<WorkflowTask>);
182  };
183 
185 
186 
191  public:
192 
196  SimulationTimestampFileRead *getEndpoint() override;
197  std::shared_ptr<DataFile>getFile();
198  std::shared_ptr<FileLocation> getSource();
199  std::shared_ptr<StorageService> getService();
200  std::shared_ptr<WorkflowTask>getTask();
201 
202  protected:
206  std::shared_ptr<DataFile>file;
207 
211  std::shared_ptr<FileLocation> source;
212 
216  std::shared_ptr<StorageService> service;
217 
221  std::shared_ptr<WorkflowTask>task;
222 
226  static std::unordered_multimap<FileReadWrite, std::pair<SimulationTimestampFileRead *, std::shared_ptr<WorkflowTask>>> pending_file_reads;
228 
229  void setEndpoints();
230  friend class SimulationOutput;
231  SimulationTimestampFileRead(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service, std::shared_ptr<WorkflowTask>task = nullptr);
232  };
233 
236 
241  public:
242  friend class SimulationOutput;
243  SimulationTimestampFileReadStart(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service, std::shared_ptr<WorkflowTask>task = nullptr);
244 
247  };
248 
253  private:
254  friend class SimulationOutput;
255  SimulationTimestampFileReadFailure(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service, std::shared_ptr<WorkflowTask>task = nullptr);
256  };
257 
262  private:
263  friend class SimulationOutput;
264  SimulationTimestampFileReadCompletion(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<StorageService> service, std::shared_ptr<WorkflowTask>task = nullptr);
265  };
266 
268 
269 
274  public:
275 
279  SimulationTimestampFileWrite *getEndpoint() override;
280  std::shared_ptr<DataFile>getFile();
281  std::shared_ptr<FileLocation> getDestination();
282  std::shared_ptr<StorageService> getService();
283  std::shared_ptr<WorkflowTask>getTask();
284 
285  protected:
289  std::shared_ptr<DataFile> file;
290 
294  std::shared_ptr<FileLocation> destination;
295 
299  std::shared_ptr<StorageService> service;
300 
304  std::shared_ptr<WorkflowTask>task;
305 
309  static std::unordered_multimap<FileReadWrite, std::pair<SimulationTimestampFileWrite *, std::shared_ptr<WorkflowTask>>> pending_file_writes;
311 
312  void setEndpoints();
313 
314  friend class SimulationOutput;
315  SimulationTimestampFileWrite(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> dst, std::shared_ptr<StorageService> service, std::shared_ptr<WorkflowTask>task = nullptr);
316  };
317 
320 
325  private:
326  friend class SimulationOutput;
329  SimulationTimestampFileWriteStart(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> dst, std::shared_ptr<StorageService> service, std::shared_ptr<WorkflowTask>task = nullptr);
330  };
331 
336  private:
337  friend class SimulationOutput;
338  SimulationTimestampFileWriteFailure(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> dst, std::shared_ptr<StorageService> service, std::shared_ptr<WorkflowTask>task = nullptr);
339  };
340 
345  private:
346  friend class SimulationOutput;
347  SimulationTimestampFileWriteCompletion(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> dst, std::shared_ptr<StorageService> service, std::shared_ptr<WorkflowTask>task = nullptr);
348  };
349 
351  class FileLocation;
352 
357  public:
358 
362  SimulationTimestampFileCopy *getEndpoint() override;
363  std::shared_ptr<DataFile>getFile();
364  std::shared_ptr<FileLocation> getSource();
365  std::shared_ptr<FileLocation> getDestination();
366 
367  protected:
368  SimulationTimestampFileCopy(double date, std::shared_ptr<DataFile> file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
369 
373  std::shared_ptr<DataFile> file;
374 
378  std::shared_ptr<FileLocation> source;
379 
383  std::shared_ptr<FileLocation> destination;
384 
388  static std::unordered_multimap<FileCopy, SimulationTimestampFileCopy *> pending_file_copies;
389 
390  void setEndpoints();
391  };
392 
395 
400  private:
401  friend class SimulationOutput;
404  SimulationTimestampFileCopyStart(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
405  };
406 
411  private:
412  friend class SimulationOutput;
413  SimulationTimestampFileCopyFailure(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
414  };
415 
420  private:
421  friend class SimulationOutput;
422  SimulationTimestampFileCopyCompletion(double date, std::shared_ptr<DataFile>file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
423  };
424 
426 
427 
432  public:
433 
437  SimulationTimestampDiskRead *getEndpoint() override;
438  double getBytes();
439  std::string getHostname();
440  std::string getMount();
441  int getCounter();
442 
443  protected:
447  std::string hostname;
448 
452  std::string mount;
453 
457  double bytes;
458 
462  int counter;
463 
464 
468  static std::unordered_multimap<DiskAccess, SimulationTimestampDiskRead *> pending_disk_reads;
469 
470  void setEndpoints();
471  friend class SimulationOutput;
472  SimulationTimestampDiskRead(double date, std::string hostname, std::string mount, double bytes, int counter);
473  };
474 
477 
482  public:
483  friend class SimulationOutput;
484  SimulationTimestampDiskReadStart(double date, std::string hostname, std::string mount, double bytes, int counter);
485 
488  };
489 
494  private:
495  friend class SimulationOutput;
496  SimulationTimestampDiskReadFailure(double date, std::string hostname, std::string mount, double bytes, int counter);
497  };
498 
503  private:
504  friend class SimulationOutput;
505  SimulationTimestampDiskReadCompletion(double date, std::string hostname, std::string mount, double bytes, int counter);
506  };
507 
509 
510 
515  public:
516 
520  SimulationTimestampDiskWrite *getEndpoint() override;
521  double getBytes();
522  std::string getHostname();
523  std::string getMount();
524  int getCounter();
525 
526  protected:
527 
531  std::string hostname;
532 
536  std::string mount;
537 
541  double bytes;
542 
546  int counter;
547 
551  static std::unordered_multimap<DiskAccess, SimulationTimestampDiskWrite *> pending_disk_writes;
552 
553  void setEndpoints();
554  friend class SimulationOutput;
555  SimulationTimestampDiskWrite(double date, std::string hostname, std::string mount, double bytes, int counter);
556  };
557 
560 
565  public:
566  friend class SimulationOutput;
567  SimulationTimestampDiskWriteStart(double date, std::string hostname, std::string mount, double bytes, int counter);
568 
571  };
572 
577  private:
578  friend class SimulationOutput;
579  SimulationTimestampDiskWriteFailure(double date, std::string hostname, std::string mount, double bytes, int counter);
580  };
581 
586  private:
587  friend class SimulationOutput;
588  SimulationTimestampDiskWriteCompletion(double date, std::string hostname, std::string mount, double bytes, int counter);
589  };
590 
595  public:
596  std::string getHostname();
597  int getPstate();
598 
599  private:
600  friend class SimulationOutput;
601  SimulationTimestampPstateSet(double date, std::string hostname, int pstate);
602  std::string hostname;
603  int pstate;
604  };
605 
610  public:
611  std::string getHostname();
612  double getConsumption();
613 
614  private:
615  friend class SimulationOutput;
616  SimulationTimestampEnergyConsumption(double date, std::string hostname, double joules);
617  std::string hostname;
618  double joules;
619  };
620 
625  public:
626  std::string getLinkname();
627  double getUsage();
628 
629  private:
630  friend class SimulationOutput;
631  SimulationTimestampLinkUsage(double date, std::string linkname, double bytes_per_second);
632  std::string linkname;
633  double bytes_per_second;
634  };
635 };
636 
637 #endif //WRENCH_SIMULATIONTIMESTAMPTYPES_H
wrench::SimulationTimestampDiskRead
A base class for simulation timestamps regarding disk reads.
Definition: SimulationTimestampTypes.h:431
wrench::SimulationTimestampFileReadFailure
A simulation timestamp class for file read failure times.
Definition: SimulationTimestampTypes.h:252
wrench::SimulationTimestampFileCopy::pending_file_copies
static std::unordered_multimap< FileCopy, SimulationTimestampFileCopy * > pending_file_copies
the data structure that holds the ongoing file writes.
Definition: SimulationTimestampTypes.h:388
wrench::SimulationTimestampDiskRead::counter
int counter
counter to differentiate reads
Definition: SimulationTimestampTypes.h:462
wrench::SimulationTimestampFileReadStart
A simulation timestamp class for file read start times.
Definition: SimulationTimestampTypes.h:240
wrench::SimulationTimestampFileReadCompletion
A simulation timestamp class for file read completions.
Definition: SimulationTimestampTypes.h:261
wrench::SimulationTimestampFileRead::service
std::shared_ptr< StorageService > service
Service that initiated the read.
Definition: SimulationTimestampTypes.h:216
wrench::SimulationTimestampPair
A base class for simulation timestamps.
Definition: SimulationTimestampTypes.h:110
wrench::SimulationTimestampDiskReadCompletion
A simulation timestamp class for disk read completions.
Definition: SimulationTimestampTypes.h:502
wrench::SimulationTimestampTaskTermination
A simulation timestamp class for WorkflowTask termination times.
Definition: SimulationTimestampTypes.h:178
wrench::SimulationTimestampTaskStart
A simulation timestamp class for WorkflowTask start times.
Definition: SimulationTimestampTypes.h:151
wrench::SimulationTimestampDiskWrite::pending_disk_writes
static std::unordered_multimap< DiskAccess, SimulationTimestampDiskWrite * > pending_disk_writes
the data structure that holds the ongoing disk writes.
Definition: SimulationTimestampTypes.h:551
wrench::SimulationTimestampFileWriteCompletion
A simulation timestamp class for file write completions.
Definition: SimulationTimestampTypes.h:344
wrench::SimulationTimestampFileWrite::destination
std::shared_ptr< FileLocation > destination
The location where the DataFile was being write from.
Definition: SimulationTimestampTypes.h:294
wrench::SimulationTimestampFileCopyCompletion
A simulation timestamp class for file copy completions.
Definition: SimulationTimestampTypes.h:419
wrench::SimulationTimestampDiskWriteStart
A simulation timestamp class for disk write start times.
Definition: SimulationTimestampTypes.h:564
wrench::SimulationTimestampFileRead::source
std::shared_ptr< FileLocation > source
The location where the DataFile was being read from.
Definition: SimulationTimestampTypes.h:211
wrench::SimulationTimestampTask::pending_task_timestamps
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:139
wrench::SimulationTimestampFileRead
A base class for simulation timestamps regarding file reads.
Definition: SimulationTimestampTypes.h:190
wrench::SimulationTimestampDiskReadFailure
A simulation timestamp class for disk read failure times.
Definition: SimulationTimestampTypes.h:493
wrench::SimulationTimestampFileWrite::service
std::shared_ptr< StorageService > service
Service that initiated the write.
Definition: SimulationTimestampTypes.h:299
wrench::SimulationTimestampFileCopy::file
std::shared_ptr< DataFile > file
The DataFile that was being copied.
Definition: SimulationTimestampTypes.h:373
wrench::SimulationTimestampDiskWrite::counter
int counter
counter to differentiate writes
Definition: SimulationTimestampTypes.h:546
wrench::SimulationTimestampFileCopy
A base class for simulation timestamps regarding file copies.
Definition: SimulationTimestampTypes.h:356
wrench::SimulationTimestampDiskWrite::mount
std::string mount
mount point of disk being written to
Definition: SimulationTimestampTypes.h:536
wrench::SimulationTimestampFileCopyFailure
A simulation timestamp class for file copy failure times.
Definition: SimulationTimestampTypes.h:410
wrench
Definition: Action.cpp:28
wrench::SimulationTimestampFileCopyStart
A simulation timestamp class for file copy start times.
Definition: SimulationTimestampTypes.h:399
wrench::SimulationTimestampType
File, Source, Whoami used to be hashed as key for unordered multimap for ongoing file operations.
Definition: SimulationTimestampTypes.h:91
wrench::SimulationTimestampTask
A base class for simulation timestamps regarding workflow tasks.
Definition: SimulationTimestampTypes.h:132
wrench::SimulationTimestampDiskWriteCompletion
A simulation timestamp class for disk write completions.
Definition: SimulationTimestampTypes.h:585
wrench::SimulationTimestampFileWrite::task
std::shared_ptr< WorkflowTask > task
Task associated with write.
Definition: SimulationTimestampTypes.h:304
wrench::SimulationTimestampFileWriteFailure
A simulation timestamp class for file write failure times.
Definition: SimulationTimestampTypes.h:335
wrench::SimulationTimestampDiskWrite::bytes
double bytes
amount of bytes being written
Definition: SimulationTimestampTypes.h:541
wrench::SimulationTimestampDiskRead::mount
std::string mount
mount point of disk being read from
Definition: SimulationTimestampTypes.h:452
wrench::SimulationTimestampDiskRead::pending_disk_reads
static std::unordered_multimap< DiskAccess, SimulationTimestampDiskRead * > pending_disk_reads
the data structure that holds the ongoing disk reads.
Definition: SimulationTimestampTypes.h:468
wrench::SimulationTimestampDiskRead::hostname
std::string hostname
hostname of disk being read from
Definition: SimulationTimestampTypes.h:447
wrench::SimulationTimestampDiskWriteFailure
A simulation timestamp class for disk write failure times.
Definition: SimulationTimestampTypes.h:576
wrench::FileLocation
A class that encodes a file location.
Definition: FileLocation.h:29
wrench::SimulationTimestampTaskCompletion
A simulation timestamp class for WorkflowTask completion times.
Definition: SimulationTimestampTypes.h:169
wrench::SimulationTimestampDiskRead::bytes
double bytes
amount of bytes being read
Definition: SimulationTimestampTypes.h:457
wrench::SimulationTimestampFileWrite::file
std::shared_ptr< DataFile > file
The DataFile that was being write.
Definition: SimulationTimestampTypes.h:289
wrench::SimulationTimestampFileCopy::source
std::shared_ptr< FileLocation > source
The location where the DataFile was being copied from.
Definition: SimulationTimestampTypes.h:378
wrench::SimulationTimestampFileRead::file
std::shared_ptr< DataFile > file
The DataFile that was being read.
Definition: SimulationTimestampTypes.h:206
wrench::SimulationTimestampDiskReadStart
A simulation timestamp class for disk read start times.
Definition: SimulationTimestampTypes.h:481
wrench::SimulationTimestampFileRead::task
std::shared_ptr< WorkflowTask > task
Task tied to read.
Definition: SimulationTimestampTypes.h:221
wrench::SimulationTimestampFileWrite
A base class for simulation timestamps regarding file writes.
Definition: SimulationTimestampTypes.h:273
wrench::SimulationTimestampDiskWrite
A base class for simulation timestamps regarding disk writes.
Definition: SimulationTimestampTypes.h:514
wrench::SimulationTimestampFileWriteStart
A simulation timestamp class for file write start times.
Definition: SimulationTimestampTypes.h:324
wrench::SimulationTimestampDiskWrite::hostname
std::string hostname
hostname of disk being written to
Definition: SimulationTimestampTypes.h:531
wrench::SimulationTimestampFileCopy::destination
std::shared_ptr< FileLocation > destination
The location where the DataFile was being copied to.
Definition: SimulationTimestampTypes.h:383
wrench::SimulationOutput
A class that contains post-mortem simulation-generated data.
Definition: SimulationOutput.h:27
wrench::SimulationTimestampTaskFailure
A simulation timestamp class for WorkflowTask failure times.
Definition: SimulationTimestampTypes.h:160
wrench::SimulationTimestampPstateSet
A simulation timestamp class for changes in a host's pstate.
Definition: SimulationTimestampTypes.h:594
wrench::SimulationTimestampEnergyConsumption
A simulation timestamp class for energy consumption.
Definition: SimulationTimestampTypes.h:609