OSDN Git Service

Refactor the benchmark code.
authorChristopher Ferris <cferris@google.com>
Wed, 18 Feb 2015 03:58:53 +0000 (19:58 -0800)
committerChristopher Ferris <cferris@google.com>
Thu, 19 Feb 2015 22:58:24 +0000 (14:58 -0800)
commitdf4942c04a63ae6e4f5c78ece9f696d6b8b74d32
treef4e1061bcaf821753263413f1e89fb82f5d50e99
parent3e1b5f46c07aef5983ecf2feb1c3369b2cd200c0
Refactor the benchmark code.

Changes:
- Modify the benchmarks to derive from a single Benchmark object.
- Rewrite the main iteration code. This includes changing the iteration
  code to use the actual total time calculated by the benchmark as a basis
  for determining whether there are enough iterations instead of using
  the time it takes to run the benchmark.
- Allow benchmarks to take no argument, int, or double.
- Fix the PrettyInt printer for negative integers.
- Modify the max column width name to include the whole name including
  the arg part.
- Reformat property_benchmark.cpp in line with the rest of the code.
- Modify a few of the math benchmarks to take an argument instead of
  separate benchmarks for the same function with different args.
- Create a vector of regex_t structs to represent the args all at
  once instead of when running each benchmark.

This change is in preparation for adding new math based benchmarks.

Tested by running on a nexus flo running at max using the new code
and the old code and comparing. All of the numbers are similar, but
some of the iterations are different due to the slightly different
algorithm used.

Change-Id: I57ad1f3ff083282b9ffeb72e687cab369ce3523a
16 files changed:
benchmarks/Android.mk
benchmarks/Benchmark.cpp [new file with mode: 0644]
benchmarks/benchmark/Benchmark.h [new file with mode: 0644]
benchmarks/benchmark_main.cpp [deleted file]
benchmarks/include/benchmark.h [deleted file]
benchmarks/main.cpp [new file with mode: 0644]
benchmarks/math_benchmark.cpp
benchmarks/property_benchmark.cpp
benchmarks/pthread_benchmark.cpp
benchmarks/semaphore_benchmark.cpp
benchmarks/stdio_benchmark.cpp
benchmarks/string_benchmark.cpp
benchmarks/time_benchmark.cpp
benchmarks/unistd_benchmark.cpp
benchmarks/utils.cpp [new file with mode: 0644]
benchmarks/utils.h [new file with mode: 0644]