LLVM 22.0.0git
|
#include "llvm/ProfileData/SampleProfWriter.h"
Public Member Functions | |
DefaultFunctionPruningStrategy (SampleProfileMap &ProfileMap, size_t OutputSizeLimit) | |
void | Erase (size_t CurrentOutputSize) override |
In this default implementation, functions with fewest samples are dropped first. | |
Public Member Functions inherited from llvm::sampleprof::FunctionPruningStrategy | |
FunctionPruningStrategy (SampleProfileMap &ProfileMap, size_t OutputSizeLimit) | |
ProfileMap A reference to the original profile map. | |
virtual | ~FunctionPruningStrategy ()=default |
Additional Inherited Members | |
Protected Attributes inherited from llvm::sampleprof::FunctionPruningStrategy | |
SampleProfileMap & | ProfileMap |
size_t | OutputSizeLimit |
Definition at line 69 of file SampleProfWriter.h.
DefaultFunctionPruningStrategy::DefaultFunctionPruningStrategy | ( | SampleProfileMap & | ProfileMap, |
size_t | OutputSizeLimit ) |
|
overridevirtual |
In this default implementation, functions with fewest samples are dropped first.
Since the exact size of the output cannot be easily calculated due to compression, we use a heuristic to remove as many functions as necessary but not too many, aiming to minimize the number of write iterations. Empirically, functions with larger total sample count contain linearly more sample entries, meaning it takes linearly more space to write them. The cumulative length is therefore quadratic if all functions are sorted by total sample count. TODO: Find better heuristic.
Implements llvm::sampleprof::FunctionPruningStrategy.
Definition at line 76 of file SampleProfWriter.cpp.
References assert(), D(), llvm::drop_begin(), llvm::sampleprof::FunctionPruningStrategy::OutputSizeLimit, llvm::sampleprof::FunctionPruningStrategy::ProfileMap, and round().