1*8542734aSAndroid Build Coastguard Worker# NetD benchmarks 2*8542734aSAndroid Build Coastguard Worker 3*8542734aSAndroid Build Coastguard WorkerThese are benchmarks for libc **connect** and **gethostbyname** functions as hooked by netd. 4*8542734aSAndroid Build Coastguard Worker 5*8542734aSAndroid Build Coastguard Worker## Infrastructure 6*8542734aSAndroid Build Coastguard Worker 7*8542734aSAndroid Build Coastguard WorkerThe benchmarks are powered by [google-benchmark](https://github.com/google/benchmark), which records 8*8542734aSAndroid Build Coastguard Workerfour statistics: 9*8542734aSAndroid Build Coastguard Worker 10*8542734aSAndroid Build Coastguard Worker<table> 11*8542734aSAndroid Build Coastguard Worker <tr> 12*8542734aSAndroid Build Coastguard Worker <th>Statistic</th> 13*8542734aSAndroid Build Coastguard Worker <th>Meaning</th> 14*8542734aSAndroid Build Coastguard Worker </tr> 15*8542734aSAndroid Build Coastguard Worker <tr> 16*8542734aSAndroid Build Coastguard Worker <th>real_time</th> 17*8542734aSAndroid Build Coastguard Worker <td>Mean wall-clock time taken for each iteration of the function under test to complete. This 18*8542734aSAndroid Build Coastguard Worker includes any time spent in other processes. 19*8542734aSAndroid Build Coastguard Worker <p> 20*8542734aSAndroid Build Coastguard Worker Some of the **connect** benchmarks override this by implementing their own timings, but 21*8542734aSAndroid Build Coastguard Worker the semantics are roughly the same. See connect_benchmark.cpp for details.</td> 22*8542734aSAndroid Build Coastguard Worker </tr> 23*8542734aSAndroid Build Coastguard Worker <tr> 24*8542734aSAndroid Build Coastguard Worker <th>cpu_time</th> 25*8542734aSAndroid Build Coastguard Worker <td>Mean time spent in the current thread during each iteration of the function under test. This 26*8542734aSAndroid Build Coastguard Worker does not include any time spent in other processes or blocking on I/O. 27*8542734aSAndroid Build Coastguard Worker <p> 28*8542734aSAndroid Build Coastguard Worker Since almost all of the functionality we are testing here is in the netd server, not the 29*8542734aSAndroid Build Coastguard Worker client, these timings are not relevant and should be ignored for most purposes.</td> 30*8542734aSAndroid Build Coastguard Worker </tr> 31*8542734aSAndroid Build Coastguard Worker <tr> 32*8542734aSAndroid Build Coastguard Worker <th>iterations</th> 33*8542734aSAndroid Build Coastguard Worker <td>The number of runs of the test function that were executed, across all threads, in order for 34*8542734aSAndroid Build Coastguard Worker the test to reach the minimum amount of time run. Most tests here define 'minimum time run' 35*8542734aSAndroid Build Coastguard Worker in terms of real time or 'manual time', rather than CPU time, for the reasons above. 36*8542734aSAndroid Build Coastguard Worker <p> 37*8542734aSAndroid Build Coastguard Worker This should be roughly inversely proportional to **real_time** for single-threaded 38*8542734aSAndroid Build Coastguard Worker benchmarks and also somewhat proportional to the number of threads used.</td> 39*8542734aSAndroid Build Coastguard Worker </tr> 40*8542734aSAndroid Build Coastguard Worker <tr> 41*8542734aSAndroid Build Coastguard Worker <th>label</th> 42*8542734aSAndroid Build Coastguard Worker <td>Field that the benchmark can fill with an arbitrary string. 43*8542734aSAndroid Build Coastguard Worker <p> 44*8542734aSAndroid Build Coastguard Worker For graphing purposes, a few of the benchmarks in this directory store the 90th-percentile 45*8542734aSAndroid Build Coastguard Worker latency in this field for comparison against the mean latency 46*8542734aSAndroid Build Coastguard Worker (it's only possible to plot one other value apart from mean). 47*8542734aSAndroid Build Coastguard Worker <p> 48*8542734aSAndroid Build Coastguard Worker If the graphing ecosystem ever becomes advanced enough to plot multiple outputs from one 49*8542734aSAndroid Build Coastguard Worker label, it might be more useful to log every decile to get a better picture of how spiky 50*8542734aSAndroid Build Coastguard Worker things are.</td> 51*8542734aSAndroid Build Coastguard Worker</table> 52*8542734aSAndroid Build Coastguard Worker 53*8542734aSAndroid Build Coastguard Worker# Methods currently being benchmarked 54*8542734aSAndroid Build Coastguard Worker 55*8542734aSAndroid Build Coastguard Worker## connect() 56*8542734aSAndroid Build Coastguard Worker 57*8542734aSAndroid Build Coastguard Worker- Documented in [connect\_benchmark.cpp](connect_benchmark.cpp) 58*8542734aSAndroid Build Coastguard Worker 59*8542734aSAndroid Build Coastguard Worker## getaddrinfo() 60*8542734aSAndroid Build Coastguard Worker 61*8542734aSAndroid Build Coastguard Worker- Documented in [dns\_benchmark.cpp](dns_benchmark.cpp) 62*8542734aSAndroid Build Coastguard Worker 63*8542734aSAndroid Build Coastguard Worker 64*8542734aSAndroid Build Coastguard Worker<style type="text/css"> 65*8542734aSAndroid Build Coastguard Worker tr:nth-child(2n+1) { 66*8542734aSAndroid Build Coastguard Worker background: lightgrey; 67*8542734aSAndroid Build Coastguard Worker } 68*8542734aSAndroid Build Coastguard Worker td,th { 69*8542734aSAndroid Build Coastguard Worker text-align: left; 70*8542734aSAndroid Build Coastguard Worker vertical-align: top; 71*8542734aSAndroid Build Coastguard Worker } 72*8542734aSAndroid Build Coastguard Worker</style> 73