MB-28940: Remove lock usage from StatisticalCounter
MB-28940: Remove lock usage from StatisticalCounter

The StatisticalCounter::generateValue benchmark has shown that the
function suffers a peformance degradation when used in a multi-threaded
environment.

See below:

./ep_engine_benchmarks --benchmark_filter=BM_SaturateCounter
Run on (8 X 2500 MHz CPU s)
2018-03-28 17:04:15
--------------------------------------------------------------------
Benchmark                             Time           CPU Iterations
--------------------------------------------------------------------
BM_SaturateCounter/threads:1         28 ns         28 ns   22953679
BM_SaturateCounter/threads:8       3723 ns       3853 ns     180248

The issue is believed to be due to the use of a mutex in the
generateValue function.  Therefore this patch changes to use a
thread_local random number generator.  This is based on:
https://stackoverflow.com/a/21238187

The effect on the StatisticalCounter::generateValue benchmark is shown
below:

./ep_engine_benchmarks --benchmark_filter=BM_SaturateCounter
Run on (8 X 2500 MHz CPU s)
2018-03-29 09:57:09
--------------------------------------------------------------------
Benchmark                             Time           CPU Iterations
--------------------------------------------------------------------
BM_SaturateCounter/threads:1         15 ns         15 ns   46295072
BM_SaturateCounter/threads:8          3 ns         23 ns   29931640

Change-Id: I987e983c63f743b9347d359a769ec13b85e28fde
Reviewed-on: http://review.couchbase.org/91756
Reviewed-by: Dave Rigby <a09264da4832c7ff1d3bf1608a19f4b870f93750@couchbase.com>
Tested-by: Build Bot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine