Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import atexit, yappi
- def init_yappi():
- print('[YAPPI START]')
- yappi.set_clock_type('wall')
- yappi.start()
- @atexit.register
- def finish_yappi():
- print('[YAPPI STOP]')
- yappi.stop()
- print('[YAPPI WRITE]')
- stats = yappi.get_func_stats()
- for stat_type in ['pstat', 'callgrind', 'ystat']:
- print('writing /tmp/pants.{}'.format(stat_type))
- stats.save('/tmp/pants.{}'.format(stat_type), type=stat_type)
- print('\n[YAPPI FUNC_STATS]')
- print('writing /tmp/pants.func_stats')
- with open('/tmp/pants.func_stats', 'wb') as fh:
- stats.print_all(out=fh)
- print('\n[YAPPI THREAD_STATS]')
- print('writing /tmp/pants.thread_stats')
- tstats = yappi.get_thread_stats()
- with open('/tmp/pants.thread_stats', 'wb') as fh:
- tstats.print_all(out=fh)
- print('[YAPPI OUT]')
- ...
- if __name__ == '__main__':
- init_yappi()
- main()
Advertisement
Add Comment
Please, Sign In to add comment