fastforward_performance_manager.h 1022 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef __FASTFORWARD_PERFORMANCE_MANAGER_H
  2. #define __FASTFORWARD_PERFORMANCE_MANAGER_H
  3. #include "fixed_types.h"
  4. #include "subsecond_time.h"
  5. class FastForwardPerformanceManager
  6. {
  7. public:
  8. static FastForwardPerformanceManager* create();
  9. FastForwardPerformanceManager();
  10. void enable();
  11. void disable();
  12. protected:
  13. friend class FastforwardPerformanceModel;
  14. void recalibrateInstructionsCallback(core_id_t core_id);
  15. private:
  16. const SubsecondTime m_sync_interval;
  17. bool m_enabled;
  18. SubsecondTime m_target_sync_time;
  19. static SInt64 hook_instr_count(UInt64 self, UInt64 core_id) { ((FastForwardPerformanceManager*)self)->instr_count(core_id); return 0; }
  20. static SInt64 hook_periodic(UInt64 self, UInt64 time) { ((FastForwardPerformanceManager*)self)->periodic(*(subsecond_time_t*)&time); return 0; }
  21. void instr_count(core_id_t core_id);
  22. void periodic(SubsecondTime time);
  23. void step();
  24. };
  25. #endif // __FASTFORWARD_PERFORMANCE_MANAGER_H