[PATCH] D45757: [XRay][profiler] Part 2: XRay Function Call Trie

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 18 01:03:47 PDT 2018


dberris created this revision.
dberris added reviewers: echristo, pelikan, kpw.
Herald added a subscriber: mgorny.

This is part of the larger XRay Profiling Mode effort.

This patch implements a central data structure for capturing statistics
about XRay instrumented function call stacks. The `FunctionCallTrie`
type does the following things:

- It keeps track of a shadow function call stack of XRay instrumented functions as they are entered (function enter event) and as they are exited (function exit event).

- When a function is entered, the shadow stack contains information about the entry TSC, and updates the trie (or prefix tree) representing the current function call stack. If we haven't encountered this function call before, this creates a unique node for the function in this position on the stack. We update the list of callees of the parent function as well to reflect this newly found path.

- When a function is exited, we compute statistics (TSC deltas, function call count frequency) for the associated function(s) up the stack as we unwind to find the matching entry event.

This builds upon the XRay `Allocator` and `Array` types in Part 1 of
this series of patches.

Depends on https://reviews.llvm.org/D45756.


https://reviews.llvm.org/D45757

Files:
  compiler-rt/lib/xray/CMakeLists.txt
  compiler-rt/lib/xray/tests/CMakeLists.txt
  compiler-rt/lib/xray/tests/unit/CMakeLists.txt
  compiler-rt/lib/xray/tests/unit/function_call_trie_test.cc
  compiler-rt/lib/xray/xray_function_call_trie.h
  compiler-rt/lib/xray/xray_profiler_flags.cc
  compiler-rt/lib/xray/xray_profiler_flags.h
  compiler-rt/lib/xray/xray_profiler_flags.inc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45757.142890.patch
Type: text/x-patch
Size: 32002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180418/b937ea7d/attachment.bin>


More information about the llvm-commits mailing list