contention_model.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef CONTENTION_MODEL_H
  2. #define CONTENTION_MODEL_H
  3. #include <vector>
  4. #include "fixed_types.h"
  5. #include "subsecond_time.h"
  6. class ContentionModel {
  7. private:
  8. UInt32 m_num_outstanding;
  9. std::vector<std::pair<SubsecondTime, UInt64> > m_time;
  10. SubsecondTime m_t_last;
  11. const ComponentPeriod *m_proc_period;
  12. public:
  13. UInt64 m_n_requests;
  14. UInt64 m_n_barriers;
  15. UInt64 m_n_outoforder;
  16. UInt64 m_n_simultaneous;
  17. UInt64 m_n_hasfreefail;
  18. SubsecondTime m_total_delay;
  19. SubsecondTime m_total_barrier_delay;
  20. ContentionModel();
  21. ContentionModel(String name, core_id_t core_id, UInt32 num_outstanding = 1);
  22. ~ContentionModel();
  23. uint64_t getBarrierCompletionTime(uint64_t t_start, uint64_t t_delay, UInt64 tag = 0); // Support legacy components
  24. SubsecondTime getBarrierCompletionTime(SubsecondTime t_start, SubsecondTime t_delay, UInt64 tag = 0);
  25. uint64_t getCompletionTime(uint64_t t_start, uint64_t t_delay, UInt64 tag = 0); // Support legacy components
  26. SubsecondTime getCompletionTime(SubsecondTime t_start, SubsecondTime t_delay, UInt64 tag = 0);
  27. uint64_t getStartTime(uint64_t t_start);
  28. SubsecondTime getStartTime(SubsecondTime t_start);
  29. UInt32 getNumUsed(uint64_t t_start);
  30. UInt32 getNumUsed(SubsecondTime t_start);
  31. SubsecondTime getTagCompletionTime(UInt64 tag);
  32. bool hasFreeSlot(SubsecondTime t_start, UInt64 tag = -1);
  33. bool hasFreeSlot(uint64_t t_start, UInt64 tag = -1);
  34. bool hasTag(UInt64 tag);
  35. };
  36. #endif // CONTENTION_MODEL_H