LLVM 22.0.0git
HeatUtils.h
Go to the documentation of this file.
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
17#include <cstdint>
18#include <string>
19
20namespace llvm {
21
22class BlockFrequencyInfo;
23class Function;
24
25// Returns number of calls of calledFunction by callerFunction.
26LLVM_ABI uint64_t getNumOfCalls(Function &callerFunction,
27 Function &calledFunction);
28
29// Returns the maximum frequency of a BB in a function.
30LLVM_ABI uint64_t getMaxFreq(const Function &F, const BlockFrequencyInfo *BFI);
31
32// Calculates heat color based on current and maximum frequencies.
33LLVM_ABI std::string getHeatColor(uint64_t freq, uint64_t maxFreq);
34
35// Calculates heat color based on percent of "hotness".
36LLVM_ABI std::string getHeatColor(double percent);
37
38} // namespace llvm
39
40#endif
block freq
#define LLVM_ABI
Definition: Compiler.h:213
#define F(x, y, z)
Definition: MD5.cpp:55
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
LLVM_ABI uint64_t getNumOfCalls(Function &callerFunction, Function &calledFunction)
Definition: HeatUtils.cpp:41
LLVM_ABI std::string getHeatColor(uint64_t freq, uint64_t maxFreq)
Definition: HeatUtils.cpp:63
LLVM_ABI uint64_t getMaxFreq(const Function &F, const BlockFrequencyInfo *BFI)
Definition: HeatUtils.cpp:53