summaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorBrigid Smith <brigidsmith@google.com>2014-07-09 10:26:17 -0700
committerBrigid Smith <brigidsmith@google.com>2014-07-09 10:26:17 -0700
commita304476145810d62f76b23a188b1680287716cfd (patch)
tree69903a4ec19e7989908f008649d36a35c3f1536e /benchmarks
parent3139f6fdd7f9bec3b53be3da62314ae8ba24ceb4 (diff)
downloadbionic-a304476145810d62f76b23a188b1680287716cfd.zip
bionic-a304476145810d62f76b23a188b1680287716cfd.tar.gz
bionic-a304476145810d62f76b23a188b1680287716cfd.tar.bz2
Added __system_propery_read benchmark.
Change-Id: Ic0e9118859a013aa04841de25822a81a7fc74b3c
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/property_benchmark.cpp27
1 files changed, 27 insertions, 0 deletions
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;