Skip to content

Commit 9f23138

Browse files
authored
[BOLT] Add NamedRegionTimer to inferStaleProfile (#92621)
1 parent 3eb7711 commit 9f23138

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
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>
@@ -705,6 +707,10 @@ void assignProfile(BinaryFunction &BF,
705707

706708
bool YAMLProfileReader::inferStaleProfile(
707709
BinaryFunction &BF, const yaml::bolt::BinaryFunctionProfile &YamlBF) {
710+
711+
NamedRegionTimer T("inferStaleProfile", "stale profile inference", "rewrite",
712+
"Rewrite passes", opts::TimeRewrite);
713+
708714
if (!BF.hasCFG())
709715
return false;
710716

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,9 @@ UseGnuStack("use-gnu-stack",
235235
cl::ZeroOrMore,
236236
cl::cat(BoltCategory));
237237

238-
static cl::opt<bool>
239-
TimeRewrite("time-rewrite",
240-
cl::desc("print time spent in rewriting passes"), cl::Hidden,
241-
cl::cat(BoltCategory));
238+
cl::opt<bool> TimeRewrite("time-rewrite",
239+
cl::desc("print time spent in rewriting passes"),
240+
cl::Hidden, cl::cat(BoltCategory));
242241

243242
static cl::opt<bool>
244243
SequentialDisassembly("sequential-disassembly",

0 commit comments

Comments
 (0)