SST/macro
packet_flow_arbitrator.h
Go to the documentation of this file.
1 #ifndef PACKETFLOW_ARBITRATOR_H
2 #define PACKETFLOW_ARBITRATOR_H
3 
10 
11 namespace sstmac {
12 namespace hw {
13 
16 {
17 
18  public:
19  /**
20  Assign bandwidth to payload.
21  @return The time at which the packet can be forwarded to the next switch/node/etc.
22  */
23  virtual void
24  arbitrate(packet_stats_st& st) = 0;
25 
26  virtual std::string
27  to_string() const = 0;
28 
30 
31  virtual void
32  set_outgoing_bw(double out_bw) {
33  out_bw_ = out_bw;
34  inv_out_bw_ = 1.0 / out_bw;
35  }
36 
37  double outgoing_bw() const {
38  return out_bw_;
39  }
40 
41  static inline timestamp
42  credit_delay(double max_in_bw, double out_bw, long bytes){
43  double credit_delta = 1.0/out_bw - 1.0/max_in_bw;
44  credit_delta = std::max(0., credit_delta);
45  return timestamp(bytes * credit_delta);
46  }
47 
48  virtual void
50 
51  /**
52  * @brief partition Partition the arbitrator time windows into a series of randomly sized chunks
53  * @param noise The noise model that randomly selects time values
54  * @param num_intervals
55  */
56  virtual void
57  partition(noise_model* noise,
58  int num_intervals);
59 
61  clone(double bw) const = 0;
62 
63  virtual int
64  bytes_sending(timestamp now) const = 0;
65 
66  protected:
68 
69  protected:
70  double out_bw_;
71  double inv_out_bw_;
72 
73 };
74 
77 {
78  public:
80 
81  virtual void
83 
85  clone(double bw) const {
87  arb->set_outgoing_bw(bw);
88  return arb;
89  }
90 
91  std::string
92  to_string() const {
93  return "packet_flow null arbitrator";
94  }
95 
96  int
97  bytes_sending(timestamp now) const;
98 
99 };
100 
101 
104 {
105  public:
107 
108  virtual void
110 
112  clone(double bw) const {
114  arb->set_outgoing_bw(bw);
115  return arb;
116  }
117 
118  std::string
119  to_string() const {
120  return "packet_flow simple arbitrator";
121  }
122 
123  int
124  bytes_sending(timestamp now) const;
125 
126  protected:
128 
129 };
130 
133 {
134  typedef uint64_t ticks_t;
135  typedef double bw_t;
136 
137  public:
139 
141 
142  virtual void
144 
145  virtual void
146  set_outgoing_bw(bw_t bw);
147 
148  int
149  bytes_sending(timestamp now) const;
150 
152  clone(double bw) const {
155  new_arb->set_outgoing_bw(bw);
156  return new_arb;
157  }
158 
159  std::string
160  to_string() const {
161  return "cut through arbitrator";
162  }
163 
164  void
165  partition(noise_model* model,
166  int num_intervals);
167 
168  void
170 
171  private:
172  void clean_up(ticks_t now);
173 
174  void
175  do_arbitrate(packet_stats_st& st);
176 
178  bw_t bw_available; //bandwidth is bytes per timestamp tick
179  ticks_t start;
180  ticks_t length;
182 
184  next(nullptr) {
185  }
186 
188  }
189 
190  void truncate_after(ticks_t delta_t);
191 
192  void split(ticks_t delta_t);
193  };
194 
196 
197  /** Convert from bytes/sec to bytes/tick */
200 
201 };
202 
204 
205 }
206 }
207 
208 #endif // PACKETFLOW_ARBITRATOR_H
209 
virtual int bytes_sending(timestamp now) const =0
packet_flow_bandwidth_arbitrator * clone(double bw) const
DeclareFactory(node)
virtual std::string to_string() const =0
double bw_tick_to_sec_conversion_
Convert from bytes/sec to bytes/tick.
virtual packet_flow_bandwidth_arbitrator * clone(double bw) const
static timestamp credit_delay(double max_in_bw, double out_bw, long bytes)
A basic container for time (subject to future transplant).
Definition: timestamp.h:29
SUMI = Simulator unified messagine interface It is also the name for a solid ink in Japanese - i...
virtual void arbitrate(packet_stats_st &st)=0
Assign bandwidth to payload.
virtual void init_noise_model(noise_model *noise)
virtual void partition(noise_model *noise, int num_intervals)
partition Partition the arbitrator time windows into a series of randomly sized chunks ...
virtual packet_flow_bandwidth_arbitrator * clone(double bw) const
virtual packet_flow_bandwidth_arbitrator * clone(double bw) const =0