tcmalloc: add method to update heap sampling period
Tcmalloc supports changing the heap sampling period at run-time.
However, the only way to achieve this is by changing the value of
a global flag, tcmalloc_sample_parameter, which is not thread safe
in C++11. Moreover, the flag is hard to use from code outside the
tcmalloc code base, as it requires re-declaring the flag.
Add two static methods to the Sampler class to get and set the sampling
period atomically. Expand the malloc extension methods GetNumericProperty
and SetNumericProperty to query and update the sampling period from outside
the tcmalloc code base.
TEST=Unit tests pass
Reviewed-by: Will Harris <firstname.lastname@example.org>
Commit-Queue: Gabriel Marin <email@example.com>
4 files changed