Skip to content

Commit 96378b3

Browse files
authored
[BOLT] Add NamedRegionTimer to inferStaleProfile (#93078)
1 parent cc3b6c3 commit 96378b3

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

bolt/lib/Profile/StaleProfileMatching.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "llvm/ADT/Bitfields.h"
3131
#include "llvm/ADT/Hashing.h"
3232
#include "llvm/Support/CommandLine.h"
33+
#include "llvm/Support/Timer.h"
3334
#include "llvm/Support/xxhash.h"
3435
#include "llvm/Transforms/Utils/SampleProfileInference.h"
3536

@@ -42,6 +43,7 @@ using namespace llvm;
4243

4344
namespace opts {
4445

46+
extern cl::opt<bool> TimeRewrite;
4547
extern cl::OptionCategory BoltOptCategory;
4648

4749
cl::opt<bool>
@@ -707,6 +709,10 @@ void assignProfile(BinaryFunction &BF,
707709

708710
bool YAMLProfileReader::inferStaleProfile(
709711
BinaryFunction &BF, const yaml::bolt::BinaryFunctionProfile &YamlBF) {
712+
713+
NamedRegionTimer T("inferStaleProfile", "stale profile inference", "rewrite",
714+
"Rewrite passes", opts::TimeRewrite);
715+
710716
if (!BF.hasCFG())
711717
return false;
712718

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ extern cl::list<std::string> ReorderData;
8686
extern cl::opt<bolt::ReorderFunctions::ReorderType> ReorderFunctions;
8787
extern cl::opt<bool> TerminalTrap;
8888
extern cl::opt<bool> TimeBuild;
89+
extern cl::opt<bool> TimeRewrite;
8990

9091
cl::opt<bool> AllowStripped("allow-stripped",
9192
cl::desc("allow processing of stripped binaries"),
@@ -235,11 +236,6 @@ UseGnuStack("use-gnu-stack",
235236
cl::ZeroOrMore,
236237
cl::cat(BoltCategory));
237238

238-
static cl::opt<bool>
239-
TimeRewrite("time-rewrite",
240-
cl::desc("print time spent in rewriting passes"), cl::Hidden,
241-
cl::cat(BoltCategory));
242-
243239
static cl::opt<bool>
244240
SequentialDisassembly("sequential-disassembly",
245241
cl::desc("performs disassembly sequentially"),

bolt/lib/Utils/CommandLineOpts.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ cl::opt<bool> TimeOpts("time-opts",
179179
cl::desc("print time spent in each optimization"),
180180
cl::cat(BoltOptCategory));
181181

182+
cl::opt<bool> TimeRewrite("time-rewrite",
183+
cl::desc("print time spent in rewriting passes"),
184+
cl::Hidden, cl::cat(BoltCategory));
185+
182186
cl::opt<bool> UseOldText(
183187
"use-old-text",
184188
cl::desc("re-use space in old .text if possible (relocation mode)"),

0 commit comments

Comments
 (0)