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  WorkflowTask *getTask();
111  SimulationTimestampTask *getEndpoint() override;
112 
113  protected:
114  static std::map<std::string, SimulationTimestampTask *> pending_task_timestamps;
115  void setEndpoints();
117 
118  private:
119  friend class SimulationOutput;
120  WorkflowTask *task;
121  };
122 
127  private:
128  friend class SimulationOutput;
130  };
131 
136  private:
137  friend class SimulationOutput;
139  };
140 
145  private:
146  friend class SimulationOutput;
148  };
149 
154  private:
155  friend class SimulationOutput;
157  };
158 
160 
161 
166  public:
167 
171  SimulationTimestampFileRead *getEndpoint() override;
172  WorkflowFile *getFile();
173  FileLocation *getSource();
174  StorageService *getService();
175  WorkflowTask *getTask();
176 
177  protected:
182 
187 
192 
197 
201  static std::unordered_multimap<File, std::pair<SimulationTimestampFileRead *, WorkflowTask *>> pending_file_reads;
203 
204  void setEndpoints();
205  friend class SimulationOutput;
206  SimulationTimestampFileRead(WorkflowFile *file, FileLocation *src, StorageService *service, WorkflowTask *task = nullptr);
207  };
208 
211 
216  public:
217  friend class SimulationOutput;
219 
222  };
223 
228  private:
229  friend class SimulationOutput;
231  };
232 
237  private:
238  friend class SimulationOutput;
240  };
241 
243 
244 
249  public:
250 
254  SimulationTimestampFileWrite *getEndpoint() override;
255  WorkflowFile *getFile();
256  FileLocation *getDestination();
257  StorageService *getService();
258  WorkflowTask *getTask();
259 
260  protected:
265 
270 
275 
280 
284  static std::unordered_multimap<File, std::pair<SimulationTimestampFileWrite *, WorkflowTask *>> pending_file_writes;
286 
287  void setEndpoints();
288 
289  friend class SimulationOutput;
290  SimulationTimestampFileWrite(WorkflowFile *file, FileLocation *dst, StorageService *service, WorkflowTask *task = nullptr);
291  };
292 
295 
300  private:
301  friend class SimulationOutput;
305  };
306 
311  private:
312  friend class SimulationOutput;
314  };
315 
320  private:
321  friend class SimulationOutput;
323  };
324 
326  class FileLocation;
327 
332  public:
333 
337  SimulationTimestampFileCopy *getEndpoint() override;
338  WorkflowFile *getFile();
339  std::shared_ptr<FileLocation> getSource();
340  std::shared_ptr<FileLocation> getDestination();
341 
342  protected:
343  SimulationTimestampFileCopy(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
344 
349 
353  std::shared_ptr<FileLocation> source;
354 
358  std::shared_ptr<FileLocation> destination;
359 
363  static std::unordered_multimap<File, SimulationTimestampFileCopy *> pending_file_copies;
364 
365  void setEndpoints();
366  };
367 
370 
375  private:
376  friend class SimulationOutput;
379  SimulationTimestampFileCopyStart(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
380  };
381 
386  private:
387  friend class SimulationOutput;
388  SimulationTimestampFileCopyFailure(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
389  };
390 
395  private:
396  friend class SimulationOutput;
397  SimulationTimestampFileCopyCompletion(WorkflowFile *file, std::shared_ptr<FileLocation> src, std::shared_ptr<FileLocation> dst);
398  };
399 
401 
402 
407  public:
408 
412  SimulationTimestampDiskRead *getEndpoint() override;
413  double getBytes();
414  std::string getHostname();
415  std::string getMount();
416  int getCounter();
417 
418  protected:
422  std::string hostname;
423 
427  std::string mount;
428 
432  double bytes;
433 
437  int counter;
438 
439 
443  static std::unordered_multimap<DiskAccess, SimulationTimestampDiskRead *> pending_disk_reads;
444 
445  void setEndpoints();
446  friend class SimulationOutput;
447  SimulationTimestampDiskRead(std::string hostname, std::string mount, double bytes, int counter);
448  };
449 
452 
457  public:
458  friend class SimulationOutput;
459  SimulationTimestampDiskReadStart(std::string hostname, std::string mount, double bytes, int counter);
460 
463  };
464 
469  private:
470  friend class SimulationOutput;
471  SimulationTimestampDiskReadFailure(std::string hostname, std::string mount, double bytes, int counter);
472  };
473 
478  private:
479  friend class SimulationOutput;
480  SimulationTimestampDiskReadCompletion(std::string hostname, std::string mount, double bytes, int counter);
481  };
482 
484 
485 
490  public:
491 
495  SimulationTimestampDiskWrite *getEndpoint() override;
496  double getBytes();
497  std::string getHostname();
498  std::string getMount();
499  int getCounter();
500 
501  protected:
502 
506  std::string hostname;
507 
511  std::string mount;
512 
516  double bytes;
517 
521  int counter;
522 
526  static std::unordered_multimap<DiskAccess, SimulationTimestampDiskWrite *> pending_disk_writes;
527 
528  void setEndpoints();
529  friend class SimulationOutput;
530  SimulationTimestampDiskWrite(std::string hostname, std::string mount, double bytes, int counter);
531  };
532 
535 
540  public:
541  friend class SimulationOutput;
542  SimulationTimestampDiskWriteStart(std::string hostname, std::string mount, double bytes, int counter);
543 
546  };
547 
552  private:
553  friend class SimulationOutput;
554  SimulationTimestampDiskWriteFailure(std::string hostname, std::string mount, double bytes, int counter);
555  };
556 
561  private:
562  friend class SimulationOutput;
563  SimulationTimestampDiskWriteCompletion(std::string hostname, std::string mount, double bytes, int counter);
564  };
565 
570  public:
571  std::string getHostname();
572  int getPstate();
573 
574  private:
575  friend class SimulationOutput;
576  SimulationTimestampPstateSet(std::string hostname, int pstate);
577  std::string hostname;
578  int pstate;
579  };
580 
585  public:
586  std::string getHostname();
587  double getConsumption();
588 
589  private:
590  friend class SimulationOutput;
591  SimulationTimestampEnergyConsumption(std::string hostname, double joules);
592  std::string hostname;
593  double joules;
594  };
595 
600  public:
601  std::string getLinkname();
602  double getUsage();
603 
604  private:
605  friend class SimulationOutput;
606  SimulationTimestampLinkUsage(std::string linkname, double bytes_per_second);
607  std::string linkname;
608  double bytes_per_second;
609  };
610 };
611 
612 #endif //WRENCH_SIMULATIONTIMESTAMPTYPES_H
A base class for simulation timestamps regarding disk reads.
Definition: SimulationTimestampTypes.h:406
A simulation timestamp class for file read failure times.
Definition: SimulationTimestampTypes.h:227
int counter
counter to differentiate reads
Definition: SimulationTimestampTypes.h:437
A simulation timestamp class for file read start times.
Definition: SimulationTimestampTypes.h:215
A simulation timestamp class for file read completions.
Definition: SimulationTimestampTypes.h:236
A base class for simulation timestamps.
Definition: SimulationTimestampTypes.h:85
A simulation timestamp class for disk read completions.
Definition: SimulationTimestampTypes.h:477
A simulation timestamp class for WorkflowTask termination times.
Definition: SimulationTimestampTypes.h:153
A simulation timestamp class for WorkflowTask start times.
Definition: SimulationTimestampTypes.h:126
static std::unordered_multimap< DiskAccess, SimulationTimestampDiskWrite * > pending_disk_writes
the data structure that holds the ongoing disk writes.
Definition: SimulationTimestampTypes.h:526
A simulation timestamp class for file write completions.
Definition: SimulationTimestampTypes.h:319
A simulation timestamp class for file copy completions.
Definition: SimulationTimestampTypes.h:394
A simulation timestamp class for disk write start times.
Definition: SimulationTimestampTypes.h:539
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:114
A base class for simulation timestamps regarding file reads.
Definition: SimulationTimestampTypes.h:165
A simulation timestamp class for disk read failure times.
Definition: SimulationTimestampTypes.h:468
The storage service base class.
Definition: StorageService.h:36
int counter
counter to differentiate writes
Definition: SimulationTimestampTypes.h:521
A base class for simulation timestamps regarding file copies.
Definition: SimulationTimestampTypes.h:331
std::string mount
mount point of disk being written to
Definition: SimulationTimestampTypes.h:511
A simulation timestamp class for file copy failure times.
Definition: SimulationTimestampTypes.h:385
Definition: Alarm.cpp:20
FileLocation * source
The location where the WorkflowFile was being read from.
Definition: SimulationTimestampTypes.h:186
FileLocation * destination
The location where the WorkflowFile was being write from.
Definition: SimulationTimestampTypes.h:269
WorkflowTask * task
Task associated with write.
Definition: SimulationTimestampTypes.h:279
A simulation timestamp class for file copy start times.
Definition: SimulationTimestampTypes.h:374
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:560
A simulation timestamp class for file write failure times.
Definition: SimulationTimestampTypes.h:310
double bytes
amount of bytes being written
Definition: SimulationTimestampTypes.h:516
std::string mount
mount point of disk being read from
Definition: SimulationTimestampTypes.h:427
static std::unordered_multimap< DiskAccess, SimulationTimestampDiskRead * > pending_disk_reads
the data structure that holds the ongoing disk reads.
Definition: SimulationTimestampTypes.h:443
A computational task in a Workflow.
Definition: WorkflowTask.h:31
std::string hostname
hostname of disk being read from
Definition: SimulationTimestampTypes.h:422
A simulation timestamp class for disk write failure times.
Definition: SimulationTimestampTypes.h:551
WorkflowTask * task
Task tied to read.
Definition: SimulationTimestampTypes.h:196
WorkflowFile * file
The WorkflowFile that was being write.
Definition: SimulationTimestampTypes.h:264
A class that encodes a file location.
Definition: FileLocation.h:28
A simulation timestamp class for WorkflowTask completion times.
Definition: SimulationTimestampTypes.h:144
double bytes
amount of bytes being read
Definition: SimulationTimestampTypes.h:432
StorageService * service
Service that initiated the write.
Definition: SimulationTimestampTypes.h:274
std::shared_ptr< FileLocation > source
The location where the WorkflowFile was being copied from.
Definition: SimulationTimestampTypes.h:353
WorkflowFile * file
The WorkflowFile that was being read.
Definition: SimulationTimestampTypes.h:181
WorkflowFile * file
The WorkflowFile that was being copied.
Definition: SimulationTimestampTypes.h:348
A simulation timestamp class for disk read start times.
Definition: SimulationTimestampTypes.h:456
A base class for simulation timestamps regarding file writes.
Definition: SimulationTimestampTypes.h:248
A base class for simulation timestamps regarding disk writes.
Definition: SimulationTimestampTypes.h:489
StorageService * service
Service that initiated the read.
Definition: SimulationTimestampTypes.h:191
A simulation timestamp class for file write start times.
Definition: SimulationTimestampTypes.h:299
std::string hostname
hostname of disk being written to
Definition: SimulationTimestampTypes.h:506
std::shared_ptr< FileLocation > destination
The location where the WorkflowFile was being copied to.
Definition: SimulationTimestampTypes.h:358
A class that contains post-mortem simulation-generated data.
Definition: SimulationOutput.h:27
A simulation timestamp class for WorkflowTask failure times.
Definition: SimulationTimestampTypes.h:135
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:569
static std::unordered_multimap< File, SimulationTimestampFileCopy * > pending_file_copies
the data structure that holds the ongoing file writes.
Definition: SimulationTimestampTypes.h:363
A simulation timestamp class for energy consumption.
Definition: SimulationTimestampTypes.h:584