def dump_thread_stack():
 threads = threading.enumerate()
 output_file = (PROFILING_OUTPUT_FMT % get_filename_fmt())
 data = {}
 for (thread, frame) in sys._current_frames().items():
  trace = traceback.format_stack(frame)
  data[('%x' % thread)] = {'traceback': trace, 'name': get_thread_name(threads, thread)}
 json.dump(data, file(output_file, 'w'), indent=4)

def dump_thread_stack ( ) : threads = threading . enumerate ( ) output_file = ( PROFILING_OUTPUT_FMT % get_filename_fmt ( ) ) data = { } for ( thread , frame ) in sys . _current_frames ( ) . items ( ) : trace = traceback . format_stack ( frame ) data [ ( '%x' % thread ) ] = { 'traceback' : trace , 'name' : get_thread_name ( threads , thread ) } json . dump ( data , file ( output_file , 'w' ) , indent = 4 )
dumps all thread stacks to a file .