LLVM: llvm::sampleprof::DefaultFunctionPruningStrategy Class Reference (original) (raw)
Definition at line 69 of file SampleProfWriter.h.
| void DefaultFunctionPruningStrategy::Erase ( size_t CurrentOutputSize) | 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 81 of file SampleProfWriter.cpp.
References assert(), D(), llvm::drop_begin(), llvm::sampleprof::FunctionPruningStrategy::OutputSizeLimit, llvm::sampleprof::FunctionPruningStrategy::ProfileMap, and round().