def loadInstrumentationData(self, traceName): """ Load previously computed instrumentation data for a trace file. @param traceName: Trace for which data should be loaded. """ if not traceName in self.analyzer.traces: self.analyzer.fail("Trace not found: %s" % traceName) if not traceName in self.analyzer.traceFiles: self.analyzer.fail("The trace file for trace %s is not known." % traceName) trace = self.analyzer.traces[traceName] traceFileName = self.analyzer.traceFiles[traceName] logFile = Instrumentation.instrumentationLogFileName(traceFileName) if not os.path.exists(logFile): self.analyzer.fail( "Instrumentation log file not found (try the 'play' command): %s" % logFile) Instrumentation.loadInstrumentationData(self.analyzer, trace, logFile) self.analyzer.reportInfo("Instrumentation data loaded for trace %s." % traceName)
def playTrace(self, traceName, eventRange=None, profile=False, saveFrames=False, checkCoherence=True, synchronize=False): """ Play back a trace file using a generated trace player. @param traceName: Trace to play. @param eventRange: Range of events to play, or all events by default. @param profile: Should instrumentation data be collected or not. @param saveFrames: Should frame buffer snapshots be saved or not. @param checkCoherence: Verify that the trace is properly normalized before playing. @param sychronize: Attempt to match the original trace timings. """ if not traceName in self.analyzer.traces: self.analyzer.fail("Trace not found: %s" % traceName) trace = self.analyzer.traces[traceName] traceFileName = self.analyzer.traceFiles.get(traceName, None) profile = self.analyzer.parseBoolean(profile) saveFrames = self.analyzer.parseBoolean(saveFrames) checkCoherence = self.analyzer.parseBoolean(checkCoherence) synchronize = self.analyzer.parseBoolean(synchronize) # Create a temporary trace that only contains the needed events if eventRange is not None: firstEvent, lastEvent = self.analyzer.parseEventRange( trace, eventRange) traceFileName = None trace = TraceOperations.extract(trace, firstEvent, lastEvent) # Create a player player = Player.createPlayer(self.analyzer) # Play it self.analyzer.reportInfo("Playing trace.") logFile = player.play(trace, traceFileName, profile=profile, saveFrames=saveFrames, checkCoherence=checkCoherence, synchronize=synchronize) # Load the instrumentation data if it exists if profile and logFile: Instrumentation.loadInstrumentationData(self.analyzer, trace, logFile) self.analyzer.reportInfo( "Instrumentation data loaded for trace %s." % traceName)
def loadInstrumentationData(self, traceName): """ Load previously computed instrumentation data for a trace file. @param traceName: Trace for which data should be loaded. """ if not traceName in self.analyzer.traces: self.analyzer.fail("Trace not found: %s" % traceName) if not traceName in self.analyzer.traceFiles: self.analyzer.fail("The trace file for trace %s is not known." % traceName) trace = self.analyzer.traces[traceName] traceFileName = self.analyzer.traceFiles[traceName] logFile = Instrumentation.instrumentationLogFileName(traceFileName) if not os.path.exists(logFile): self.analyzer.fail("Instrumentation log file not found (try the 'play' command): %s" % logFile) Instrumentation.loadInstrumentationData(self.analyzer, trace, logFile) self.analyzer.reportInfo("Instrumentation data loaded for trace %s." % traceName)
def playTrace(self, traceName, eventRange = None, profile = False, saveFrames = False, checkCoherence = True, synchronize = False): """ Play back a trace file using a generated trace player. @param traceName: Trace to play. @param eventRange: Range of events to play, or all events by default. @param profile: Should instrumentation data be collected or not. @param saveFrames: Should frame buffer snapshots be saved or not. @param checkCoherence: Verify that the trace is properly normalized before playing. @param sychronize: Attempt to match the original trace timings. """ if not traceName in self.analyzer.traces: self.analyzer.fail("Trace not found: %s" % traceName) trace = self.analyzer.traces[traceName] traceFileName = self.analyzer.traceFiles.get(traceName, None) profile = self.analyzer.parseBoolean(profile) saveFrames = self.analyzer.parseBoolean(saveFrames) checkCoherence = self.analyzer.parseBoolean(checkCoherence) synchronize = self.analyzer.parseBoolean(synchronize) # Create a temporary trace that only contains the needed events if eventRange is not None: firstEvent, lastEvent = self.analyzer.parseEventRange(trace, eventRange) traceFileName = None trace = TraceOperations.extract(trace, firstEvent, lastEvent) # Create a player player = Player.createPlayer(self.analyzer) # Play it self.analyzer.reportInfo("Playing trace.") logFile = player.play(trace, traceFileName, profile = profile, saveFrames = saveFrames, checkCoherence = checkCoherence, synchronize = synchronize) # Load the instrumentation data if it exists if profile and logFile: Instrumentation.loadInstrumentationData(self.analyzer, trace, logFile) self.analyzer.reportInfo("Instrumentation data loaded for trace %s." % traceName)