1 /* Copyright (c) 2013-2015. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef SURF_NETWORK_CM02_HPP_
8 #define SURF_NETWORK_CM02_HPP_
12 #include "network_interface.hpp"
14 #include "xbt/graph.h"
25 class XBT_PRIVATE NetworkCm02Model;
26 class XBT_PRIVATE NetworkCm02Action;
27 class XBT_PRIVATE NetworkSmpiModel;
36 XBT_PRIVATE void net_define_callbacks(void);
45 class NetworkCm02Model : public NetworkModel {
48 ~NetworkCm02Model() { }
49 Link* createLink(const char *name,
50 double bw_initial, tmgr_trace_t bw_trace,
51 double lat_initial, tmgr_trace_t lat_trace,
52 int initiallyOn, tmgr_trace_t state_trace,
53 e_surf_link_sharing_policy_t policy,
54 xbt_dict_t properties) override;
55 void updateActionsStateLazy(double now, double delta) override;
56 void updateActionsStateFull(double now, double delta) override;
57 Action *communicate(NetCard *src, NetCard *dst, double size, double rate) override;
58 bool next_occuring_event_isIdempotent() override {return true;}
59 virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
61 bool m_haveGap = false;
68 class NetworkCm02Link : public Link {
70 NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
72 double constraint_value,
73 int initiallyOn, tmgr_trace_t state_trace,
74 double bw_peak, tmgr_trace_t bw_trace,
75 double lat_initial, tmgr_trace_t lat_trace,
76 e_surf_link_sharing_policy_t policy);
78 void apply_event(tmgr_trace_iterator_t event, double value) override;
79 void updateBandwidth(double value) override;
80 void updateLatency(double value) override;
81 virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction * /*action*/) {};
88 class NetworkCm02Action : public NetworkAction {
89 friend Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, double size, double rate);
90 friend NetworkSmpiModel;
93 NetworkCm02Action(Model *model, double cost, bool failed)
94 : NetworkAction(model, cost, failed) {};
95 void updateRemainingLazy(double now);
103 #endif /* SURF_NETWORK_CM02_HPP_ */