100dab228SVedant Kumar# RUN: llvm-profdata merge -sparse=true %s -o %t.profdata
245afa389SJustin Bogner
300dab228SVedant Kumar# RUN: llvm-profdata merge -sparse=false %s -o %t.profdata.dense
445afa389SJustin Bogner
545afa389SJustin Bogner# RUN: llvm-profdata show %t.profdata --function function_count_only --counts | FileCheck %s -check-prefix=FUNC_COUNT_ONLY
645afa389SJustin Bognerfunction_count_only
745afa389SJustin Bogner0
845afa389SJustin Bogner1
945afa389SJustin Bogner97531
1045afa389SJustin Bogner# FUNC_COUNT_ONLY:      Hash: 0x{{0+$}}
1145afa389SJustin Bogner# FUNC_COUNT_ONLY-NEXT: Counters: 1
1245afa389SJustin Bogner# FUNC_COUNT_ONLY-NEXT: Function count: 97531
1345afa389SJustin Bogner# FUNC_COUNT_ONLY-NEXT: Block counts: []
1445afa389SJustin Bogner
1500dab228SVedant Kumar# RUN: llvm-profdata show %t.profdata.dense --function "name with spaces" --counts | FileCheck %s -check-prefix=SPACES
1600dab228SVedant Kumar# RUN: llvm-profdata show %t.profdata --function "name with spaces" --counts | FileCheck %s --check-prefix=SPARSE_SPACES
1745afa389SJustin Bognername with spaces
1845afa389SJustin Bogner1024
1945afa389SJustin Bogner2
2045afa389SJustin Bogner0
2145afa389SJustin Bogner0
2245afa389SJustin Bogner# SPACES:      Hash: 0x{{0+}}400
2345afa389SJustin Bogner# SPACES-NEXT: Counters: 2
2445afa389SJustin Bogner# SPACES-NEXT: Function count: 0
2545afa389SJustin Bogner# SPACES-NEXT: Block counts: [0]
2600dab228SVedant Kumar# SPARSE_SPACES-NOT: Function count: 0
2745afa389SJustin Bogner
2845afa389SJustin Bogner# RUN: llvm-profdata show %t.profdata --function large_numbers --counts | FileCheck %s -check-prefix=LARGENUM
2945afa389SJustin Bognerlarge_numbers
3045afa389SJustin Bogner4611686018427387903
3145afa389SJustin Bogner6
3245afa389SJustin Bogner2305843009213693952
3345afa389SJustin Bogner1152921504606846976
3445afa389SJustin Bogner576460752303423488
3545afa389SJustin Bogner288230376151711744
3645afa389SJustin Bogner144115188075855872
3745afa389SJustin Bogner72057594037927936
3845afa389SJustin Bogner# LARGENUM:      Hash: 0x3fffffffffffffff
3945afa389SJustin Bogner# LARGENUM-NEXT: Counters: 6
4045afa389SJustin Bogner# LARGENUM-NEXT: Function count: 2305843009213693952
4145afa389SJustin Bogner# LARGENUM-NEXT: Block counts: [1152921504606846976, 576460752303423488, 288230376151711744, 144115188075855872, 72057594037927936]
4245afa389SJustin Bogner
4300dab228SVedant Kumar# RUN: llvm-profdata show %t.profdata.dense --function hex_hash | FileCheck %s -check-prefix=HEX-HASH
44f95ca075SJustin Bognerhex_hash
45f95ca075SJustin Bogner0x1234
46f95ca075SJustin Bogner1
47f95ca075SJustin Bogner0
48f95ca075SJustin Bogner# HEX-HASH: Hash: 0x0000000000001234
49f95ca075SJustin Bogner# HEX-HASH-NEXT: Counters: 1
50f95ca075SJustin Bogner
5145afa389SJustin Bogner# RUN: llvm-profdata show %t.profdata --function NOSUCHFUNC | FileCheck %s -check-prefix=NOSUCHFUNC
5245afa389SJustin Bogner# NOSUCHFUNC-NOT: Counters:
5345afa389SJustin Bogner# NOSUCHFUNC: Functions shown: 0
5445afa389SJustin Bogner
5545afa389SJustin Bogner# RUN: llvm-profdata show %t.profdata --function _ | FileCheck %s -check-prefix=SOMEFUNCS
5600dab228SVedant Kumar# RUN: llvm-profdata show %t.profdata.dense --function _ | FileCheck %s -check-prefix=SOMEFUNCS_DENSE
5745afa389SJustin Bogner# SOMEFUNCS: Counters:
581fd6d1fdSRichard Smith# SOMEFUNCS-DAG: large_numbers:
591fd6d1fdSRichard Smith# SOMEFUNCS-DAG: function_count_only:
6000dab228SVedant Kumar# SOMEFUNCS: Functions shown: 2
6100dab228SVedant Kumar# SOMEFUNCS_DENSE: Functions shown: 3
6245afa389SJustin Bogner
6300dab228SVedant Kumar# RUN: llvm-profdata show %t.profdata.dense | FileCheck %s -check-prefix=SUMMARY
6445afa389SJustin Bogner# SUMMARY-NOT: Counters:
6545afa389SJustin Bogner# SUMMARY-NOT: Functions shown:
66f95ca075SJustin Bogner# SUMMARY: Total functions: 4
6745afa389SJustin Bogner# SUMMARY: Maximum function count: 2305843009213693952
6845afa389SJustin Bogner# SUMMARY: Maximum internal block count: 1152921504606846976
69183ebbe0SEaswaran Raman
7000dab228SVedant Kumar# RUN: llvm-profdata show --detailed-summary %t.profdata.dense | FileCheck %s -check-prefix=DETAILED-SUMMARY
716ed987dfSXinliang David Li# DETAILED-SUMMARY: Total number of blocks: 10
726ed987dfSXinliang David Li# DETAILED-SUMMARY: Total count: 4539628424389557499
73*17fc6518SWenlei He# DETAILED-SUMMARY: Detailed summary:
746ed987dfSXinliang David Li# DETAILED-SUMMARY: 3 blocks with count >= 576460752303423488 account for 80 percentage of the total counts.
756ed987dfSXinliang David Li# DETAILED-SUMMARY: 4 blocks with count >= 288230376151711744 account for 90 percentage of the total counts.
766ed987dfSXinliang David Li# DETAILED-SUMMARY: 4 blocks with count >= 288230376151711744 account for 95 percentage of the total counts.
776ed987dfSXinliang David Li# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99 percentage of the total counts.
786ed987dfSXinliang David Li# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99.9 percentage of the total counts.
796ed987dfSXinliang David Li# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99.99 percentage of the total counts.
806ed987dfSXinliang David Li# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99.999 percentage of the total counts.
81183ebbe0SEaswaran Raman
82183ebbe0SEaswaran Raman# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs=600000 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-2
836ed987dfSXinliang David Li# DETAILED-SUMMARY-2: 2 blocks with count >= 1152921504606846976 account for 60 percentage of the total counts.
84183ebbe0SEaswaran Raman#
85183ebbe0SEaswaran Raman# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs=600000,900000,999999 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-3
866ed987dfSXinliang David Li# DETAILED-SUMMARY-3: 2 blocks with count >= 1152921504606846976 account for 60 percentage of the total counts.
876ed987dfSXinliang David Li# DETAILED-SUMMARY-3: 4 blocks with count >= 288230376151711744 account for 90 percentage of the total counts.
886ed987dfSXinliang David Li# DETAILED-SUMMARY-3: 6 blocks with count >= 72057594037927936 account for 99.9999 percentage of the total counts.
89