scheduler_roaming.cc 847 B

12345678910111213141516171819202122232425
  1. #include "scheduler_roaming.h"
  2. #include "config.hpp"
  3. SchedulerRoaming::SchedulerRoaming(ThreadManager *thread_manager)
  4. : SchedulerPinnedBase(thread_manager, SubsecondTime::NS(Sim()->getCfg()->getInt("scheduler/roaming/quantum")))
  5. {
  6. m_core_mask.resize(Sim()->getConfig()->getApplicationCores());
  7. for (core_id_t core_id = 0; core_id < (core_id_t)Sim()->getConfig()->getApplicationCores(); core_id++)
  8. {
  9. m_core_mask[core_id] = Sim()->getCfg()->getBoolArray("scheduler/roaming/core_mask", core_id);
  10. }
  11. }
  12. void SchedulerRoaming::threadSetInitialAffinity(thread_id_t thread_id)
  13. {
  14. m_thread_info[thread_id].clearAffinity();
  15. for(core_id_t core_id = 0; core_id < (core_id_t)Sim()->getConfig()->getApplicationCores(); ++core_id)
  16. {
  17. if (m_core_mask[core_id])
  18. m_thread_info[thread_id].addAffinity(core_id);
  19. }
  20. }