GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit a964ee85 authored by Zixian Cai's avatar Zixian Cai

Beautify LogPipeline output

parent 3848c9d1
......@@ -91,3 +91,16 @@ fib:
compiler:
flags:
- -O3
compare:
- - c_O0
- c_O3
- - c_O0
- rpyc_O3
- - c_O3
- rpyc_O3
- - c_O0
- rpyzebu
- - c_O3
- rpyzebu
- - rpyc_O3
- rpyzebu
......@@ -16,6 +16,8 @@
import logging
import crayons
logger = logging.getLogger(__name__)
......@@ -28,18 +30,47 @@ class LogOutputPipeline(Pipeline):
def process(self, report):
logger.info("Report for Revision: {}".format(report.revision))
for ts in report.tasksets:
logger.info("TaskSet {}:".format(ts.name))
description = [""]
for task_name, result in ts.results.items():
logger.info("\n".join([
"Task {}:".format(task_name),
"Measurement inside programs:",
"{}".format(result.callback),
"",
"Measurement including startup time:",
"{}".format(result.t_proc)
]))
description.append("\n{}\n{}".format(
result.callback,
result.t_proc))
description.append("")
for comp in ts.comparison:
r1 = ts.results[comp.op1]
r2 = ts.results[comp.op2]
description.append(self.compare(r1.callback, r2.callback))
description.append(self.compare(r1.t_proc, r2.t_proc))
logger.info("\n".join(description))
return report
@staticmethod
def compare(r1, r2):
decreased, changed, increased = r1.compare(r2)
if r1.mean < r2.mean:
ratio = "{0:.2f} times faster".format(r2.mean / r1.mean)
else:
ratio = "{0:.2f} times slower".format(r1.mean / r2.mean)
if decreased:
trend = "It's statistically significantly " + \
crayons.red("lower") + " using one-sided t-test"
elif increased:
trend = "it's statistically significantly " + \
crayons.red("higher") + " using one-sided t-test"
elif changed:
trend = "there's statistically significant " + \
"difference using two-sided t-test"
else:
trend = "there's no statistically significant difference"
template = "{} is {} than {}, using {} of time\n\t{}"
return template.format(crayons.blue(r1.name),
crayons.green(ratio),
crayons.blue(r2.name),
crayons.green(
"{:.4%}".format(r1.mean / r2.mean)),
trend)
class MatplotlibPipeline(Pipeline):
def process(self, report):
......
......@@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import crayons
from mubench.stats import mean, median, std, significant_change, \
significant_decrease, significant_increase
......@@ -29,35 +30,18 @@ class Result:
self.mean = mean(data_points)
self.median = median(data_points)
self.std = std(data_points)
self.description = [
"Mean: {0:.9f}".format(self.mean),
"Median: {0:.9f}".format(self.median),
"Std: {0:.9f}".format(self.std)
]
self.description = "{}: {:.9f} (±{:.9f})".format(
crayons.blue(self.name),
self.mean,
self.std
)
def compare(self, prev_res):
prev_mean = prev_res.mean
decreased = significant_decrease(prev_mean, self.raw)
increased = significant_increase(prev_mean, self.raw)
changed = significant_change(prev_mean, self.raw)
if self.mean < prev_mean:
ratio = "{0:.2f} times faster".format(prev_mean / self.mean)
else:
ratio = "{0:.2f} times slower".format(self.mean / prev_mean)
self.description.append(
"Compared with {}, {:.4%}, {}".format(
prev_res.name,
self.mean / prev_mean,
ratio
))
if decreased:
self.description.append("Significantly decreased")
if changed:
self.description.append("Significantly changed")
if increased:
self.description.append("Significantly increased")
if not any([decreased, changed, increased]):
self.description.append("Not enough evidence to determine change")
return decreased, changed, increased
def __str__(self):
return "\n".join(self.description)
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