From a304476145810d62f76b23a188b1680287716cfd Mon Sep 17 00:00:00 2001 From: Brigid Smith Date: Wed, 9 Jul 2014 10:26:17 -0700 Subject: Added __system_propery_read benchmark. Change-Id: Ic0e9118859a013aa04841de25822a81a7fc74b3c --- benchmarks/property_benchmark.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'benchmarks') diff --git a/benchmarks/property_benchmark.cpp b/benchmarks/property_benchmark.cpp index 6d17ec7..0b0c47f 100644 --- a/benchmarks/property_benchmark.cpp +++ b/benchmarks/property_benchmark.cpp @@ -156,3 +156,30 @@ static void BM_property_find(int iters, int nprops) StopBenchmarkTiming(); } BENCHMARK(BM_property_find)->TEST_NUM_PROPS; + +static void BM_property_read(int iters, int nprops) +{ + StopBenchmarkTiming(); + + LocalPropertyTestState pa(nprops); + + if (!pa.valid) + return; + + srandom(iters * nprops); + const prop_info** pinfo = new const prop_info*[iters]; + char propvalue[PROP_VALUE_MAX]; + + 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_read(pinfo[i], 0, propvalue); + } + StopBenchmarkTiming(); + + delete[] pinfo; +} +BENCHMARK(BM_property_read)->TEST_NUM_PROPS; -- cgit v1.1