1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/tools/llvm-xray/X86/graph-deduce-tail-call.yaml
Dean Michael Berris c91cd5f47b [XRay] Define the InstrumentationMap type
Summary:
This change implements the instrumentation map loading library which can
understand both YAML-defined instrumentation maps, and ELF 64-bit object
files that have the XRay instrumentation map section. We break it out
into a library on its own to allow for other applications to deal with
the XRay instrumentation map defined in XRay-instrumented binaries.

This type provides both raw access to the logical representation of the
instrumentation map entries as well as higher level functions for
converting a function ID into a function address.

At this point we only support ELF64 binaries and YAML-defined XRay
instrumentation maps. Future changes should extend this to support
32-bit ELF binaries, as well as other binary formats (like MachO).

As part of this change we also migrate all uses of the extraction logic
that used to be defined in tools/llvm-xray/ to use this new type and
interface for loading from files. We also remove the flag from the
`llvm-xray` tool that required users to specify the type of the
instrumentation map file being provided to instead make the library
auto-detect the file type.

Reviewers: dblaikie

Subscribers: mgorny, varno, llvm-commits

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

llvm-svn: 293721
2017-02-01 00:05:29 +00:00

76 lines
2.8 KiB
YAML

#RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d \
#RUN: | FileCheck %s -check-prefix=EMPTY
#RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e count \
#RUN: | FileCheck %s -check-prefix=COUNT
#
#RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e min \
#RUN: | FileCheck %s -check-prefix=TIME
#RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e med \
#RUN: | FileCheck %s -check-prefix=TIME
#RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e 90p \
#RUN: | FileCheck %s -check-prefix=TIME
#RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e 99p \
#RUN: | FileCheck %s -check-prefix=TIME
#RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e max \
#RUN: | FileCheck %s -check-prefix=TIME
#RUN: llvm-xray graph %s -o - -m %S/Inputs/simple-instrmap.yaml -d -e sum \
#RUN: | FileCheck %s -check-prefix=TIME
#
---
header:
version: 1
type: 0
constant-tsc: true
nonstop-tsc: true
cycle-frequency: 0
records:
# Here we reconstruct the following call trace:
#
# f1()
# f2()
# f3()
#
# But we find that we're missing an exit record for f2() because it's
# tail-called f3(). We make sure that if we see a trace like this that we can
# deduce tail calls, and account the time (potentially wrongly) to f2() when
# f1() exits. That is because we don't go back to f3()'s entry record to
# properly do the math on the timing of f2().
#
# Note that by default, tail/sibling call deduction is disabled, and is enabled
# with a flag "-d" or "-deduce-sibling-calls".
#
- { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-enter, tsc: 10000 }
- { type: 0, func-id: 2, cpu: 1, thread: 111, kind: function-enter, tsc: 10001 }
- { type: 0, func-id: 3, cpu: 1, thread: 111, kind: function-enter, tsc: 10002 }
- { type: 0, func-id: 3, cpu: 1, thread: 111, kind: function-exit, tsc: 10003 }
- { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-exit, tsc: 10004 }
...
#EMPTY: digraph xray {
#EMPTY-DAG: F0 -> F1 [label=""];
#EMPTY-DAG: F1 -> F2 [label=""];
#EMPTY-DAG: F2 -> F3 [label=""];
#EMPTY-DAG: F1 [label="@(1)"];
#EMPTY-DAG: F2 [label="@(2)"];
#EMPTY-DAG: F3 [label="@(3)"];
#EMPTY-NEXT: }
#COUNT: digraph xray {
#COUNT-DAG: F0 -> F1 [label="1"];
#COUNT-DAG: F1 -> F2 [label="1"];
#COUNT-DAG: F2 -> F3 [label="1"];
#COUNT-DAG: F1 [label="@(1)"];
#COUNT-DAG: F2 [label="@(2)"];
#COUNT-DAG: F3 [label="@(3)"];
#COUNT-NEXT: }
#TIME: digraph xray {
#TIME-DAG: F0 -> F1 [label="4.{{.*}}"];
#TIME-DAG: F1 -> F2 [label="3.{{.*}}"];
#TIME-DAG: F2 -> F3 [label="1.{{.*}}"];
#TIME-DAG: F1 [label="@(1)"];
#TIME-DAG: F2 [label="@(2)"];
#TIME-DAG: F3 [label="@(3)"];
#TIME-NEXT: }