def scanTransactions(self): if self._trans is not None: # Already scanned return trans = self._trans = [] transactions = os.listdir(STAT_DIR) for txn in transactions: transdir = os.path.join(STAT_DIR, txn) stats = [] trans.append(stats) # Sigh sort the list methods = os.listdir(transdir) offsets = [(int(methods[x].split(".")[1]), methods[x], x) for x in range(len(methods)) ] offsets.sort() methods = [ method for pos, method, dontcare in offsets] for fname in methods: name = fname.split(".")[0] stats.append( (name, hotshot.stats.load(os.path.join(transdir, fname)) ))
def _file_position_changed ( self, file_position ): """ Handles the 'file_position' trait being changed. """ if file_position is not None: do_later( self.set, file_position = None ) # Try to create a new ProfilerStats viewer: try: p_stats = ProfilerStats( owner = self, name = file_position.name, file_name = file_position.file_name ) except: return stats = self.stats # Make sure the # of stats doesn't exceed the maximum allowed: if len( stats ) >= self.max_stats: del stats[0] # Add the new stats to the list of stats (which will cause it to # appear as a new notebook page): stats.append( p_stats )
def _file_position_changed(self, file_position): """ Handles the 'file_position' trait being changed. """ if file_position is not None: do_later(self.set, file_position=None) # Try to create a new ProfilerStats viewer: try: p_stats = ProfilerStats(owner=self, name=file_position.name, file_name=file_position.file_name) except: return stats = self.stats # Make sure the # of stats doesn't exceed the maximum allowed: if len(stats) >= self.max_stats: del stats[0] # Add the new stats to the list of stats (which will cause it to # appear as a new notebook page): stats.append(p_stats)