1# RUN: llvm-xray account -d %s -o - -m %S/Inputs/simple-instrmap.yaml | FileCheck --check-prefixes=ALL %s
2# RUN: llvm-xray account -d -recursive-calls-only %s -o - -m %S/Inputs/simple-instrmap.yaml | FileCheck --check-prefixes=RECURSIVE %s
3
4---
5header:
6  version: 1
7  type: 0
8  constant-tsc: true
9  nonstop-tsc: true
10  cycle-frequency: 0
11records:
12# Here we reconstruct the following call trace:
13#
14#   f1()
15#     f2()
16#       f3()
17#   f2()
18#
19# But we find that we're missing an exit record for f2() because it's
20# tail-called f3(). We make sure that if we see a trace like this that we can
21# deduce tail calls, and account the time (potentially wrongly) to f2() when
22# f1() exits. That is because we don't go back to f3()'s entry record to
23# properly do the math on the timing of f2().
24#
25# As a result, we can deduce that f2() is not recursive here.
26#
27# Note that by default, tail/sibling call deduction is disabled, and is enabled
28# with a flag "-d" or "-deduce-sibling-calls".
29#
30  - { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-enter, tsc: 10000 }
31  - { type: 0, func-id: 2, cpu: 1, thread: 111, kind: function-enter, tsc: 10001 }
32  - { type: 0, func-id: 3, cpu: 1, thread: 111, kind: function-enter, tsc: 10002 }
33  - { type: 0, func-id: 3, cpu: 1, thread: 111, kind: function-exit,  tsc: 10003 }
34  - { type: 0, func-id: 1, cpu: 1, thread: 111, kind: function-exit,  tsc: 10004 }
35  - { type: 0, func-id: 2, cpu: 1, thread: 111, kind: function-enter, tsc: 10005 }
36  - { type: 0, func-id: 2, cpu: 1, thread: 111, kind: function-exit,  tsc: 10006 }
37...
38
39# ALL:      Functions with latencies: 3
40# ALL-NEXT:    funcid      count [      min,       med,       90p,       99p,       max]       sum  function
41# ALL-NEXT:         1          1 [ 4.000000,  4.000000,  4.000000,  4.000000,  4.000000]  4.000000  <invalid>:0:0: @(1)
42# ALL-NEXT:         2          2 [ 1.000000,  3.000000,  3.000000,  3.000000,  3.000000]  4.000000  <invalid>:0:0: @(2)
43# ALL-NEXT:         3          1 [ 1.000000,  1.000000,  1.000000,  1.000000,  1.000000]  1.000000  <invalid>:0:0: @(3)
44
45# RECURSIVE:      Functions with latencies: 0
46# RECURSIVE-NEXT:    funcid      count [      min,       med,       90p,       99p,       max]       sum  function
47