HeatUtils.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //===-- HeatUtils.h - Utility for printing heat colors ----------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // Utility for printing heat colors based on profiling information.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_ANALYSIS_HEATUTILS_H
  14. #define LLVM_ANALYSIS_HEATUTILS_H
  15. #include <cstdint>
  16. #include <string>
  17. namespace llvm {
  18. class BlockFrequencyInfo;
  19. class Function;
  20. // Returns number of calls of calledFunction by callerFunction.
  21. uint64_t
  22. getNumOfCalls(Function &callerFunction, Function &calledFunction);
  23. // Returns the maximum frequency of a BB in a function.
  24. uint64_t getMaxFreq(const Function &F, const BlockFrequencyInfo *BFI);
  25. // Calculates heat color based on current and maximum frequencies.
  26. std::string getHeatColor(uint64_t freq, uint64_t maxFreq);
  27. // Calculates heat color based on percent of "hotness".
  28. std::string getHeatColor(double percent);
  29. } // namespace llvm
  30. #endif