[llvm] [llvm-profgen][SPGO] Support profiles with multiple concurrent processes (PR #169353)
Wei Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 9 16:47:27 PST 2025
================
@@ -1169,15 +1263,24 @@ bool PerfScriptReader::isMMapEvent(StringRef Line) {
if (Line.empty() || Line.size() < 50)
return false;
- if (std::isdigit(Line[0]))
- return false;
+ if (MultiProcessProfile) {
+ // Trim off the first numeric field, which is the PID.
+ // Make sure not to trim other numeric fields.
+ auto Trimmed = Line.ltrim().ltrim("0123456789").ltrim();
+
+ if (Trimmed.empty() || std::isdigit(Trimmed[0]))
+ return false;
+ } else {
+ if (std::isdigit(Line[0]))
+ return false;
+ }
----------------
apolloww wrote:
nit
```suggestion
auto Trimmed = Line;
if (MultiProcessProfile)
// Trim off the first numeric field, which is the PID.
// Make sure not to trim other numeric fields.
Trimmed = Line.ltrim().ltrim("0123456789").ltrim();
if (Trimmed.empty() || std::isdigit(Trimmed[0]))
return false;
```
https://github.com/llvm/llvm-project/pull/169353
More information about the llvm-commits
mailing list