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