Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
f9d418ab69ccaa261494b65cbe7ace87e19a5bc5
[simgrid.git] / src / surf / network_cm02.hpp
1 /* Copyright (c) 2013-2014. 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 "network_interface.hpp"
8 #include "xbt/fifo.h"
9 #include "xbt/graph.h"
10
11 #ifndef SURF_NETWORK_CM02_HPP_
12 #define SURF_NETWORK_CM02_HPP_
13
14 /***********
15  * Classes *
16  ***********/
17 class NetworkCm02Model;
18 class NetworkCm02Action;
19
20 /*********
21  * Tools *
22  *********/
23
24 void net_define_callbacks(void);
25
26 /*********
27  * Model *
28  *********/
29 class NetworkCm02Model : public NetworkModel {
30 private:
31   void initialize();
32 public:
33   NetworkCm02Model(int /*i*/) : NetworkModel("network") {
34         f_networkSolve = lmm_solve;
35         m_haveGap = false;
36   };//FIXME: add network clean interface
37   NetworkCm02Model(const char *name) : NetworkModel(name) {
38     this->initialize();
39   }
40   NetworkCm02Model() : NetworkModel("network") {
41     this->initialize();
42   }
43   ~NetworkCm02Model() {
44   }
45   Link* createLink(const char *name,
46                   double bw_initial,
47                   tmgr_trace_t bw_trace,
48                   double lat_initial,
49                   tmgr_trace_t lat_trace,
50                   e_surf_resource_state_t state_initial,
51                   tmgr_trace_t state_trace,
52                   e_surf_link_sharing_policy_t policy,
53                   xbt_dict_t properties);
54   void addTraces();
55   void updateActionsStateLazy(double now, double delta);
56   void updateActionsStateFull(double now, double delta);
57   Action *communicate(RoutingEdge *src, RoutingEdge *dst,
58                                            double size, double rate);
59 };
60
61 /************
62  * Resource *
63  ************/
64
65 class NetworkCm02Link : public Link {
66 public:
67   NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
68                                    lmm_system_t system,
69                                    double constraint_value,
70                                    tmgr_history_t history,
71                                    e_surf_resource_state_t state_init,
72                                    tmgr_trace_t state_trace,
73                                    double metric_peak,
74                                    tmgr_trace_t metric_trace,
75                                    double lat_initial,
76                                    tmgr_trace_t lat_trace,
77                                e_surf_link_sharing_policy_t policy);
78   void updateState(tmgr_trace_event_t event_type, double value, double date);
79   void updateBandwidth(double value, double date=surf_get_clock());
80   void updateLatency(double value, double date=surf_get_clock());
81 };
82
83
84 /**********
85  * Action *
86  **********/
87
88 class NetworkCm02Action : public NetworkAction {
89   friend Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
90
91 public:
92   NetworkCm02Action(Model *model, double cost, bool failed)
93  : NetworkAction(model, cost, failed) {};
94   void updateRemainingLazy(double now);
95   void recycle();
96 };
97
98 #endif /* SURF_NETWORK_CM02_HPP_ */