mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
f43849e9c7
This patch introduces the heat coloring of the Call Printer which is based on the relative "hotness" of each function. The patch is a part of sequence of three patches, related to graphs Heat Coloring. Another feature added is the flag similar to "-cfg-dot-filename-prefix", which allows to write the graph into a named .pdf Reviewers: rcorcs, apilipenko, davidxl, sfertile, fedor.sergeev, eraman, bollu Differential Revision: https://reviews.llvm.org/D77172
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
//===-- 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
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace llvm {
|
|
|
|
class BlockFrequencyInfo;
|
|
class Function;
|
|
|
|
// Returns number of calls of calledFunction by callerFunction.
|
|
uint64_t
|
|
getNumOfCalls(Function &callerFunction, Function &calledFunction);
|
|
|
|
// 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
|