diff options
-rw-r--r-- | tools/skpbench/_benchresult.py | 18 | ||||
-rwxr-xr-x | tools/skpbench/parseskpbench.py | 2 | ||||
-rw-r--r-- | tools/skpbench/skpbench.cpp | 11 | ||||
-rwxr-xr-x | tools/skpbench/skpbench.py | 2 |
4 files changed, 16 insertions, 17 deletions
diff --git a/tools/skpbench/_benchresult.py b/tools/skpbench/_benchresult.py index 32d760c57a..94c110569c 100644 --- a/tools/skpbench/_benchresult.py +++ b/tools/skpbench/_benchresult.py @@ -11,22 +11,22 @@ import sys class BenchResult: FLOAT_REGEX = '[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?' - PATTERN = re.compile('^(?P<median_pad> *)' - '(?P<median>' + FLOAT_REGEX + ')' - '(?P<accum_pad> +)' + PATTERN = re.compile('^(?P<accum_pad> *)' '(?P<accum>' + FLOAT_REGEX + ')' + '(?P<median_pad> +)' + '(?P<median>' + FLOAT_REGEX + ')' '(?P<max_pad> +)' '(?P<max>' + FLOAT_REGEX + ')' '(?P<min_pad> +)' '(?P<min>' + FLOAT_REGEX + ')' '(?P<stddev_pad> +)' '(?P<stddev>' + FLOAT_REGEX + '%)' - '(?P<metric_pad> +)' - '(?P<metric>ms|fps)' '(?P<samples_pad> +)' '(?P<samples>\d+)' '(?P<sample_ms_pad> +)' '(?P<sample_ms>\d+)' + '(?P<metric_pad> +)' + '(?P<metric>ms|fps)' '(?P<config_pad> +)' '(?P<config>[^\s]+)' '(?P<bench_pad> +)' @@ -38,14 +38,14 @@ class BenchResult: return cls(match) if match else None def __init__(self, match): - self.median = float(match.group('median')) self.accum = float(match.group('accum')) + self.median = float(match.group('median')) self.max = float(match.group('max')) self.min = float(match.group('min')) self.stddev = float(match.group('stddev')[:-1]) # Drop '%' sign. - self.metric = match.group('metric') self.samples = int(match.group('samples')) self.sample_ms = int(match.group('sample_ms')) + self.metric = match.group('metric') self.config = match.group('config') self.bench = match.group('bench') self._match = match @@ -58,8 +58,8 @@ class BenchResult: print(self._match.group(0), file=outfile) else: values = list() - for name in ['median', 'accum', 'max', 'min', 'stddev', - 'metric', 'samples', 'sample_ms', 'config']: + for name in ['accum', 'median', 'max', 'min', 'stddev', + 'samples', 'sample_ms', 'metric', 'config']: values.append(self.get_string(name + '_pad')) values.append(self.get_string(name)) values.append(config_suffix) diff --git a/tools/skpbench/parseskpbench.py b/tools/skpbench/parseskpbench.py index 2368fb111b..5fe146ee09 100755 --- a/tools/skpbench/parseskpbench.py +++ b/tools/skpbench/parseskpbench.py @@ -34,7 +34,7 @@ This script can also be used to generate a Google sheet: """) __argparse.add_argument('-r', '--result', - choices=['median', 'accum', 'max', 'min'], default='median', + choices=['accum', 'median', 'max', 'min'], default='accum', help="result to use for cell values") __argparse.add_argument('-f', '--force', action='store_true', help='silently ignore warnings') diff --git a/tools/skpbench/skpbench.cpp b/tools/skpbench/skpbench.cpp index d3b6edd8e2..734a1b79b2 100644 --- a/tools/skpbench/skpbench.cpp +++ b/tools/skpbench/skpbench.cpp @@ -42,10 +42,10 @@ DEFINE_int32(verbosity, 4, "level of verbosity (0=none to 5=debug)"); DEFINE_bool(suppressHeader, false, "don't print a header row before the results"); static const char* header = - " median accum max min stddev metric samples sample_ms config bench"; + " accum median max min stddev samples sample_ms metric config bench"; static const char* resultFormat = - "%8.4g %8.4g %8.4g %8.4g %6.3g%% %-6s %7li %9i %-9s %s"; + "%8.4g %8.4g %8.4g %8.4g %6.3g%% %7li %9i %-6s %-9s %s"; struct Sample { using clock = std::chrono::high_resolution_clock; @@ -133,9 +133,8 @@ void print_result(const std::vector<Sample>& samples, const char* config, const values.push_back(sample.value()); } std::sort(values.begin(), values.end()); - const double medianValue = values[values.size() / 2]; - const double accumValue = accum.value(); + const double accumValue = accum.value(); double variance = 0; for (double value : values) { const double delta = value - accumValue; @@ -145,8 +144,8 @@ void print_result(const std::vector<Sample>& samples, const char* config, const // Technically, this is the relative standard deviation. const double stddev = 100/*%*/ * sqrt(variance) / accumValue; - printf(resultFormat, medianValue, accumValue, values.back(), values.front(), stddev, - Sample::metric(), values.size(), FLAGS_sampleMs, config, bench); + printf(resultFormat, accumValue, values[values.size() / 2], values.back(), values.front(), + stddev, values.size(), FLAGS_sampleMs, Sample::metric(), config, bench); printf("\n"); fflush(stdout); } diff --git a/tools/skpbench/skpbench.py b/tools/skpbench/skpbench.py index b611193876..83aaf84000 100755 --- a/tools/skpbench/skpbench.py +++ b/tools/skpbench/skpbench.py @@ -213,7 +213,7 @@ def run_benchmarks(configs, skps, hardware): except StddevException: retry_max_stddev = skpbench.max_stddev * math.sqrt(2) - if FLAGS.verbosity >= 2: + if FLAGS.verbosity >= 1: print("stddev is too high for %s/%s (%s%%, max=%.2f%%), " "re-queuing with max=%.2f%%." % (skpbench.best_result.config, skpbench.best_result.bench, |