#NEWLINE# def _makeTracePlayable( self , trace , traceFileName , checkCoherence = True ) : #NEWLINE# #INDENT# 'Makes sure that the given trace is playable.\n       @returns a tuple (trace_file_name, is_temporary), where the is_temporary \n                flag indicates that the trace file is temporary and should be \n                deleted after playing.\n    ' #NEWLINE# try : #NEWLINE# #INDENT# exporter = [ e for e in self . analyzer . exportPlugins if ( e . formatName == 'binary' ) ] [ 0 ] #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# self . analyzer . fail ( 'No binary format exporter found.' ) #NEWLINE# #UNINDENT# if ( traceFileName and checkCoherence ) : #NEWLINE# #INDENT# reader = BinaryCodec . Reader ( trace , open ( traceFileName , 'rb' ) ) #NEWLINE# if ( not reader . isTracePlayable ( ) ) : #NEWLINE# #INDENT# self . analyzer . reportWarning ( 'The trace file will be normalized before playing. Save and reload the trace to avoid this step.' ) #NEWLINE# traceFileName = None #NEWLINE# #UNINDENT# #UNINDENT# if ( not traceFileName ) : #NEWLINE# #INDENT# ( fd , traceFileName ) = tempfile . mkstemp ( suffix = '_trace.bin' ) #NEWLINE# os . close ( fd ) #NEWLINE# traceFile = open ( traceFileName , 'wb' ) #NEWLINE# exporter . saveTrace ( trace , traceFile ) #NEWLINE# traceFile . close ( ) #NEWLINE# removeTraceFile = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# removeTraceFile = False #NEWLINE# #UNINDENT# return ( traceFileName , removeTraceFile )