LLVM 20.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
16#include <cstdint>
17#include <string>
18
19namespace llvm {
20
21class BlockFrequencyInfo;
22class Function;
23
24// Returns number of calls of calledFunction by callerFunction.
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
block freq
#define F(x, y, z)
Definition: MD5.cpp:55
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
uint64_t getNumOfCalls(Function &callerFunction, Function &calledFunction)
Definition: HeatUtils.cpp:41
std::string getHeatColor(uint64_t freq, uint64_t maxFreq)
Definition: HeatUtils.cpp:63
uint64_t getMaxFreq(const Function &F, const BlockFrequencyInfo *BFI)
Definition: HeatUtils.cpp:53