Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics: use C++ type names
[simgrid.git] / src / surf / ptask_L07.hpp
1 /* Copyright (c) 2013-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <cstdlib>
8 #include <vector>
9 #include <xbt/base.h>
10 #include "src/surf/HostImpl.hpp"
11
12 #ifndef HOST_L07_HPP_
13 #define HOST_L07_HPP_
14
15 namespace simgrid {
16 namespace surf {
17
18 /***********
19  * Classes *
20  ***********/
21
22 class XBT_PRIVATE HostL07Model;
23 class XBT_PRIVATE CpuL07Model;
24 class XBT_PRIVATE NetworkL07Model;
25
26 class XBT_PRIVATE CpuL07;
27 class XBT_PRIVATE LinkL07;
28
29 class XBT_PRIVATE L07Action;
30 /*********
31  * Tools *
32  *********/
33
34 /*********
35  * Model *
36  *********/
37 class HostL07Model : public HostModel {
38 public:
39   HostL07Model();
40   ~HostL07Model();
41
42   double nextOccuringEvent(double now) override;
43   void updateActionsState(double now, double delta) override;
44   Action *executeParallelTask(int host_nb, sg_host_t *host_list,
45                               double *flops_amount, double *bytes_amount, double rate) override;
46 };
47
48 class CpuL07Model : public CpuModel {
49 public:
50   CpuL07Model(HostL07Model *hmodel,lmm_system_t sys);
51   ~CpuL07Model();
52
53   Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
54   HostL07Model *hostModel_;
55 };
56
57 class NetworkL07Model : public NetworkModel {
58 public:
59   NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys);
60   ~NetworkL07Model();
61   Link* createLink(const char *name, double bandwidth, double latency,
62       e_surf_link_sharing_policy_t policy,
63       xbt_dict_t properties) override;
64
65   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
66
67   HostL07Model *hostModel_;
68 };
69
70 /************
71  * Resource *
72  ************/
73
74 class CpuL07 : public Cpu {
75 public:
76   CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, std::vector<double> * speedPerPstate, int core);
77   ~CpuL07();
78   bool isUsed() override;
79   void apply_event(tmgr_trace_iterator_t event, double value) override;
80   Action *execution_start(double size) override;
81   Action *sleep(double duration) override;
82 protected:
83   void onSpeedChange() override;
84 };
85
86 class LinkL07 : public Link {
87 public:
88   LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
89       double bandwidth, double latency, e_surf_link_sharing_policy_t policy);
90   ~LinkL07(){ };
91   bool isUsed() override;
92   void apply_event(tmgr_trace_iterator_t event, double value) override;
93   void setBandwidth(double value) override;
94   void setLatency(double value) override;
95 };
96
97 /**********
98  * Action *
99  **********/
100 class L07Action : public CpuAction {
101   friend Action *CpuL07::execution_start(double size);
102   friend Action *CpuL07::sleep(double duration);
103   friend Action *HostL07Model::executeParallelTask(int host_nb, sg_host_t*host_list,
104                                                    double *flops_amount, double *bytes_amount, double rate);
105 public:
106   L07Action(Model *model, int host_nb, sg_host_t *host_list, double *flops_amount, double *bytes_amount, double rate);
107  ~L07Action();
108
109   void updateBound();
110
111   int unref() override;
112
113   std::vector<kernel::routing::NetCard*> * netcardList_ = new std::vector<kernel::routing::NetCard*>();
114   double *computationAmount_;
115   double *communicationAmount_;
116   double latency_;
117   double rate_;
118 };
119
120 }
121 }
122
123 #endif /* HOST_L07_HPP_ */