[compiler-rt] [clang] [clang-tools-extra] [llvm] [Profile] Allow profile merging with multiple correlate files. (PR #75957)

Ellis Hoag via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 16:46:29 PST 2024


================
@@ -118,18 +118,18 @@ cl::opt<std::string> ProfiledBinary(
     "profiled-binary", cl::init(""),
     cl::desc("Path to binary from which the profile was collected."),
     cl::sub(ShowSubcommand), cl::sub(MergeSubcommand));
-cl::opt<std::string> DebugInfoFilename(
-    "debug-info", cl::init(""),
+cl::list<std::string> DebugInfoFilenames(
+    "debug-info",
     cl::desc(
         "For show, read and extract profile metadata from debug info and show "
         "the functions it found. For merge, use the provided debug info to "
         "correlate the raw profile."),
     cl::sub(ShowSubcommand), cl::sub(MergeSubcommand));
-cl::opt<std::string>
-    BinaryFilename("binary-file", cl::init(""),
-                   cl::desc("For merge, use the provided unstripped bianry to "
-                            "correlate the raw profile."),
-                   cl::sub(MergeSubcommand));
+cl::list<std::string>
+    BinaryFilenames("binary-file",
+                    cl::desc("For merge, use the provided unstripped bianry to "
+                             "correlate the raw profile."),
+                    cl::sub(MergeSubcommand));
----------------
ellishg wrote:

> > Another option would be to extend the pattern strings to support %b to expand to the binary id or the binary name. Do you think that would work?
> 
> If the binary is built with binary id embedded, the raw profiles will also have binary id embedded. So there's no need to make `%b` expand to the binary id. The point for accepting multiple correlation files is to avoid some customizing scripts which associate raw profiles with different binaries.
> 
> The output indexed profile file will contain profile information for multiple binaries. I'm not sure if this will cause problems/inconvenience for processing. What's your thoughts on this @gulfemsavrun @petrhosek?

In my experience, automated profile generation systems already need customized scripts to gather raw profile data for merging. I found that it isn't hard to group raw profiles by the binaries they come from and merge profiles for each binary individually. I would prefer this over making the profile parsing logic more complicated, which is already difficult to understand.

https://github.com/llvm/llvm-project/pull/75957


More information about the cfe-commits mailing list