aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrigid Smith2014-07-09 17:48:37 -0500
committerBrigid Smith2014-07-09 17:48:37 -0500
commit28417e6314768d057ab7ad7a0208f1af7597b4d6 (patch)
tree5a2eecba3d3d40a540a23c1b7b21c255af6a5a21 /benchmarks
parent430d5f93ceea2e5172144a05885c295dca51b876 (diff)
downloadplatform-bionic-28417e6314768d057ab7ad7a0208f1af7597b4d6.tar.gz
platform-bionic-28417e6314768d057ab7ad7a0208f1af7597b4d6.tar.xz
platform-bionic-28417e6314768d057ab7ad7a0208f1af7597b4d6.zip
Added a __system_property_serial benchmark.
Change-Id: Ifc2116f26acb242f4dcdb6eefe128899a9dc63bb
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/property_benchmark.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/benchmarks/property_benchmark.cpp b/benchmarks/property_benchmark.cpp
index 0b0c47f2..f330d7e9 100644
--- a/benchmarks/property_benchmark.cpp
+++ b/benchmarks/property_benchmark.cpp
@@ -183,3 +183,29 @@ static void BM_property_read(int iters, int nprops)
183 delete[] pinfo; 183 delete[] pinfo;
184} 184}
185BENCHMARK(BM_property_read)->TEST_NUM_PROPS; 185BENCHMARK(BM_property_read)->TEST_NUM_PROPS;
186
187static void BM_property_serial(int iters, int nprops)
188{
189 StopBenchmarkTiming();
190
191 LocalPropertyTestState pa(nprops);
192
193 if (!pa.valid)
194 return;
195
196 srandom(iters * nprops);
197 const prop_info** pinfo = new const prop_info*[iters];
198
199 for (int i = 0; i < iters; i++) {
200 pinfo[i] = __system_property_find(pa.names[random() % nprops]);
201 }
202
203 StartBenchmarkTiming();
204 for (int i = 0; i < iters; i++) {
205 __system_property_serial(pinfo[i]);
206 }
207 StopBenchmarkTiming();
208
209 delete[] pinfo;
210}
211BENCHMARK(BM_property_serial)->TEST_NUM_PROPS;