Index: lnt/server/ui/filters.py
===================================================================
--- lnt/server/ui/filters.py
+++ lnt/server/ui/filters.py
@@ -54,6 +54,22 @@
return util.guess_test_short_name(test_name)
+def filter_value_with_unit(value, unit_abbrev):
+ for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']:
+ if abs(value) < 1024.0:
+ return "%3.2f %s%s" % (value, unit, unit_abbrev)
+ value /= 1024.0
+ return "%.2f%s%s" % (value, 'Yi', unit_abbrev)
+
+def filter_print_value(value, field_unit_abbrev, default = '-'):
+ if value == None:
+ return default
+
+ if field_unit_abbrev:
+ return filter_value_with_unit(value, field_unit_abbrev)
+ else:
+ return '%.3f' % value
+
def register(env):
for name, object in globals().items():
if name.startswith('filter_'):
Index: lnt/server/ui/templates/reporting/daily_report.html
===================================================================
--- lnt/server/ui/templates/reporting/daily_report.html
+++ lnt/server/ui/templates/reporting/daily_report.html
@@ -160,7 +160,7 @@
{{ reportutils.get_cell_value(day_result, analysis, styles) }}
{%- else -%}
{%- set first_result_shown = true -%}
- {{ reportutils.get_initial_cell_value(day_result, analysis, styles) }}
+{{ reportutils.get_initial_cell_value(day_result, field, analysis, styles) }}
{%- endif -%}
{%- endif -%}
{%- endfor %}
Index: lnt/server/ui/templates/reporting/latest_runs_report.html
===================================================================
--- lnt/server/ui/templates/reporting/latest_runs_report.html
+++ lnt/server/ui/templates/reporting/latest_runs_report.html
@@ -44,7 +44,7 @@
{{test.name}} |
- {{ reportutils.get_initial_cell_value(test_results[-1], analysis, styles) }}
+ {{ reportutils.get_initial_cell_value(test_results[-1], field, analysis, styles) }}
{% for result in test_results[:-1]|reverse %}
{{ reportutils.get_cell_value(result, analysis, styles) }}
{% endfor %}
Index: lnt/server/ui/templates/reporting/runs.html
===================================================================
--- lnt/server/ui/templates/reporting/runs.html
+++ lnt/server/ui/templates/reporting/runs.html
@@ -5,7 +5,7 @@
#}
{%
macro add_report_changes_detail_for_field_and_bucket(
- compare_to, field, show_perf, run_url, field_index, field_display_name, bucket_name, bucket, test_names,
+ compare_to, field, show_perf, run_url, field_index, field_display_name, field_unit_abbrev, bucket_name, bucket, test_names,
metric_name, metric_field_suffix, secondary_field_suffix, secondary_info, styles, classes
)
%}
@@ -55,13 +55,13 @@
{{ utils.render_profile_link(cr.cur_profile, cr.prev_profile, run.id, compare_to_id, test_id) }}
{{ cr.pct_delta|aspctcell(style=styles['td'] + 'text-align: right;',reverse=cr.bigger_is_better)|safe }}
- {{ "%.4f" | format(cr.previous) }} |
- {{ "%.4f" | format(cr.current) }} |
- {{ "%.4f" | format_or_default(cr.stddev, '-') }} |
+ {{ cr.previous | print_value(field_unit_abbrev) }} |
+ {{ cr.current | print_value(field_unit_abbrev) }} |
+ {{ cr.stddev | print_value(field_unit_abbrev) }} |
{% if secondary_info %}
{% set a_cr = secondary_info[(name, field)] %}
{{ a_cr.pct_delta|aspctcell(style=styles['td'] + 'text-align: right;',reverse=cr.bigger_is_better)|safe }}
- {{ "%.4f" | format_or_default(a_cr.stddev, '-') }} |
+ {{ a_cr.stddev | print_value(field_unit_abbrev) }} |
{% endif %}
{% endfor %}
@@ -168,7 +168,7 @@
{% for _, field, bucket_name, sorted_bucket, test_names, show_perf in prioritized_buckets_run_over_run %}
{% set field_index = ts.get_field_index(field) %}
{{
- add_report_changes_detail_for_field_and_bucket(compare_to, field, show_perf, run_url, field_index, field.display_name,
+ add_report_changes_detail_for_field_and_bucket(compare_to, field, show_perf, run_url, field_index, field.display_name, field.unit_abbrev,
bucket_name, sorted_bucket, test_names,
'Previous', '', ' (B)', run_to_baseline_info, styles, classes)
}}
@@ -185,7 +185,7 @@
{% for _, field, bucket_name, sorted_bucket, test_names, show_perf in prioritized_buckets_run_over_baseline %}
{% set field_index = ts.get_field_index(field) %}
{{
- add_report_changes_detail_for_field_and_bucket(baseline, field, show_perf, run_url, field_index, field.display_name,
+ add_report_changes_detail_for_field_and_bucket(baseline, field, show_perf, run_url, field_index, field.display_name, field.unit_abbrev,
bucket_name, sorted_bucket, test_names,
'Baseline', '(B)', '', run_to_run_info, styles, classes)
}}
Index: lnt/server/ui/templates/reportutils.html
===================================================================
--- lnt/server/ui/templates/reportutils.html
+++ lnt/server/ui/templates/reportutils.html
@@ -1,12 +1,13 @@
-{% macro get_initial_cell_value(result, analysis, styles) %}
+{% macro get_initial_cell_value(result, field, analysis, styles) %}
{%- set cr = result.cr -%}
{%- set test_status = cr.get_test_status() -%}
{%- if (test_status == analysis.REGRESSED or
test_status == analysis.UNCHANGED_FAIL) %}
- FAIL |
+ FAIL |
{%- else %}
{#- -#}
- {{ ("%.4f" % cr.current) if cr.current != none else "N/A" }} |
+ {{ cr.current|print_value(field.unit_abbrev) }}
+
{%- endif -%}
{% endmacro %}
Index: lnt/server/ui/templates/v4_run.html
===================================================================
--- lnt/server/ui/templates/v4_run.html
+++ lnt/server/ui/templates/v4_run.html
@@ -36,10 +36,10 @@
{% block title %}Run Results{% endblock %}
-{% macro get_cell_value(cr) %}
+{% macro get_cell_value(cr, field) %}
{% set test_status = cr.get_test_status() %}
{% set value_status = cr.get_value_status(ignore_small=not options.show_small_diff) %}
- {% set run_cell_value = "-" if cr.current is none else "%.4f" % cr.current %}
+ {% set run_cell_value = cr.current|print_value(field.unit_abbrev) %}
{% set run_cell_value = "-" if test_status in [analysis.REGRESSED, analysis.UNCHANGED_FAIL] else run_cell_value %}
{% if options.show_previous %}
@@ -352,7 +352,7 @@
{{ utils.render_profile_link(cr.cur_profile, cr.prev_profile, run.id, compare_to.id, test_id) }}
- {{ get_cell_value(cr) }}
+ {{ get_cell_value(cr, field) }}
{% endfor %}
@@ -362,7 +362,7 @@
run, compare_to, field, tests) %}
|
Geometric Mean |
- {{ get_cell_value(cr) }}
+ {{ get_cell_value(cr, field) }}
Index: tests/server/ui/V4Pages.py
===================================================================
--- tests/server/ui/V4Pages.py
+++ tests/server/ui/V4Pages.py
@@ -446,7 +446,7 @@
client, '/v4/nts/daily_report/2012/5/04', "Execution Time")
check_table_content(result_table_20120504,
[["test1", ""],
- ["", "machine2", "1.0000", "-", "900.00%", ""],
+ ["", "machine2", "1.00 s", "-", "900.00%", ""],
["test2", ""],
["", "machine2", "FAIL", "-", "PASS", ""]])
check_table_links(result_table_20120504,
@@ -465,13 +465,13 @@
client, '/v4/nts/daily_report/2012/5/13?num_days=3', "Execution Time")
check_table_content(result_table_20120513,
[["test6", ""],
- ["", "machine2", "1.0000", "FAIL", "PASS", ""],
+ ["", "machine2", "1.00 s", "FAIL", "PASS", ""],
["test_hash1", ""],
- ["", "machine2", "1.0000", '-', '20.00%', ""],
+ ["", "machine2", "1.00 s", '-', '20.00%', ""],
["test_hash2", ""],
- ["", "machine2", "1.0000", '-', '20.00%', ""],
+ ["", "machine2", "1.00 s", '-', '20.00%', ""],
["test_mhash_on_run", ""],
- ["", "machine2", "1.0000", '-', '20.00%', ""], ])
+ ["", "machine2", "1.00 s", '-', '20.00%', ""], ])
check_table_links(result_table_20120513,
[[],
['/db_default/v4/nts/graph?plot.0=2.6.3&highlight_run=9'],