network_model_emesh_hop_counter.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef NETWORK_MODEL_EMESH_HOP_COUNTER_H
  2. #define NETWORK_MODEL_EMESH_HOP_COUNTER_H
  3. #include "network.h"
  4. #include "network_model.h"
  5. #include "lock.h"
  6. class NetworkModelEMeshHopCounter : public NetworkModel
  7. {
  8. public:
  9. NetworkModelEMeshHopCounter(Network *net, EStaticNetwork net_type);
  10. ~NetworkModelEMeshHopCounter();
  11. void routePacket(const NetPacket &pkt,
  12. std::vector<Hop> &nextHops);
  13. void processReceivedPacket(NetPacket &pkt);
  14. void enable() { _enabled = true; }
  15. void disable() { _enabled = false; }
  16. private:
  17. void computePosition(core_id_t core, SInt32 &x, SInt32 &y);
  18. SInt32 computeDistance(SInt32 x1, SInt32 y1, SInt32 x2, SInt32 y2);
  19. SubsecondTime computeSerializationLatency(UInt32 pkt_length);
  20. ComponentLatency _hopLatency;
  21. ComponentBandwidthPerCycle _linkBandwidth;
  22. SInt32 _meshWidth;
  23. SInt32 _meshHeight;
  24. bool _enabled;
  25. Lock _lock;
  26. // Performance Counters
  27. UInt64 _num_packets;
  28. UInt64 _num_bytes;
  29. SubsecondTime _total_latency;
  30. };
  31. #endif