Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[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  * Model *
34  *********/
35
36 namespace simgrid {
37 namespace surf {
38
39 class NetworkCm02Model : public NetworkModel {
40 public:
41   NetworkCm02Model();
42   ~NetworkCm02Model() { }
43   Link* createLink(const char *name,
44       double bw_initial, tmgr_trace_t bw_trace,
45       double lat_initial, tmgr_trace_t lat_trace,
46       tmgr_trace_t state_trace,
47       e_surf_link_sharing_policy_t policy,
48       xbt_dict_t properties) override;
49   void updateActionsStateLazy(double now, double delta) override;
50   void updateActionsStateFull(double now, double delta) override;
51   Action *communicate(NetCard *src, NetCard *dst, double size, double rate) override;
52   bool next_occuring_event_isIdempotent() override {return true;}
53   virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
54 protected:
55   bool m_haveGap = false;
56 };
57
58 /************
59  * Resource *
60  ************/
61
62 class NetworkCm02Link : public Link {
63 public:
64   NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
65       lmm_system_t system,
66       double constraint_value,
67       tmgr_trace_t state_trace,
68       double bw_peak, tmgr_trace_t bw_trace,
69       double lat_initial, tmgr_trace_t lat_trace,
70       e_surf_link_sharing_policy_t policy);
71
72   void apply_event(tmgr_trace_iterator_t event, double value) override;
73   void updateBandwidth(double value) override;
74   void updateLatency(double value) override;
75   virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
76 };
77
78
79 /**********
80  * Action *
81  **********/
82 class NetworkCm02Action : public NetworkAction {
83   friend Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, double size, double rate);
84   friend NetworkSmpiModel;
85
86 public:
87   NetworkCm02Action(Model *model, double cost, bool failed)
88      : NetworkAction(model, cost, failed) {};
89   void updateRemainingLazy(double now);
90 protected:
91   double m_senderGap;
92 };
93
94 }
95 }
96
97 #endif /* SURF_NETWORK_CM02_HPP_ */