synctrace.py 829 B

1234567891011121314151617181920212223
  1. import sim
  2. class SyncTrace:
  3. def hook_thread_create(self, threadid, creator):
  4. print '[SYNC]', threadid, 'from app', sim.thread.get_thread_appid(threadid), 'created by', creator
  5. def hook_thread_start(self, threadid, time):
  6. print '[SYNC]', threadid, 'start at', time / 1000000 # Time in ns
  7. def hook_thread_exit(self, threadid, time):
  8. print '[SYNC]', threadid, 'exit at', time / 1000000
  9. def hook_thread_stall(self, threadid, reason, time):
  10. print '[SYNC]', threadid, 'sleep for', reason, 'at', time / 1000000
  11. def hook_thread_resume(self, threadid, threadby, time):
  12. print '[SYNC]', threadid, 'woken by', threadby, 'at', time / 1000000
  13. def hook_thread_migrate(self, threadid, coreid, time):
  14. print '[SYNC]', threadid, 'scheduled to', coreid, 'at', time / 1000000
  15. sim.util.register(SyncTrace())