[PATCH] D130944: [llvm-profdata] Add --json

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 13:35:37 PDT 2022


kazu marked 2 inline comments as done.
kazu added a comment.

In D130944#3695666 <https://reviews.llvm.org/D130944#3695666>, @wenlei wrote:

> Do you absolutely need this to be a supported format and generated natively in llvm tools?
>
> For a profile format, we'd expect full reader/writer support, in both llvm-profdata and llvm-profgen. Having a partially supported output only format seems less than ideal.
>
> For research purpose, would it be possible to generate json from a text profile through offline scripts?
>
> Another option is to leverage `llvm-profdata show` to have an extra flag to output in json form. `show` output doesn't need to be a valid profile format and it doesn't need to be loadable by profile reader.

The main reason for adding the JSON support in an llvm tool is that I can leverage the parser.

`llvm-profdata show` makes sense.

I wrote another "dumper" just for the JSON format in `SampleProfileReader`.   It's harder than I thought to wire `SampleProfileWriter*` to `llvm-profdata show`.  Specifically, I had trouble casting `raw_fd_ostream` to `raw_ostream` for `json::OStream` purposes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130944/new/

https://reviews.llvm.org/D130944



More information about the llvm-commits mailing list