[llvm] [Bolt] Add a new hidden option to perf2bolt for testing purpose (PR #163785)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 8 08:33:47 PST 2025
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 -- bolt/include/bolt/Profile/DataAggregator.h bolt/lib/Profile/DataAggregator.cpp bolt/unittests/Profile/PerfSpeEvents.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/bolt/include/bolt/Profile/DataAggregator.h b/bolt/include/bolt/Profile/DataAggregator.h
index 1f34482ce..9f19f7e95 100644
--- a/bolt/include/bolt/Profile/DataAggregator.h
+++ b/bolt/include/bolt/Profile/DataAggregator.h
@@ -178,9 +178,9 @@ private:
/// Process info for spawned processes
PerfProcessInfo BuildIDProcessInfo = {PerfProcessType::BUILDIDS};
PerfProcessInfo MainEventsPPI = {PerfProcessType::MAIN_EVENTS};
- PerfProcessInfo MemEventsPPI = {PerfProcessType::MEN_EVENTS};
+ PerfProcessInfo MemEventsPPI = {PerfProcessType::MEN_EVENTS};
PerfProcessInfo MMapEventsPPI = {PerfProcessType::MMAP_EVENTS};
- PerfProcessInfo TaskEventsPPI = {PerfProcessType::TASK_EVENTS};
+ PerfProcessInfo TaskEventsPPI = {PerfProcessType::TASK_EVENTS};
/// Kernel VM starts at fixed based address
/// https://www.kernel.org/doc/Documentation/x86/x86_64/mm.txt
@@ -471,9 +471,9 @@ private:
///
/// We process the special header of the pre-parsed profile first to
/// determine an offset/length pairs for each events.
- /// Later based on these information we open only a slice of the pre-parsed file
- /// which belongs to the required event.
- /// After the preparation parsePerfData function is invoked.
+ /// Later based on these information we open only a slice of the pre-parsed
+ /// file which belongs to the required event. After the preparation
+ /// parsePerfData function is invoked.
void parsePerfTextData(BinaryContext &BC);
/// Parse the header of the perf text file.
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index 91b8d0e33..c27de56f1 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -121,11 +121,11 @@ cl::opt<bool> ReadPreAggregated(
"pa", cl::desc("skip perf and read data from a pre-aggregated file format"),
cl::cat(AggregatorCategory));
-cl::opt<bool>
- ReadPerfTextData("perf-text-data",
- cl::desc("skip perf event collection by reading a "
- "pre-parsed perf-script output in a textual format"),
- cl::Hidden, cl::cat(AggregatorCategory));
+cl::opt<bool> ReadPerfTextData(
+ "perf-text-data",
+ cl::desc("skip perf event collection by reading a "
+ "pre-parsed perf-script output in a textual format"),
+ cl::Hidden, cl::cat(AggregatorCategory));
cl::opt<bool> GeneratePerfTextProfile(
"generate-perf-text-data",
@@ -447,7 +447,7 @@ std::error_code DataAggregator::parsePerfTextFileHeader() {
return make_error_code(llvm::errc::io_error);
}
- if (LengthStr.getAsInteger(10, Length)) {
+ if (LengthStr.getAsInteger(10, Length)) {
reportError("corrupted decimal number");
Diag << "Found: " << LengthStr << "in" << HeaderLine << "\n";
return make_error_code(llvm::errc::io_error);
@@ -491,7 +491,6 @@ void DataAggregator::parsePerfTextData(BinaryContext &BC) {
parsePerfData(BC);
}
-
void DataAggregator::generatePerfTextData() {
std::error_code EC;
raw_fd_ostream OutFile(opts::OutputFilename, EC, sys::fs::OpenFlags::OF_None);
@@ -573,7 +572,8 @@ int DataAggregator::prepareToParse(StringRef Name, PerfProcessInfo &Process,
ErrorOr<std::unique_ptr<MemoryBuffer>> MB =
MemoryBuffer::getFileSlice(Filename, Process.Length, Process.Offset);
if (std::error_code EC = MB.getError()) {
- errs() << "Cannot open " << Process.Type << ": " << EC.message() << "\n";
+ errs() << "Cannot open " << Process.Type << ": " << EC.message()
+ << "\n";
exit(1);
}
@@ -584,14 +584,12 @@ int DataAggregator::prepareToParse(StringRef Name, PerfProcessInfo &Process,
return 0;
}
- errs() << "PERF2BOLT: missing pre-parsed data for " << Process.Type
- << "\n";
+ errs() << "PERF2BOLT: missing pre-parsed data for " << Process.Type << "\n";
errs() << "PERF2BOLT: please check whether your input file was generated "
- "with --generate-perf-text-data option. \n";
+ "with --generate-perf-text-data option. \n";
exit(1);
}
-
std::string Error;
outs() << "PERF2BOLT: waiting for perf " << Name
<< " collection to finish...\n";
``````````
</details>
https://github.com/llvm/llvm-project/pull/163785
More information about the llvm-commits
mailing list