[PATCH] D48370: [XRay][llvm] Load XRay Profiles

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 20 08:12:01 PDT 2018


dberris created this revision.
dberris added a reviewer: kpw.
Herald added subscribers: hiraditya, mgorny.

This change implements the profile loading functionality in LLVM to
support XRay's profiling mode in compiler-rt.

We introduce a type named `llvm::xray::Profile` which allows building a
profile representation. We can load an XRay profile from a file to build
Profile instances, or do it manually through the Profile type's API.

The intent is to get the `llvm-xray` tool to generate `Profile`
instances and use that as the common abstraction through which all
conversion and analysis can be done. In the future we can generate
`Profile` instances from `Trace` instances as well, through conversion
functions.

Some of the key operations supported by the `Profile` API are:

- Path interning (`Profile::internPath(...)`) which returns a unique path

identifier.

- Block appending (`Profile::addBlock(...)`) to add thread-associated

profile information.

- Path ID to Path lookup (`Profile::path(...)`) to look up a PathID and

return the original interned path.

- Block iteration.

A 'Path' in this context represents the function call stack in
leaf-to-root order. This is represented as a path in an internally
managed prefix tree in the `Profile` instance. Having a handle (PathID)
to identify the unique Paths we encounter for a particular Profile
allows us to reduce the amount of memory required to associate profile
data to a particular Path.

NOTE: This is a work-in-progress patch.


https://reviews.llvm.org/D48370

Files:
  llvm/include/llvm/XRay/Profile.h
  llvm/include/llvm/XRay/Trace.h
  llvm/lib/XRay/CMakeLists.txt
  llvm/lib/XRay/Profile.cpp
  llvm/lib/XRay/Trace.cpp
  llvm/tools/llvm-xray/xray-stacks.cpp
  llvm/unittests/XRay/CMakeLists.txt
  llvm/unittests/XRay/ProfileTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48370.152091.patch
Type: text/x-patch
Size: 17175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180620/233a2ab0/attachment.bin>


More information about the llvm-commits mailing list