libsanitizer: add filtering of sleep intervals for BackgroundThread. 86/194286/5
authorAndrey Drobyshev <a.drobyshev@samsung.com>
Fri, 30 Nov 2018 15:30:55 +0000 (18:30 +0300)
committerAndrey Drobyshev <a.drobyshev@samsung.com>
Mon, 11 Feb 2019 06:34:38 +0000 (06:34 +0000)
commit746c34ff87a022d0d372bda1f798b9027f9eb7bd
tree4cfea842469accfaf4d45988b16477093af06f52
parent35faeb089167e1ed3cb8ee7808d72da3855c85f1
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>
libsanitizer/asan/asan_memory_profile.cc
libsanitizer/sanitizer_common/sanitizer_common.h
libsanitizer/sanitizer_common/sanitizer_common_libcdep.cc
libsanitizer/sanitizer_common/sanitizer_flags.inc