|
@@ -278,6 +278,11 @@ def mean(values):
|
|
"""Computes the arithmetic mean of the given values."""
|
|
"""Computes the arithmetic mean of the given values."""
|
|
return float(sum(values)) / max(len(values), 1)
|
|
return float(sum(values)) / max(len(values), 1)
|
|
|
|
|
|
|
|
+def standard_deviation(values):
|
|
|
|
+ """Computes the standard deviation of the given values."""
|
|
|
|
+ avg = mean(values)
|
|
|
|
+ return (sum((val - avg) ** 2 for val in values) / (len(values) - 1)) ** 0.5
|
|
|
|
+
|
|
def parse_jit_timing_log(log_file):
|
|
def parse_jit_timing_log(log_file):
|
|
"""Parses the JIT timing log entries from the given file."""
|
|
"""Parses the JIT timing log entries from the given file."""
|
|
results = []
|
|
results = []
|
|
@@ -447,3 +452,16 @@ def parse_perf_data(file_name):
|
|
quantity: sorted(result_dict.items(), key=operator.itemgetter(0))
|
|
quantity: sorted(result_dict.items(), key=operator.itemgetter(0))
|
|
for quantity, result_dict in results.items()
|
|
for quantity, result_dict in results.items()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+def write_perf_data_to_stream(perf_data, output_stream):
|
|
|
|
+ """Writes the given performance data to the given file."""
|
|
|
|
+ for quantity, opt_level_dict in perf_data.items():
|
|
|
|
+ for opt_level, data_points in opt_level_dict:
|
|
|
|
+ for test_name, measurement in data_points:
|
|
|
|
+ write_perf_entry_to_stream(
|
|
|
|
+ test_name, opt_level, quantity, measurement, output_stream)
|
|
|
|
+
|
|
|
|
+def write_perf_data_to_file(perf_data, file_name):
|
|
|
|
+ """Writes the given performance data to the given file."""
|
|
|
|
+ with open(file_name, 'w') as perf_file:
|
|
|
|
+ write_perf_data_to_stream(perf_data, perf_file)
|