in lnt/server/reporting/summaryreport.py [0:0]
def _build_data_table(self):
def get_nts_datapoints_for_sample(ts, sample):
# Get the basic sample info.
run_id = sample[0]
machine_id = run_machine_id_map[run_id]
run_parameters = run_parameters_map[run_id]
# Get the test.
test = ts_tests[sample[1]]
# The test name for a sample in the NTS suite is just the name of
# the sample test.
test_name = test.name
# The arch and build mode are derived from the run flags.
arch = run_parameters['cc_target'].split('-')[0]
if '86' in arch:
arch = 'x86'
if run_parameters['OPTFLAGS'] == '-O0':
build_mode = 'Debug'
else:
build_mode = 'Release'
# Return a datapoint for each passing field.
for field_name, field, status_field in ts_sample_metric_fields:
# Ignore failing samples.
if status_field and \
sample[2 + status_field.index] == lnt.testing.FAIL:
continue
# Ignore missing samples.
value = sample[2 + field.index]
if value is None:
continue
# Otherwise, return a datapoint.
if field_name == 'compile_time':
metric = 'Compile Time'
else:
assert field_name == 'execution_time'
metric = 'Execution Time'
yield ((test_name, metric, arch, build_mode, machine_id),
value)
def get_compile_datapoints_for_sample(ts, sample):
# Get the basic sample info.
run_id = sample[0]
machine_id = run_machine_id_map[run_id]
run_parameters = run_parameters_map[run_id]
# Get the test.
test = ts_tests[sample[1]]
# Extract the compile flags from the test name.
base_name,flags = test.name.split('(')
assert flags[-1] == ')'
other_flags = []
build_mode = None
for flag in flags[:-1].split(','):
# If this is an optimization flag, derive the build mode from
# it.
if flag.startswith('-O'):
if '-O0' in flag:
build_mode = 'Debug'
else:
build_mode = 'Release'
continue
# If this is a 'config' flag, derive the build mode from it.
if flag.startswith('config='):
if flag == "config='Debug'":
build_mode = 'Debug'
else:
assert flag == "config='Release'"
build_mode = 'Release'
continue
# Otherwise, treat the flag as part of the test name.
other_flags.append(flag)
# Form the test name prefix from the remaining flags.
test_name_prefix = '%s(%s)' % (base_name, ','.join(other_flags))
# Extract the arch from the run info (and normalize).
arch = run_parameters['cc_target'].split('-')[0]
if arch.startswith('arm'):
arch = 'ARM'
elif '86' in arch:
arch = 'x86'
# The metric is fixed.
metric = 'Compile Time'
# Report the user and wall time.
for field_name, field, status_field in ts_sample_metric_fields:
if field_name not in ('user_time', 'wall_time'):
continue
# Ignore failing samples.
if status_field and \
sample[2 + status_field.index] == lnt.testing.FAIL:
continue
# Ignore missing samples.
value = sample[2 + field.index]
if value is None:
continue
# Otherwise, return a datapoint.
yield (('%s.%s' % (test_name_prefix, field_name), metric, arch,
build_mode, machine_id), value)
def get_datapoints_for_sample(ts, sample):
# The exact datapoints in each sample depend on the testsuite
if ts.name == 'nts':
return get_nts_datapoints_for_sample(ts, sample)
else:
assert ts.name == 'compile'
return get_compile_datapoints_for_sample(ts, sample)
# For each column...
for index, runs in enumerate(self.runs_at_index):
# For each test suite and run list...
for ts, (ts_runs, _) in zip(self.testsuites, runs):
ts_tests = self.tests[ts]
# Compute the metric fields.
ts_sample_metric_fields = [
(f.name, f, f.status_field)
for f in ts.Sample.get_metric_fields()]
# Compute a mapping from run id to run.
run_id_map = dict((r.id, r)
for r in ts_runs)
# Compute a mapping from run id to machine id.
run_machine_id_map = dict((r.id, r.machine.name)
for r in ts_runs)
# Preload the run parameters.
run_parameters_map = dict((r.id, r.parameters)
for r in ts_runs)
# Load all the samples for all runs we are interested in.
columns = [ts.Sample.run_id, ts.Sample.test_id]
columns.extend(f.column for f in ts.sample_fields)
samples = ts.query(*columns).filter(
ts.Sample.run_id.in_(run_id_map.keys()))
for sample in samples:
run = run_id_map[sample[0]]
datapoints = list()
for key,value in get_datapoints_for_sample(ts, sample):
items = self.data_table.get(key)
if items is None:
items = [[]
for _ in self.report_orders]
self.data_table[key] = items
items[index].append(value)