Commit 8d3ad52d authored by Ian Romanick's avatar Ian Romanick

report.py: Print small percentages as <.01%

Previously an absolute value less than 0.0001 would be printed as 0.00%.
Signed-off-by: default avatarIan Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
parent a697b845
......@@ -34,10 +34,18 @@ def get_results(filename):
return results
def format_percent(frac):
"""Converts a factional value (typically 0.0 to 1.0) to a string as a percentage"""
if abs(frac) > 0.0 and abs(frac) < 0.0001:
return "<.01%"
else:
return "{:.2f}%".format(frac * 100)
def get_delta(b, a):
if b != 0 and a != 0:
frac = float(a) / float(b) - 1.0
return ' ({:.2f}%)'.format(frac * 100.0)
return ' ({})'.format(format_percent(frac))
else:
return ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment