Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use simgrid::Host instead of xbt_dictelt_t for root main object
[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 private:
47   void initialize();
48 public:
49   NetworkCm02Model(int /*i*/) : NetworkModel() {};
50   NetworkCm02Model();
51   ~NetworkCm02Model() { }
52   Link* createLink(const char *name,
53                   double bw_initial,
54                   tmgr_trace_t bw_trace,
55                   double lat_initial,
56                   tmgr_trace_t lat_trace,
57                   e_surf_resource_state_t state_initial,
58                   tmgr_trace_t state_trace,
59                   e_surf_link_sharing_policy_t policy,
60                   xbt_dict_t properties) override;
61   void addTraces();
62   void updateActionsStateLazy(double now, double delta);
63   void updateActionsStateFull(double now, double delta);
64   Action *communicate(RoutingEdge *src, RoutingEdge *dst,
65                                            double size, double rate);
66   bool shareResourcesIsIdempotent() {return true;}
67   virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
68   bool m_haveGap = false;
69 };
70
71 /************
72  * Resource *
73  ************/
74
75 class NetworkCm02Link : public Link {
76 public:
77   NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
78                                    lmm_system_t system,
79                                    double constraint_value,
80                                    tmgr_history_t history,
81                                    e_surf_resource_state_t state_init,
82                                    tmgr_trace_t state_trace,
83                                    double metric_peak,
84                                    tmgr_trace_t metric_trace,
85                                    double lat_initial,
86                                    tmgr_trace_t lat_trace,
87                                e_surf_link_sharing_policy_t policy);
88   void updateState(tmgr_trace_event_t event_type, double value, double date);
89   void updateBandwidth(double value, double date=surf_get_clock());
90   void updateLatency(double value, double date=surf_get_clock());
91   virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
92
93
94 };
95
96
97 /**********
98  * Action *
99  **********/
100 class NetworkCm02Action : public NetworkAction {
101   friend Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
102   friend NetworkSmpiModel;
103
104 public:
105   NetworkCm02Action(Model *model, double cost, bool failed)
106      : NetworkAction(model, cost, failed) {};
107   void updateRemainingLazy(double now);
108 protected:
109   double m_senderGap;
110 };
111
112 }
113 }
114
115 #endif /* SURF_NETWORK_CM02_HPP_ */