Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
dc691d09176d3be191e4262845a836d17b901b26
[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  * Classes *
18  ***********/
19 class XBT_PRIVATE NetworkCm02Model;
20 class XBT_PRIVATE NetworkCm02Action;
21 class XBT_PRIVATE NetworkSmpiModel;
22
23 /*********
24  * Tools *
25  *********/
26
27 XBT_PRIVATE void net_define_callbacks(void);
28
29 /*********
30  * Model *
31  *********/
32 class NetworkCm02Model : public NetworkModel {
33 private:
34   void initialize();
35 public:
36   NetworkCm02Model(int /*i*/) : NetworkModel() {};
37   NetworkCm02Model();
38   ~NetworkCm02Model() { }
39   Link* createLink(const char *name,
40                   double bw_initial,
41                   tmgr_trace_t bw_trace,
42                   double lat_initial,
43                   tmgr_trace_t lat_trace,
44                   e_surf_resource_state_t state_initial,
45                   tmgr_trace_t state_trace,
46                   e_surf_link_sharing_policy_t policy,
47                   xbt_dict_t properties) override;
48   void addTraces();
49   void updateActionsStateLazy(double now, double delta);
50   void updateActionsStateFull(double now, double delta);
51   Action *communicate(RoutingEdge *src, RoutingEdge *dst,
52                                            double size, double rate);
53   bool shareResourcesIsIdempotent() {return true;}
54   virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
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_history_t history,
68                                    e_surf_resource_state_t state_init,
69                                    tmgr_trace_t state_trace,
70                                    double metric_peak,
71                                    tmgr_trace_t metric_trace,
72                                    double lat_initial,
73                                    tmgr_trace_t lat_trace,
74                                e_surf_link_sharing_policy_t policy);
75   void updateState(tmgr_trace_event_t event_type, double value, double date);
76   void updateBandwidth(double value, double date=surf_get_clock());
77   void updateLatency(double value, double date=surf_get_clock());
78   virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
79
80
81 };
82
83
84 /**********
85  * Action *
86  **********/
87 class NetworkCm02Action : public NetworkAction {
88   friend Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
89   friend NetworkSmpiModel;
90
91 public:
92   NetworkCm02Action(Model *model, double cost, bool failed)
93      : NetworkAction(model, cost, failed) {};
94   void updateRemainingLazy(double now);
95 protected:
96   double m_senderGap;
97 };
98
99 #endif /* SURF_NETWORK_CM02_HPP_ */