def build(self, runs): # remove the hierarchy from stat_name and just use the final piece self.stat = self.stat_name.split('.')[-1] self.stat_long = self.stat_name self.x_axis_title = 'benchmarks' # split stat_name at the first '.' (type, name) = self.stat_name.split('.', 1) # create a Series for each entry for entry in runs: # series data, elements aligned to self.benchmarks data = [] # append the stat value for each benchmark. 0 if not found for benchmark in self.benchmarks: # query the db row = db_utils.find_one('stats', fields={'name': entry, 'type': type, 'benchmark': benchmark}) # append 0 and continue if a row wasn't found if not row: data.append(0) continue # append the stat value data.append(db_utils.get_stat(row.stats, name)) # create a new Series for this runs entry and append to self.series self.series.append(Series(name=entry, data=data, labels=data))
def build(self, runs): # remove the hierarchy from stat_name and just use the final piece self.stat = self.stat_name.split('.')[-1] self.stat_long = self.stat_name self.x_axis_title = 'benchmarks' # split stat_name at the first '.' (type, name) = self.stat_name.split('.', 1) # create a Series for each entry for entry in runs: # series data, elements aligned to self.benchmarks data = [] # append the stat value for each benchmark. 0 if not found for benchmark in self.benchmarks: # query the db row = db_utils.find_one('stats', fields={ 'name': entry, 'type': type, 'benchmark': benchmark }) # append 0 and continue if a row wasn't found if not row: data.append(0) continue # append the stat value data.append(db_utils.get_stat(row.stats, name)) # create a new Series for this runs entry and append to self.series self.series.append(Series(name=entry, data=data, labels=data))
def select_procs(stat_name, proc_names): ''' turn a list of processor names into a list of names to access the stats_db with. if <stat_name> is a core stat, turn each processor name into '<proc_name> <core_name>' for each core in the processor. if <stat_name> is a process stat, turn each processor name into '<proc_name> process_0' ''' # find the type of stat stat_type = stat_name.split('.')[0] # list of names to access the stats db with db_names = [] if stat_type == 'processor': return proc_names elif stat_type == 'core': for p in proc_names: # find how many cores p has row = db_utils.find_one('knobs', fields={'type': 'processor', 'name': p}) if row is None: logging.error('problem finding {0} in the knobs db'.format(p)) continue for core_name in row.knobs['core_names']: # <processor_name> <core_name> db_names.append(p + ' ' + core_name) return db_names elif stat_type == 'process': # right now only 1 process per processor is supported for p in proc_names: # <processor_name> process_0 db_names.append(p + ' process_0') return db_names else: logging.error('unknown stat type: {0}'.format(stat_type)) return proc_names
def select_procs(stat_name, proc_names): ''' turn a list of processor names into a list of names to access the stats_db with. if <stat_name> is a core stat, turn each processor name into '<proc_name> <core_name>' for each core in the processor. if <stat_name> is a process stat, turn each processor name into '<proc_name> process_0' ''' # find the type of stat stat_type = stat_name.split('.')[0] # list of names to access the stats db with db_names = [] if stat_type == 'processor': return proc_names elif stat_type == 'core': for p in proc_names: # find how many cores p has row = db_utils.find_one('knobs', fields={ 'type': 'processor', 'name': p }) if row is None: logging.error('problem finding {0} in the knobs db'.format(p)) continue for core_name in row.knobs['core_names']: # <processor_name> <core_name> db_names.append(p + ' ' + core_name) return db_names elif stat_type == 'process': # right now only 1 process per processor is supported for p in proc_names: # <processor_name> process_0 db_names.append(p + ' process_0') return db_names else: logging.error('unknown stat type: {0}'.format(stat_type)) return proc_names