[all-commits] [llvm/llvm-project] a044d0: [llvm-profdata] Support JSON as as an output-only ...

kazutakahirata via All-commits all-commits at lists.llvm.org
Tue Aug 9 16:25:06 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a044d0491efeb821f1f23a935515692984b21ad5
      https://github.com/llvm/llvm-project/commit/a044d0491efeb821f1f23a935515692984b21ad5
  Author: Kazu Hirata <kazu at google.com>
  Date:   2022-08-09 (Tue, 09 Aug 2022)

  Changed paths:
    M llvm/include/llvm/ProfileData/SampleProfReader.h
    M llvm/lib/ProfileData/SampleProfReader.cpp
    A llvm/test/tools/llvm-profdata/sample-profile-json.test
    M llvm/tools/llvm-profdata/llvm-profdata.cpp

  Log Message:
  -----------
  [llvm-profdata] Support JSON as as an output-only format

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
  with open ('profile.json') as f:
    profile = json.load(f)

Differential Revision: https://reviews.llvm.org/D130944




More information about the All-commits mailing list