2020-03-31 20:43:25 +02:00
|
|
|
//===-- HeatUtils.h - Utility for printing heat colors ----------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Utility for printing heat colors based on profiling information.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_ANALYSIS_HEATUTILS_H
|
|
|
|
#define LLVM_ANALYSIS_HEATUTILS_H
|
|
|
|
|
2020-04-18 14:36:37 +02:00
|
|
|
#include <cstdint>
|
2020-03-31 20:43:25 +02:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2020-04-18 14:36:37 +02:00
|
|
|
class BlockFrequencyInfo;
|
|
|
|
class Function;
|
|
|
|
|
2020-06-16 20:39:54 +02:00
|
|
|
// Returns number of calls of calledFunction by callerFunction.
|
|
|
|
uint64_t
|
|
|
|
getNumOfCalls(Function &callerFunction, Function &calledFunction);
|
|
|
|
|
2020-03-31 20:43:25 +02:00
|
|
|
// Returns the maximum frequency of a BB in a function.
|
|
|
|
uint64_t getMaxFreq(const Function &F, const BlockFrequencyInfo *BFI);
|
|
|
|
|
|
|
|
// Calculates heat color based on current and maximum frequencies.
|
|
|
|
std::string getHeatColor(uint64_t freq, uint64_t maxFreq);
|
|
|
|
|
|
|
|
// Calculates heat color based on percent of "hotness".
|
|
|
|
std::string getHeatColor(double percent);
|
|
|
|
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif
|