Closed zamazan4ik closed 1 year ago
Hi, I tried using llvm-cov
, but it doesn't work if the binary doesn't have coverage information available.
I think that the proper tool for this is llvm-profdata
, which is already used by cargo-pgo
. It can display a lot of information, but I'm not sure what would be valuable to show by cargo-pgo
. It can e.g. output the list of functions and their corresponding counter values (sort by top N functions or something like that). Would this be useful for you? Or is there some other specific information that you would like to see? You can try running llvm-profdata --help
to see what it can output:
Seems like llvm-profdata show
is the thing for me, thanks! I am using it via cargo-binutils
that handles sysroot stuff. According to the llvm-profdata show
options, it can show all instrumented functions, create some kind of reports, show functions with some context, etc
I agree, that there is no reason to integrate llvm-profdata
into the cargo-pgo
right now. However, I think would be a good thing to know about the llvm-profdata
somewhere in the cargo-pgo
documentation. E.g. if a user wants to get some insights from their instrumentation profiles.
I have found one strange issue: at least on my machine llvm-profdata
doesn't work with merged profiles. When I try to run llvm-profdata show merged_data.profdata
, I get unsupported instrumentation profile format version
error. On the .profraw
files llvm-profdata
works as expected. For the users it could be a little bit inconvenient since for getting the whole coverage image from multiple runs they need somehow aggregate data from multiple runs on their own. But I understand that should be filed as an issue to the LLVM upstream, not here :)
Thanks for the help! I think the issue could be closed for now.
For me it has worked with the merged profile. But you have to use the exact llvm-profdata binary from the rustc toolchain used to compile the crate. Using a different version of LLVM might not work.
I'll add info about llvm-profdata to README.
I added brief information about using llvm-profdata
for displaying PGO profiles statistics to README. Let me know if I should add more information.
Hi!
Is there a way to calculate PGO coverage of the profiled program? I see now
cargo-pgo
shows warnings for functions without a profile. I want to see more "advanced" statistics regarding PGO coverage. I guess something like gcov + lcov from C++ world (with different report capabilities, etc).I guess it could be done somehow with
llvm-cov report profile.profdata
but I am not sure.Thanks in advance!