scheduler_big_small.h 988 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef __SCHEDULER_BIG_SMALL_H
  2. #define __SCHEDULER_BIG_SMALL_H
  3. #include "scheduler_pinned_base.h"
  4. #include <unordered_map>
  5. class SchedulerBigSmall : public SchedulerPinnedBase
  6. {
  7. public:
  8. SchedulerBigSmall(ThreadManager *thread_manager);
  9. virtual void threadSetInitialAffinity(thread_id_t thread_id);
  10. virtual void threadStall(thread_id_t thread_id, ThreadManager::stall_type_t reason, SubsecondTime time);
  11. virtual void threadExit(thread_id_t thread_id, SubsecondTime time);
  12. virtual void periodic(SubsecondTime time);
  13. private:
  14. const bool m_debug_output;
  15. // Configuration
  16. UInt64 m_num_big_cores;
  17. cpu_set_t m_mask_big;
  18. cpu_set_t m_mask_small;
  19. SubsecondTime m_last_reshuffle;
  20. UInt64 m_rng;
  21. std::unordered_map<thread_id_t, bool> m_thread_isbig;
  22. void moveToBig(thread_id_t thread_id);
  23. void moveToSmall(thread_id_t thread_id);
  24. void pickBigThread();
  25. };
  26. #endif // __SCHEDULER_BIG_SMALL_H