From 5fcf85df0ec44609ec72f22eab7adaa06ecac672 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 17 Sep 2019 16:49:04 +0200 Subject: analyze-archive: Add HTML export --- bin/analyze-archive.py | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index 031bef5..e04f3fe 100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -21,14 +21,15 @@ Options: parameters. Also plots the corresponding measurements. If gplearn function is set, it is plotted using dashed lines. ---show-models= +--show-models= static: show static model values as well as parameter detection heuristic paramdetection: show stddev of static/lut/fitted model param: show parameterized model functions and regression variable values all: all of the above tex: print tex/pgfplots-compatible model data on stdout + html: print model and quality data as HTML table on stdout ---show-quality= +--show-quality= table: show static/fitted/lut SMAPE and MAE for each name and attribute summary: show static/fitted/lut SMAPE and MAE for each attribute, averaged over all states/transitions all: all of the above @@ -159,6 +160,39 @@ def print_text_model_data(model, pm, pq, lm, lq, am, ai, aq): for arg_index in range(model._num_args[state_or_tran]): print('{} {} {:d} {:.8f}'.format(state_or_tran, attribute, arg_index, model.stats.arg_dependence_ratio(state_or_tran, attribute, arg_index))) +def print_html_model_data(model, pm, pq, lm, lq, am, ai, aq): + state_attributes = model.attributes(model.states()[0]) + + print('') + for state in model.states(): + print('', end='') + print(''.format(state), end='') + for attribute in state_attributes: + unit = '' + if attribute == 'power': + unit = 'µW' + print(''.format(pm(state, attribute), unit, pq['by_name'][state][attribute]['smape']), end='') + print('') + print('
state' + ''.join(state_attributes) + '
{}{:.0f} {} ({:.1f}%)
') + + trans_attributes = model.attributes(model.transitions()[0]) + if 'rel_energy_prev' in trans_attributes: + trans_attributes.remove('rel_energy_next') + + print('') + for trans in model.transitions(): + print('', end='') + print(''.format(trans), end='') + for attribute in trans_attributes: + unit = '' + if attribute == 'duration': + unit = 'µs' + elif attribute in ['energy', 'rel_energy_prev']: + unit = 'pJ' + print(''.format(pm(trans, attribute), unit, pq['by_name'][trans][attribute]['smape']), end='') + print('') + print('
transition' + ''.join(trans_attributes) + '
{}{:.0f} {} ({:.1f}%)
') + if __name__ == '__main__': ignored_trace_indexes = [] @@ -332,6 +366,9 @@ if __name__ == '__main__': if 'tex' in show_models or 'tex' in show_quality: print_text_model_data(model, static_model, static_quality, lut_model, lut_quality, param_model, param_info, analytic_quality) + if 'html' in show_models or 'html' in show_quality: + print_html_model_data(model, static_model, static_quality, lut_model, lut_quality, param_model, param_info, analytic_quality) + if 'table' in show_quality or 'all' in show_quality: model_quality_table([static_quality, analytic_quality, lut_quality], [None, param_info, None]) if 'summary' in show_quality or 'all' in show_quality: -- cgit v1.2.3