Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:13

0001 //===-- HeatUtils.h - Utility for printing heat colors ----------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Utility for printing heat colors based on profiling information.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_ANALYSIS_HEATUTILS_H
0014 #define LLVM_ANALYSIS_HEATUTILS_H
0015 
0016 #include <cstdint>
0017 #include <string>
0018 
0019 namespace llvm {
0020 
0021 class BlockFrequencyInfo;
0022 class Function;
0023 
0024 // Returns number of calls of calledFunction by callerFunction.
0025 uint64_t
0026 getNumOfCalls(Function &callerFunction, Function &calledFunction);
0027 
0028 // Returns the maximum frequency of a BB in a function.
0029 uint64_t getMaxFreq(const Function &F, const BlockFrequencyInfo *BFI);
0030 
0031 // Calculates heat color based on current and maximum frequencies.
0032 std::string getHeatColor(uint64_t freq, uint64_t maxFreq);
0033 
0034 // Calculates heat color based on percent of "hotness".
0035 std::string getHeatColor(double percent);
0036 
0037 } // namespace llvm
0038 
0039 #endif