Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove StateTrace from the CPU constructor
[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
9 #include <vector>
10
11 #include <xbt/base.h>
12
13 #include "src/surf/HostImpl.hpp"
14
15 #ifndef HOST_L07_HPP_
16 #define HOST_L07_HPP_
17
18 namespace simgrid {
19 namespace surf {
20
21 /***********
22  * Classes *
23  ***********/
24
25 class XBT_PRIVATE HostL07Model;
26 class XBT_PRIVATE CpuL07Model;
27 class XBT_PRIVATE NetworkL07Model;
28
29 class XBT_PRIVATE CpuL07;
30 class XBT_PRIVATE LinkL07;
31
32 class XBT_PRIVATE L07Action;
33 /*********
34  * Tools *
35  *********/
36
37 /*********
38  * Model *
39  *********/
40 class HostL07Model : public HostModel {
41 public:
42   HostL07Model();
43   ~HostL07Model();
44
45   double next_occuring_event(double now) override;
46   void updateActionsState(double now, double delta) override;
47   Action *executeParallelTask(int host_nb, sg_host_t *host_list,
48                 double *flops_amount, double *bytes_amount,
49                 double rate) override;
50 };
51
52 class CpuL07Model : public CpuModel {
53 public:
54   CpuL07Model(HostL07Model *hmodel,lmm_system_t sys);
55   ~CpuL07Model();
56
57   Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedPeakList,
58                           tmgr_trace_t speedTrace, int core) override;
59   HostL07Model *p_hostModel;
60 };
61
62 class NetworkL07Model : public NetworkModel {
63 public:
64   NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys);
65   ~NetworkL07Model();
66   Link* createLink(const char *name, double bandwidth, double latency,
67       e_surf_link_sharing_policy_t policy,
68       xbt_dict_t properties) override;
69
70   Action *communicate(NetCard *src, NetCard *dst, double size, double rate) override;
71   bool next_occuring_event_isIdempotent() override {return true;}
72
73   HostL07Model *p_hostModel;
74 };
75
76 /************
77  * Resource *
78  ************/
79
80 class CpuL07 : public Cpu {
81 public:
82   CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, tmgr_trace_t power_trace, int core);
83   ~CpuL07();
84   bool isUsed() override;
85   void apply_event(tmgr_trace_iterator_t event, double value) override;
86   Action *execution_start(double size) override;
87   Action *sleep(double duration) override;
88 protected:
89   void onSpeedChange() override;
90 };
91
92 class LinkL07 : public Link {
93 public:
94   LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
95       double bandwidth, double latency, e_surf_link_sharing_policy_t policy);
96   ~LinkL07(){ };
97   bool isUsed() override;
98   void apply_event(tmgr_trace_iterator_t event, double value) override;
99   void updateBandwidth(double value) override;
100   void updateLatency(double value) override;
101 };
102
103 /**********
104  * Action *
105  **********/
106 class L07Action : public CpuAction {
107   friend Action *CpuL07::execution_start(double size);
108   friend Action *CpuL07::sleep(double duration);
109   friend Action *HostL07Model::executeParallelTask(int host_nb,
110                                                    sg_host_t*host_list,
111                                                    double *flops_amount,
112                                                    double *bytes_amount,
113                                                    double rate);
114 public:
115   L07Action(Model *model, int host_nb,
116           sg_host_t*host_list,
117           double *flops_amount,
118        double *bytes_amount,
119           double rate);
120  ~L07Action();
121
122   void updateBound();
123
124   int unref() override;
125
126   std::vector<NetCard*> * p_netcardList = new std::vector<NetCard*>();
127   double *p_computationAmount;
128   double *p_communicationAmount;
129   double m_latency;
130   double m_rate;
131 };
132
133 }
134 }
135
136 #endif /* HOST_L07_HPP_ */