Commit fa264a4f authored by Zixian Cai's avatar Zixian Cai

Display difference between current revision and previous revision

parent 7d6fcf42
......@@ -71,9 +71,11 @@ def index():
result = storage.load_relative(repo, host, 0)
group_stats_result(result)
result1 = storage.load_relative(repo, host, 1)
group_stats_result(result1)
return render_template("index.html",
visualzing=result,
#changes=result_compare(result, result1)
changes=changes.compare(result, result1),
# timeline=None,
)
......
......@@ -14,5 +14,31 @@
# limitations under the License.
def compare(result, result1):
pass
def extract(tasksets):
result = {}
for ts in tasksets:
result[ts["name"]] = ts["datapoints_grouped"]
return result
def compare_ts(op1, op2):
result = {}
for impl in op1:
for metric in op1[impl]:
if impl in op2 and metric in op2[impl]:
if not impl in result:
result[impl] = {}
result[impl][metric] = op1[impl][metric].compare_obj(
op2[impl][metric])
return result
def compare(op1, op2):
extracted = extract(op1["ts"])
extracted1 = extract(op2["ts"])
result = {}
for ts_name in extracted:
if ts_name in extracted1:
result[ts_name] = compare_ts(extracted[ts_name],
extracted1[ts_name])
return result
\ No newline at end of file
<table class="table">
<tr>
<th>Benchmark</th>
<th>Impl</th>
<th>Metric</th>
<th>Value</th>
<th>Std dev</th>
<th>Change</th>
</tr>
{% for ts in changes %}
{% for impl in changes[ts] %}
{% for metric in changes[ts][impl] %}
{% set compare_obj = changes[ts][impl][metric] %}
<tr>
<td>{{ ts }}</td>
<td>{{ impl }}</td>
<td>{{ metric }}</td>
<td>{{ compare_obj.mean }}</td>
<td>{{ compare_obj.std }}</td>
<td {% if compare_obj.decreased %}
class="success"
{% elif compare_obj.increased %}
class="danger"
{% elif compare_obj.changed %}
class="warning"
{% endif %}>
{{ compare_obj.relative_diff_str }}</td>
</tr>
{% endfor %}
{% endfor %}
{% endfor %}
</table>
\ No newline at end of file
......@@ -16,6 +16,7 @@
import crayons
from mubench.stats import mean, median, std, significant_change, \
significant_decrease, significant_increase
from types import SimpleNamespace
class Trails:
......@@ -43,5 +44,18 @@ class Trails:
changed = significant_change(prev_mean, self.raw)
return decreased, changed, increased
def compare_obj(self, prev_res):
decreased, changed, increased = self.compare(prev_res)
return SimpleNamespace(
decreased=decreased,
changed=changed,
increased=increased,
relative_diff=self.mean / prev_res.mean,
relative_diff_str="{:+.2%}".format(self.mean / prev_res.mean - 1),
absolute_diff=self.mean - prev_res.mean,
mean=self.mean,
std=self.std
)
def __str__(self):
return self.description
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