bionic: change properties benchmarks to read a single property
The properties benchmarks were reading n properties from a property area with n properties in it, which was making it hard to compare the time between runs of different sizes. Change the benchmark to read a random property per iteration so the numbers between runs are comparable. Change-Id: Ib1648ce0948d9038fce76d209608427376cfb8da
This commit is contained in:
parent
977a33137d
commit
7d90cfa6b5
|
@ -87,12 +87,12 @@ static void BM_property_get(int iters, int nprops)
|
||||||
LocalPropertyTestState pa(nprops);
|
LocalPropertyTestState pa(nprops);
|
||||||
char value[PROP_VALUE_MAX];
|
char value[PROP_VALUE_MAX];
|
||||||
|
|
||||||
|
srandom(iters * nprops);
|
||||||
|
|
||||||
StartBenchmarkTiming();
|
StartBenchmarkTiming();
|
||||||
|
|
||||||
for (int i = 0; i < iters; i++) {
|
for (int i = 0; i < iters; i++) {
|
||||||
for (int j = 0; j < nprops; j++) {
|
__system_property_get(pa.names[random() % nprops], value);
|
||||||
__system_property_get(pa.names[j], value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
StopBenchmarkTiming();
|
StopBenchmarkTiming();
|
||||||
}
|
}
|
||||||
|
@ -104,12 +104,12 @@ static void BM_property_find(int iters, int nprops)
|
||||||
|
|
||||||
LocalPropertyTestState pa(nprops);
|
LocalPropertyTestState pa(nprops);
|
||||||
|
|
||||||
|
srandom(iters * nprops);
|
||||||
|
|
||||||
StartBenchmarkTiming();
|
StartBenchmarkTiming();
|
||||||
|
|
||||||
for (int i = 0; i < iters; i++) {
|
for (int i = 0; i < iters; i++) {
|
||||||
for (int j = 0; j < nprops; j++) {
|
__system_property_find(pa.names[random() % nprops]);
|
||||||
__system_property_find(pa.names[j]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
StopBenchmarkTiming();
|
StopBenchmarkTiming();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue