libsanitizer: add filtering of sleep intervals for BackgroundThread.
Previously sleep interval length of BackgroundThread was determined by a
hardcoded value, thus limiting time resolution of dependent tools, such
as Heap Profiler. This commit implements simple algorithm which remembers
last several sleeps (namely 2), their durations and whether or not they
were followed by some interesting events (i.e. delivery of some memory
usage statistics). Then it tries to predict an optimal sleep length for
the next time, changing it dynamically.
Change-Id: I6fc3865cbf4b9e8c5dd6ad4222eac2085a612b51
Signed-off-by: Andrey Drobyshev <a.drobyshev@samsung.com>