
For profile staleness report, before it only counts for the top-level function samples in the nested profile, the samples in the inlinees are ignored. This could affect the quality of the metrics when there are heavily inlined functions. This change adds a feature to flatten the nested profile and we're changing to use flatten profile as the input for stale profile detection and matching. Example for profile flattening: ``` Original profile: _Z3bazi:20301:1000 1: 1000 3: 2000 5: inline1:1600 1: 600 3: inline2:500 1: 500 Flattened profile: _Z3bazi:18701:1000 1: 1000 3: 2000 5: 600 inline1:600 inline1:1100:600 1: 600 3: 500 inline2: 500 inline2:500:500 1: 500 ``` This feature could be useful for offline analysis, like understanding the hotness of each individual function. So I'm adding the support to `llvm-profdata merge` under `--gen-flattened-profile`. Reviewed By: hoy, wenlei Differential Revision: https://reviews.llvm.org/D146452
200 lines
9.0 KiB
Plaintext
200 lines
9.0 KiB
Plaintext
RUN: llvm-profdata merge --sample --text -output=%t.proftext %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=0
|
|
RUN: FileCheck %s < %t.proftext --match-full-lines --strict-whitespace
|
|
RUN: llvm-profdata merge --sample --text -output=%t.probe.proftext %S/Inputs/cs-sample-preinline-probe.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=0
|
|
RUN: FileCheck %s < %t.probe.proftext --match-full-lines --strict-whitespace -check-prefix=PROBE
|
|
RUN: llvm-profdata merge --sample --extbinary -output=%t.profbin %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=0
|
|
RUN: llvm-profdata merge --sample --text -output=%t2.proftext %t.profbin
|
|
RUN: FileCheck %s < %t2.proftext --match-full-lines --strict-whitespace
|
|
RUN: llvm-profdata show --sample -show-sec-info-only %t.profbin | FileCheck %s -check-prefix=PREINLINE
|
|
RUN: llvm-profdata merge --sample --text -output=%t3.proftext %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=1
|
|
RUN: FileCheck %s < %t3.proftext --match-full-lines --strict-whitespace -check-prefix=RECOUNT
|
|
RUN: llvm-profdata merge --sample --extbinary -output=%t2.profbin %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=1
|
|
RUN: llvm-profdata show -sample -detailed-summary %S/Inputs/cs-sample-preinline.proftext | FileCheck %s -check-prefix=SUMMARY
|
|
RUN: llvm-profdata show -sample -detailed-summary %t2.profbin | FileCheck %s -check-prefix=SUMMARY-NEST
|
|
RUN: llvm-profdata show -sample -detailed-summary %t3.proftext | FileCheck %s -check-prefix=SUMMARY-NEST
|
|
|
|
|
|
; CHECK:main:1968621:12
|
|
; CHECK-NEXT: 2: 24
|
|
; CHECK-NEXT: 3: 17 _Z5funcAi:7
|
|
; CHECK-NEXT: 3.1: 10 _Z5funcBi:11
|
|
; CHECK-NEXT: 3: _Z5funcAi:1467388
|
|
; CHECK-NEXT: 0: 10
|
|
; CHECK-NEXT: 3: 24
|
|
; CHECK-NEXT: 1: _Z8funcLeafi:1467299
|
|
; CHECK-NEXT: 0: 6
|
|
; CHECK-NEXT: 1: 6
|
|
; CHECK-NEXT: 3: 287884
|
|
; CHECK-NEXT: 4: 287864 _Z3fibi:315608
|
|
; CHECK-NEXT: 15: 23
|
|
; CHECK-NEXT: !Attributes: 2
|
|
; CHECK-NEXT: !Attributes: 2
|
|
; CHECK-NEXT: 3.1: _Z5funcBi:500954
|
|
; CHECK-NEXT: 0: 19
|
|
; CHECK-NEXT: 3: 12
|
|
; CHECK-NEXT: 1: _Z8funcLeafi:500853
|
|
; CHECK-NEXT: 0: 15
|
|
; CHECK-NEXT: 1: 15
|
|
; CHECK-NEXT: 3: 74946
|
|
; CHECK-NEXT: 4: 74941 _Z3fibi:82359
|
|
; CHECK-NEXT: 10: 23324
|
|
; CHECK-NEXT: 11: 23327 _Z3fibi:25228
|
|
; CHECK-NEXT: 15: 11
|
|
; CHECK-NEXT: !Attributes: 2
|
|
; CHECK-NEXT: !Attributes: 2
|
|
; CHECK-NEXT:_Z5funcBi:240:13
|
|
; CHECK-NEXT: 0: 13
|
|
; CHECK-NEXT: 1: 13
|
|
|
|
|
|
; RECOUNT:main:1968621:12
|
|
; RECOUNT-NEXT: 2: 24
|
|
; RECOUNT-NEXT: 3: 17 _Z5funcAi:7
|
|
; RECOUNT-NEXT: 3.1: 10 _Z5funcBi:11
|
|
; RECOUNT-NEXT: 3: _Z5funcAi:1467388
|
|
; RECOUNT-NEXT: 0: 10
|
|
; RECOUNT-NEXT: 3: 24
|
|
; RECOUNT-NEXT: 1: _Z8funcLeafi:1467299
|
|
; RECOUNT-NEXT: 0: 6
|
|
; RECOUNT-NEXT: 1: 6
|
|
; RECOUNT-NEXT: 3: 287884
|
|
; RECOUNT-NEXT: 4: 287864 _Z3fibi:315608
|
|
; RECOUNT-NEXT: 15: 23
|
|
; RECOUNT-NEXT: !Attributes: 6
|
|
; RECOUNT-NEXT: !Attributes: 6
|
|
; RECOUNT-NEXT: 3.1: _Z5funcBi:500954
|
|
; RECOUNT-NEXT: 0: 19
|
|
; RECOUNT-NEXT: 3: 12
|
|
; RECOUNT-NEXT: 1: _Z8funcLeafi:500853
|
|
; RECOUNT-NEXT: 0: 15
|
|
; RECOUNT-NEXT: 1: 15
|
|
; RECOUNT-NEXT: 3: 74946
|
|
; RECOUNT-NEXT: 4: 74941 _Z3fibi:82359
|
|
; RECOUNT-NEXT: 10: 23324
|
|
; RECOUNT-NEXT: 11: 23327 _Z3fibi:25228
|
|
; RECOUNT-NEXT: 15: 11
|
|
; RECOUNT-NEXT: !Attributes: 6
|
|
; RECOUNT-NEXT: !Attributes: 6
|
|
; RECOUNT-NEXT:_Z8funcLeafi:1968152:31
|
|
; RECOUNT-NEXT: 0: 21
|
|
; RECOUNT-NEXT: 1: 21
|
|
; RECOUNT-NEXT: 3: 362830
|
|
; RECOUNT-NEXT: 4: 362805 _Z3fibi:397967
|
|
; RECOUNT-NEXT: 10: 23324
|
|
; RECOUNT-NEXT: 11: 23327 _Z3fibi:25228
|
|
; RECOUNT-NEXT: 15: 34
|
|
; RECOUNT-NEXT: !Attributes: 2
|
|
; RECOUNT-NEXT:_Z5funcAi:1467388:11
|
|
; RECOUNT-NEXT: 0: 10
|
|
; RECOUNT-NEXT: 3: 24
|
|
; RECOUNT-NEXT: 1: _Z8funcLeafi:1467299
|
|
; RECOUNT-NEXT: 0: 6
|
|
; RECOUNT-NEXT: 1: 6
|
|
; RECOUNT-NEXT: 3: 287884
|
|
; RECOUNT-NEXT: 4: 287864 _Z3fibi:315608
|
|
; RECOUNT-NEXT: 15: 23
|
|
; RECOUNT-NEXT: !Attributes: 6
|
|
; RECOUNT-NEXT: !Attributes: 2
|
|
; RECOUNT-NEXT:_Z5funcBi:501194:32
|
|
; RECOUNT-NEXT: 0: 32
|
|
; RECOUNT-NEXT: 1: 13
|
|
; RECOUNT-NEXT: 3: 12
|
|
; RECOUNT-NEXT: 1: _Z8funcLeafi:500853
|
|
; RECOUNT-NEXT: 0: 15
|
|
; RECOUNT-NEXT: 1: 15
|
|
; RECOUNT-NEXT: 3: 74946
|
|
; RECOUNT-NEXT: 4: 74941 _Z3fibi:82359
|
|
; RECOUNT-NEXT: 10: 23324
|
|
; RECOUNT-NEXT: 11: 23327 _Z3fibi:25228
|
|
; RECOUNT-NEXT: 15: 11
|
|
; RECOUNT-NEXT: !Attributes: 6
|
|
|
|
; PROBE:main:1968621:12
|
|
; PROBE-NEXT: 2: 24
|
|
; PROBE-NEXT: 3: 17 _Z5funcAi:7
|
|
; PROBE-NEXT: 3.1: 10 _Z5funcBi:11
|
|
; PROBE-NEXT: 3: _Z5funcAi:1467388
|
|
; PROBE-NEXT: 0: 10
|
|
; PROBE-NEXT: 3: 24
|
|
; PROBE-NEXT: 1: _Z8funcLeafi:1467299
|
|
; PROBE-NEXT: 0: 6
|
|
; PROBE-NEXT: 1: 6
|
|
; PROBE-NEXT: 3: 287884
|
|
; PROBE-NEXT: 4: 287864 _Z3fibi:315608
|
|
; PROBE-NEXT: 15: 23
|
|
; PROBE-NEXT: !CFGChecksum: 281479271677951
|
|
; PROBE-NEXT: !Attributes: 2
|
|
; PROBE-NEXT: !CFGChecksum: 844530426352218
|
|
; PROBE-NEXT: !Attributes: 2
|
|
; PROBE-NEXT: 3.1: _Z5funcBi:500954
|
|
; PROBE-NEXT: 0: 19
|
|
; PROBE-NEXT: 3: 12
|
|
; PROBE-NEXT: 1: _Z8funcLeafi:500853
|
|
; PROBE-NEXT: 0: 15
|
|
; PROBE-NEXT: 1: 15
|
|
; PROBE-NEXT: 3: 74946
|
|
; PROBE-NEXT: 4: 74941 _Z3fibi:82359
|
|
; PROBE-NEXT: 10: 23324
|
|
; PROBE-NEXT: 11: 23327 _Z3fibi:25228
|
|
; PROBE-NEXT: 15: 11
|
|
; PROBE-NEXT: !CFGChecksum: 281479271677951
|
|
; PROBE-NEXT: !Attributes: 2
|
|
; PROBE-NEXT: !CFGChecksum: 563022570642068
|
|
; PROBE-NEXT: !Attributes: 2
|
|
; PROBE-NEXT: !CFGChecksum: 563125815542069
|
|
; PROBE-NEXT:_Z5funcBi:240:13
|
|
; PROBE-NEXT: 0: 13
|
|
; PROBE-NEXT: 1: 13
|
|
; PROBE-NEXT: !CFGChecksum: 563022570642068
|
|
|
|
|
|
; PREINLINE: ProfileSummarySection {{.*}} Flags: {preInlined}
|
|
|
|
|
|
; SUMMARY: Total functions: 4
|
|
; SUMMARY-NEXT: Maximum function count: 32
|
|
; SUMMARY-NEXT: Maximum block count: 362830
|
|
; SUMMARY-NEXT: Total number of blocks: 16
|
|
; SUMMARY-NEXT: Total count: 772562
|
|
; SUMMARY-NEXT: Detailed summary:
|
|
; SUMMARY-NEXT: 1 blocks with count >= 362830 account for 1 percentage of the total counts.
|
|
; SUMMARY-NEXT: 1 blocks with count >= 362830 account for 10 percentage of the total counts.
|
|
; SUMMARY-NEXT: 1 blocks with count >= 362830 account for 20 percentage of the total counts.
|
|
; SUMMARY-NEXT: 1 blocks with count >= 362830 account for 30 percentage of the total counts.
|
|
; SUMMARY-NEXT: 1 blocks with count >= 362830 account for 40 percentage of the total counts.
|
|
; SUMMARY-NEXT: 2 blocks with count >= 362805 account for 50 percentage of the total counts.
|
|
; SUMMARY-NEXT: 2 blocks with count >= 362805 account for 60 percentage of the total counts.
|
|
; SUMMARY-NEXT: 2 blocks with count >= 362805 account for 70 percentage of the total counts.
|
|
; SUMMARY-NEXT: 2 blocks with count >= 362805 account for 80 percentage of the total counts.
|
|
; SUMMARY-NEXT: 2 blocks with count >= 362805 account for 90 percentage of the total counts.
|
|
; SUMMARY-NEXT: 3 blocks with count >= 23327 account for 95 percentage of the total counts.
|
|
; SUMMARY-NEXT: 4 blocks with count >= 23324 account for 99 percentage of the total counts.
|
|
; SUMMARY-NEXT: 4 blocks with count >= 23324 account for 99.9 percentage of the total counts.
|
|
; SUMMARY-NEXT: 11 blocks with count >= 24 account for 99.99 percentage of the total counts.
|
|
; SUMMARY-NEXT: 16 blocks with count >= 10 account for 99.999 percentage of the total counts.
|
|
; SUMMARY-NEXT: 16 blocks with count >= 10 account for 99.9999 percentage of the total counts.
|
|
|
|
|
|
; SUMMARY-NEST: Total functions: 4
|
|
; SUMMARY-NEST-NEXT: Maximum function count: 32
|
|
; SUMMARY-NEST-NEXT: Maximum block count: 362830
|
|
; SUMMARY-NEST-NEXT: Total number of blocks: 15
|
|
; SUMMARY-NEST-NEXT: Total count: 772504
|
|
; SUMMARY-NEST-NEXT: Detailed summary:
|
|
; SUMMARY-NEST-NEXT: 1 blocks with count >= 362830 account for 1 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 1 blocks with count >= 362830 account for 10 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 1 blocks with count >= 362830 account for 20 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 1 blocks with count >= 362830 account for 30 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 1 blocks with count >= 362830 account for 40 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 2 blocks with count >= 362805 account for 50 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 2 blocks with count >= 362805 account for 60 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 2 blocks with count >= 362805 account for 70 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 2 blocks with count >= 362805 account for 80 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 2 blocks with count >= 362805 account for 90 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 3 blocks with count >= 23327 account for 95 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 4 blocks with count >= 23324 account for 99 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 4 blocks with count >= 23324 account for 99.9 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 10 blocks with count >= 21 account for 99.99 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 15 blocks with count >= 10 account for 99.999 percentage of the total counts.
|
|
; SUMMARY-NEST-NEXT: 15 blocks with count >= 10 account for 99.9999 percentage of the total counts.
|