[llvm-branch-commits] [llvm-profgen] Add --time-profgen (PR #191930)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Apr 13 20:11:18 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/tools/llvm-profgen/Options.h llvm/tools/llvm-profgen/PerfReader.cpp llvm/tools/llvm-profgen/ProfileGenerator.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/tools/llvm-profgen/PerfReader.cpp b/llvm/tools/llvm-profgen/PerfReader.cpp
index aa913a336..fc8059238 100644
--- a/llvm/tools/llvm-profgen/PerfReader.cpp
+++ b/llvm/tools/llvm-profgen/PerfReader.cpp
@@ -68,9 +68,8 @@ static cl::opt<std::string> FilterBuildID(
"with a matching build ID prefix are kept."),
cl::cat(ProfGenCategory));
-cl::opt<bool> TimeProfGen("time-profgen",
- cl::desc("Time llvm-profgen phases"), cl::init(false),
- cl::cat(ProfGenCategory));
+cl::opt<bool> TimeProfGen("time-profgen", cl::desc("Time llvm-profgen phases"),
+ cl::init(false), cl::cat(ProfGenCategory));
static const char *TimerGroupName = "profgen";
static const char *TimerGroupDesc = "llvm-profgen";
@@ -609,8 +608,8 @@ static std::string getContextKeyStr(ContextKey *K,
}
void HybridPerfReader::unwindSamples() {
- NamedRegionTimer T("unwind", "Unwind samples", TimerGroupName,
- TimerGroupDesc, TimeProfGen);
+ NamedRegionTimer T("unwind", "Unwind samples", TimerGroupName, TimerGroupDesc,
+ TimeProfGen);
VirtualUnwinder Unwinder(&SampleCounters, Binary);
for (const auto &Item : AggregatedSamples) {
const PerfSample *Sample = Item.first.getPtr();
@@ -766,7 +765,8 @@ bool PerfScriptReader::extractCallstack(TraceStream &TraceIt,
// It's in bottom-up order with each frame in one line.
// Extract stack frames from sample
- while (!TraceIt.isAtEoF() && !isLBRSample(TraceIt.getCurrentLine(), true, IsPreAggregated)) {
+ while (!TraceIt.isAtEoF() &&
+ !isLBRSample(TraceIt.getCurrentLine(), true, IsPreAggregated)) {
StringRef FrameStr = TraceIt.getCurrentLine().ltrim();
uint64_t FrameAddr = 0;
StringRef FrameBuildID;
@@ -821,7 +821,8 @@ bool PerfScriptReader::extractCallstack(TraceStream &TraceIt,
// Skip other unrelated line, find the next valid LBR line
// Note that even for empty call stack, we should skip the address at the
// bottom, otherwise the following pass may generate a truncated callstack
- while (!TraceIt.isAtEoF() && !isLBRSample(TraceIt.getCurrentLine(), true, IsPreAggregated)) {
+ while (!TraceIt.isAtEoF() &&
+ !isLBRSample(TraceIt.getCurrentLine(), true, IsPreAggregated)) {
TraceIt.advance();
}
// Filter out broken stack sample. We may not have complete frame info
@@ -866,14 +867,16 @@ void HybridPerfReader::parseSample(TraceStream &TraceIt, uint64_t Count) {
// Parsing call stack and populate into PerfSample.CallStack
if (!extractCallstack(TraceIt, Sample->CallStack)) {
// Skip the next LBR line matched current call stack
- if (!TraceIt.isAtEoF() && isLBRSample(TraceIt.getCurrentLine(), true, IsPreAggregated))
+ if (!TraceIt.isAtEoF() &&
+ isLBRSample(TraceIt.getCurrentLine(), true, IsPreAggregated))
TraceIt.advance();
return;
}
warnIfMissingMMap();
- if (!TraceIt.isAtEoF() && isLBRSample(TraceIt.getCurrentLine(), true, IsPreAggregated)) {
+ if (!TraceIt.isAtEoF() &&
+ isLBRSample(TraceIt.getCurrentLine(), true, IsPreAggregated)) {
// Parsing LBR stack and populate into PerfSample.LBRStack
if (extractLBRStack(TraceIt, Sample->LBRStack)) {
if (IgnoreStackSamples) {
diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
index 3f1229421..10b5e9ad3 100644
--- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp
+++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
@@ -502,8 +502,8 @@ ProfileGenerator::getTopLevelFunctionProfile(FunctionId FuncName) {
}
void ProfileGenerator::generateProfile() {
- NamedRegionTimer T("generate", "Generate profile", "profgen",
- "llvm-profgen", TimeProfGen);
+ NamedRegionTimer T("generate", "Generate profile", "profgen", "llvm-profgen",
+ TimeProfGen);
collectProfiledFunctions();
if (Binary->usePseudoProbes()) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/191930
More information about the llvm-branch-commits
mailing list