Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
objectifies the Future Event Set of trace events
[simgrid.git] / src / surf / network_cm02.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 #ifndef SURF_NETWORK_CM02_HPP_
8 #define SURF_NETWORK_CM02_HPP_
9
10 #include <xbt/base.h>
11
12 #include "network_interface.hpp"
13 #include "xbt/fifo.h"
14 #include "xbt/graph.h"
15
16
17
18 /***********
19  * Classes *
20  ***********/
21
22 namespace simgrid {
23 namespace surf {
24
25 class XBT_PRIVATE NetworkCm02Model;
26 class XBT_PRIVATE NetworkCm02Action;
27 class XBT_PRIVATE NetworkSmpiModel;
28
29 }
30 }
31
32 /*********
33  * Tools *
34  *********/
35
36 XBT_PRIVATE void net_define_callbacks(void);
37
38 /*********
39  * Model *
40  *********/
41
42 namespace simgrid {
43 namespace surf {
44
45 class NetworkCm02Model : public NetworkModel {
46 public:
47   NetworkCm02Model();
48   ~NetworkCm02Model() { }
49   Link* createLink(const char *name,
50                   double bw_initial,
51                   tmgr_trace_t bw_trace,
52                   double lat_initial,
53                   tmgr_trace_t lat_trace,
54                   int initiallyOn,
55                   tmgr_trace_t state_trace,
56                   e_surf_link_sharing_policy_t policy,
57                   xbt_dict_t properties) override;
58   void addTraces() override;
59   void updateActionsStateLazy(double now, double delta) override;
60   void updateActionsStateFull(double now, double delta) override;
61   Action *communicate(NetCard *src, NetCard *dst,
62                                            double size, double rate) override;
63   bool shareResourcesIsIdempotent() override {return true;}
64   virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
65 protected:
66   bool m_haveGap = false;
67 };
68
69 /************
70  * Resource *
71  ************/
72
73 class NetworkCm02Link : public Link {
74 public:
75   NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
76                                    lmm_system_t system,
77                                    double constraint_value,
78                                    sg_future_evt_set_t fes,
79                                    int initiallyOn,
80                                    tmgr_trace_t state_trace,
81                                    double metric_peak,
82                                    tmgr_trace_t metric_trace,
83                                    double lat_initial,
84                                    tmgr_trace_t lat_trace,
85                                e_surf_link_sharing_policy_t policy);
86   void updateState(tmgr_trace_iterator_t event_type, double value, double date) override;
87   void updateBandwidth(double value, double date=surf_get_clock()) override;
88   void updateLatency(double value, double date=surf_get_clock()) override;
89   virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
90
91
92 };
93
94
95 /**********
96  * Action *
97  **********/
98 class NetworkCm02Action : public NetworkAction {
99   friend Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, double size, double rate);
100   friend NetworkSmpiModel;
101
102 public:
103   NetworkCm02Action(Model *model, double cost, bool failed)
104      : NetworkAction(model, cost, failed) {};
105   void updateRemainingLazy(double now);
106 protected:
107   double m_senderGap;
108 };
109
110 }
111 }
112
113 #endif /* SURF_NETWORK_CM02_HPP_ */