1//===-- HeatUtils.h - Utility for printing heat colors ----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Utility for printing heat colors based on profiling information.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_ANALYSIS_HEATUTILS_H
14#define LLVM_ANALYSIS_HEATUTILS_H
15
16#include <cstdint>
17#include <string>
18
19namespace llvm {
20
21class BlockFrequencyInfo;
22class Function;
23
24// Returns number of calls of calledFunction by callerFunction.
25uint64_t
26getNumOfCalls(Function &callerFunction, Function &calledFunction);
27
28// Returns the maximum frequency of a BB in a function.
29uint64_t getMaxFreq(const Function &F, const BlockFrequencyInfo *BFI);
30
31// Calculates heat color based on current and maximum frequencies.
32std::string getHeatColor(uint64_t freq, uint64_t maxFreq);
33
34// Calculates heat color based on percent of "hotness".
35std::string getHeatColor(double percent);
36
37} // namespace llvm
38
39#endif
40

source code of llvm/include/llvm/Analysis/HeatUtils.h