From 28417e6314768d057ab7ad7a0208f1af7597b4d6 Mon Sep 17 00:00:00 2001 From: Brigid Smith Date: Wed, 9 Jul 2014 15:48:37 -0700 Subject: Added a __system_property_serial benchmark. Change-Id: Ifc2116f26acb242f4dcdb6eefe128899a9dc63bb --- benchmarks/property_benchmark.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'benchmarks') diff --git a/benchmarks/property_benchmark.cpp b/benchmarks/property_benchmark.cpp index 0b0c47f..f330d7e 100644 --- a/benchmarks/property_benchmark.cpp +++ b/benchmarks/property_benchmark.cpp @@ -183,3 +183,29 @@ static void BM_property_read(int iters, int nprops) delete[] pinfo; } BENCHMARK(BM_property_read)->TEST_NUM_PROPS; + +static void BM_property_serial(int iters, int nprops) +{ + StopBenchmarkTiming(); + + LocalPropertyTestState pa(nprops); + + if (!pa.valid) + return; + + srandom(iters * nprops); + const prop_info** pinfo = new const prop_info*[iters]; + + for (int i = 0; i < iters; i++) { + pinfo[i] = __system_property_find(pa.names[random() % nprops]); + } + + StartBenchmarkTiming(); + for (int i = 0; i < iters; i++) { + __system_property_serial(pinfo[i]); + } + StopBenchmarkTiming(); + + delete[] pinfo; +} +BENCHMARK(BM_property_serial)->TEST_NUM_PROPS; -- cgit v1.1