# Compute confidence intervals in DistributedTreeDriver

*Created by: masterleinad*

Based on #78, this pull requests improves `DistributedTreeDriver`

further. The idea is as follows:

- We first run the test a couple of time to have an estimate for mean and variance of the runtime for the individual sections (
`construction`

,`knn`

,`radius`

). (We take the maximum over all MPI processes in each iteration). - These statistics are used to estimate for each section the number of total iterations needed to get a confidence interval of specified width.
- We run the maximum of these estimates number iterations (additionally) and output mean, variance and a new confidence interval at the end.

All this is based on `CppCon 2015: Bryce Adelstein-Lelbach “Benchmarking C++ Code`

and `Boost.Accumulators`

.

Sample output:

```
$ mpiexec -np 2 ./ArborX_DistributedTree.exe
ArborX version: 0.9 (dev)
ArborX hash : 829b702
Running with arguments:
perform knn search : true
perform radius search : true
#points/MPI process : 50000
#queries/MPI process : 20000
size of shift : 1
dimension : 3
Sample lap 0:
contruction done
knn done
radius done
[...]
Sample lap 9:
contruction done
knn done
radius done
estimated 11 iterations
Total lap 10:
contruction done
knn done
radius done
[...]
Total lap 20:
contruction done
knn done
radius done
=========================================================================
TimeMonitor results over 2 processors
Timer Name | mean | variance | confidence interval
-------------------------------------------------------------------------
construction | 5.052878e-02 | 2.047170e-05 | [4.841836e-02, 5.263920e-02]
knn | 1.172640e+00 | 2.565172e-02 | [1.097935e+00, 1.247345e+00]
radius | 6.593428e-01 | 6.237161e-03 | [6.225057e-01, 6.961799e-01]
=========================================================================
```