Add benchmark for System.getProperty() vs. AccessController/GetPropertyAction.

Comparing the performance of these options is interesting because
libcore carries patches to short-circuit such logic in a few places.

This CL came out of a verbal discussion of http://r.android.com/710427

Benchmark results on a 5.5" Google Pixel device from 2016:
Using the legacy security code costs approx. 500 nanoseconds
per invocation (1136 vs. 1061 ns) when not specifying a default value,
or, or 320 nanoseconds (1041 vs. 710 ns) when specifying a default
value (1061 vs. 740 ns).

Both properties that are accessed (user.language and user.region)
have nonempty values on the device that was tested.

I ran the benchmark a couple of times; here's the output from one run:

Trial Report (1 of 4):
  Experiment {instrument=runtime, benchmarkMethod=timeAccessController_getPropertyAction, vm=default, parameters={}}
  Results:
    runtime(ns): min=1136.75, 1st qu.=1136.75, median=1136.75, mean=1136.75, 3rd qu.=1136.75, max=1136.75
Trial Report (2 of 4):
  Experiment {instrument=runtime, benchmarkMethod=timeAccessController_getPropertyAction_default, vm=default, parameters={}}
  Results:
    runtime(ns): min=1061.38, 1st qu.=1061.38, median=1061.38, mean=1061.38, 3rd qu.=1061.38, max=1061.38
Trial Report (3 of 4):
  Experiment {instrument=runtime, benchmarkMethod=timeSystem_getProperty, vm=default, parameters={}}
  Results:
    runtime(ns): min=634.09, 1st qu.=634.09, median=634.09, mean=634.09, 3rd qu.=634.09, max=634.09
Trial Report (4 of 4):
  Experiment {instrument=runtime, benchmarkMethod=timeSystem_getProperty_default, vm=default, parameters={}}
  Results:
    runtime(ns): min=740.08, 1st qu.=740.08, median=740.08, mean=740.08, 3rd qu.=740.08, max=740.08

Test: vogar --benchmark --verbose benchmarks/GetSystemPropertyBenchmark.java

Change-Id: I77461a5007351b144b2dc09ac7c194240332636d
1 file changed