|
void | set_sampling_interval (uint64_t sampling_interval) |
| Sets the sampling interval in bytes. Setting it to 0 means to never sample.
|
|
bool | maybe_sample (size_t alloc_size) |
|
bool | definitely_sample (size_t alloc_size) |
|
uint64_t | sampling_interval () const |
|
size_t | sample_size (size_t allocation_size) const |
| How much should an allocation of size allocation_size count for.
|
|
disable_sampling_temporarily | pause_sampling () |
|
◆ definitely_sample()
bool sampler::definitely_sample |
( |
size_t |
alloc_size | ) |
|
|
inline |
This method should be called if maybe_sample returned true for particular allocation. It returns true if a sample should be taken and handles resetting the sample interval countdown.
◆ maybe_sample()
bool sampler::maybe_sample |
( |
size_t |
alloc_size | ) |
|
|
inline |
Updates the sampling state (byte remaining until next sample) and returns true if this allocation of size alloc_size
may be sampled. Specifically, if it returns false, this allocation is definitely not samples. However if it returns true, it is not yet determiined whether a sample should be taken. Instead, definitely_sample should be called and if it returns true, a sample is called for.
◆ pause_sampling()
Pauses sampling temporarily until the returned object is destroyed. This is more efficient and statisically more correct than doing a back and fourth of set_sampling_interval(0) and set_sampling_interval(RATE). The reason is that that would reset the interval to the next sample and force a reevaluation of the exponential distribution. This method avoids that.
The documentation for this class was generated from the following file: