cache_efficiency_tracker.h 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. #ifndef __CACHE_EFFICIENCY_TRACKER_H
  2. #define __CACHE_EFFICIENCY_TRACKER_H
  3. #include "cache_block_info.h"
  4. #include "hit_where.h"
  5. #include "core.h"
  6. namespace CacheEfficiencyTracker
  7. {
  8. typedef UInt64 (*CallbackGetOwner)(UInt64 user, core_id_t core_id, UInt64 address);
  9. typedef void (*CallbackNotifyAccess)(UInt64 user, UInt64 owner, Core::mem_op_t mem_op_type, HitWhere::where_t hit_where);
  10. typedef void (*CallbackNotifyEvict)(UInt64 user, bool on_roi_end, UInt64 owner, UInt64 evictor, CacheBlockInfo::BitsUsedType bits_used, UInt32 bits_total);
  11. struct Callbacks
  12. {
  13. CacheEfficiencyTracker::CallbackGetOwner get_owner_func;
  14. CacheEfficiencyTracker::CallbackNotifyAccess notify_access_func;
  15. CacheEfficiencyTracker::CallbackNotifyEvict notify_evict_func;
  16. UInt64 user_arg;
  17. Callbacks() : get_owner_func(NULL), notify_access_func(NULL), notify_evict_func(NULL), user_arg(0) {}
  18. UInt64 call_get_owner(core_id_t core_id, UInt64 address) const { return get_owner_func(user_arg, core_id, address); }
  19. void call_notify_access(UInt64 owner, Core::mem_op_t mem_op_type, HitWhere::where_t hit_where) const
  20. { notify_access_func(user_arg, owner, mem_op_type, hit_where); }
  21. void call_notify_evict(bool on_roi_end, UInt64 owner, UInt64 evictor, CacheBlockInfo::BitsUsedType bits_used, UInt32 bits_total) const
  22. { notify_evict_func(user_arg, on_roi_end, owner, evictor, bits_used, bits_total); }
  23. };
  24. };
  25. #endif // __CACHE_EFFICIENCY_TRACKER_H