llvm-project/llvm/tools/llvm-xray
Keith Wyss 9420ec3378 [XRay][tools] Function call stack based analysis tooling for XRay traces
Second try after fixing a code san problem with iterator reference types.

This change introduces a subcommand to the llvm-xray tool called
"stacks" which allows for analysing XRay traces provided as inputs and
accounting time to stacks instead of just individual functions. This
gives us a more precise view of where in a program the latency is
actually attributed.

The tool uses a trie data structure to keep track of the caller-callee
relationships as we process the XRay traces. In particular, we keep
track of the function call stack as we enter functions. While we're
doing this we're adding nodes in a trie and indicating a "calls"
relatinship between the caller (current top of the stack) and the callee
(the new top of the stack). When we push function ids onto the stack, we
keep track of the timestamp (TSC) for the enter event.

When exiting functions, we are able to account the duration by getting
the difference between the timestamp of the exit event and the
corresponding entry event in the stack. This works even if we somehow
miss the exit events for intermediary functions (i.e. if the exit event
is not cleanly associated with the enter event at the top of the stack).

The output of the tool currently provides just the top N leaf functions
that contribute the most latency, and the top N stacks that have the
most frequency. In the future we can provide more sophisticated query
mechanisms and potentially an export to database feature to make offline
analysis of the stack traces possible with existing tools.

Differential revision: D34863

llvm-svn: 312733
2017-09-07 18:07:48 +00:00
..
CMakeLists.txt [XRay][tools] Function call stack based analysis tooling for XRay traces 2017-09-07 18:07:48 +00:00
func-id-helper.cc [XRay] Implement `llvm-xray convert` -- trace file conversion 2017-01-10 02:38:11 +00:00
func-id-helper.h [XRay] Implement `llvm-xray convert` -- trace file conversion 2017-01-10 02:38:11 +00:00
llvm-xray.cc [XRay][tools] Handle "no subcommand" case for llvm-xray 2017-03-29 04:55:45 +00:00
xray-account.cc [XRay][tools] Fix an accounting bug in llvm-xray account 2017-08-31 01:07:24 +00:00
xray-account.h Fix windows buildbots building llvm-xray 2017-01-12 11:13:51 +00:00
xray-color-helper.cc [XRay] A tool for Comparing xray function call graphs 2017-04-24 05:54:33 +00:00
xray-color-helper.h [XRay] A tool for Comparing xray function call graphs 2017-04-24 05:54:33 +00:00
xray-converter.cc [XRAY] [x86_64] Adding a Flight Data filetype reader to the llvm-xray Trace implementation. 2017-02-17 01:47:16 +00:00
xray-converter.h [XRay] Define the library for XRay trace logs 2017-01-11 06:39:09 +00:00
xray-extract.cc Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
xray-graph-diff.cc [XRay][tools] Remove wayward semicolon (NFC) 2017-04-26 03:49:49 +00:00
xray-graph-diff.h [XRay][tools] Fixup for pedantic and permissive errors/warnings 2017-04-24 06:15:53 +00:00
xray-graph.cc [XRay] A tool for Comparing xray function call graphs 2017-04-24 05:54:33 +00:00
xray-graph.h [XRay][tools] Fixup definition for stat division. 2017-04-26 01:35:23 +00:00
xray-record-yaml.h [XRay][tools] Function call stack based analysis tooling for XRay traces 2017-09-07 18:07:48 +00:00
xray-registry.cc [XRay] Implement `llvm-xray extract`, start of the llvm-xray tool 2016-10-26 04:14:34 +00:00
xray-registry.h [XRay] Implement `llvm-xray extract`, start of the llvm-xray tool 2016-10-26 04:14:34 +00:00
xray-stacks.cc [XRay][tools] Function call stack based analysis tooling for XRay traces 2017-09-07 18:07:48 +00:00