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

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 14:34:58 PDT 2022


kazu created this revision.
Herald added subscribers: wenlei, hiraditya.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch teaches llvm-profdata to output the sample profile in the
JSON format.  The new option is intended to be used for research and
development purposes.  For example, one can write a Python script to
take a JSON file and analyze how similar different inline instances of
a given function are to each other.

I've chosen JSON because Python can parse it reasonably fast, and it
just takes a couple of lines to read the whole data:

  import json
  profile = json.load(open('profile.json'))


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130944

Files:
  llvm/include/llvm/ProfileData/SampleProf.h
  llvm/include/llvm/ProfileData/SampleProfWriter.h
  llvm/lib/ProfileData/SampleProfWriter.cpp
  llvm/test/tools/llvm-profdata/sample-profile-json.test
  llvm/tools/llvm-profdata/llvm-profdata.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130944.449128.patch
Type: text/x-patch
Size: 9493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220801/0b5e64b0/attachment.bin>


More information about the llvm-commits mailing list