1# RUN: llvm-profdata merge -sparse=true %s -o %t.profdata
2
3# RUN: llvm-profdata merge -sparse=false %s -o %t.profdata.dense
4
5# RUN: llvm-profdata show %t.profdata --function function_count_only --counts | FileCheck %s -check-prefix=FUNC_COUNT_ONLY
6function_count_only
70
81
997531
10# FUNC_COUNT_ONLY:      Hash: 0x{{0+$}}
11# FUNC_COUNT_ONLY-NEXT: Counters: 1
12# FUNC_COUNT_ONLY-NEXT: Function count: 97531
13# FUNC_COUNT_ONLY-NEXT: Block counts: []
14
15# RUN: llvm-profdata show %t.profdata.dense --function "name with spaces" --counts | FileCheck %s -check-prefix=SPACES
16# RUN: llvm-profdata show %t.profdata --function "name with spaces" --counts | FileCheck %s --check-prefix=SPARSE_SPACES
17name with spaces
181024
192
200
210
22# SPACES:      Hash: 0x{{0+}}400
23# SPACES-NEXT: Counters: 2
24# SPACES-NEXT: Function count: 0
25# SPACES-NEXT: Block counts: [0]
26# SPARSE_SPACES-NOT: Function count: 0
27
28# RUN: llvm-profdata show %t.profdata --function large_numbers --counts | FileCheck %s -check-prefix=LARGENUM
29large_numbers
304611686018427387903
316
322305843009213693952
331152921504606846976
34576460752303423488
35288230376151711744
36144115188075855872
3772057594037927936
38# LARGENUM:      Hash: 0x3fffffffffffffff
39# LARGENUM-NEXT: Counters: 6
40# LARGENUM-NEXT: Function count: 2305843009213693952
41# LARGENUM-NEXT: Block counts: [1152921504606846976, 576460752303423488, 288230376151711744, 144115188075855872, 72057594037927936]
42
43# RUN: llvm-profdata show %t.profdata.dense --function hex_hash | FileCheck %s -check-prefix=HEX-HASH
44hex_hash
450x1234
461
470
48# HEX-HASH: Hash: 0x0000000000001234
49# HEX-HASH-NEXT: Counters: 1
50
51# RUN: llvm-profdata show %t.profdata --function NOSUCHFUNC | FileCheck %s -check-prefix=NOSUCHFUNC
52# NOSUCHFUNC-NOT: Counters:
53# NOSUCHFUNC: Functions shown: 0
54
55# RUN: llvm-profdata show %t.profdata --function _ | FileCheck %s -check-prefix=SOMEFUNCS
56# RUN: llvm-profdata show %t.profdata.dense --function _ | FileCheck %s -check-prefix=SOMEFUNCS_DENSE
57# SOMEFUNCS: Counters:
58# SOMEFUNCS-DAG: large_numbers:
59# SOMEFUNCS-DAG: function_count_only:
60# SOMEFUNCS: Functions shown: 2
61# SOMEFUNCS_DENSE: Functions shown: 3
62
63# RUN: llvm-profdata show %t.profdata.dense | FileCheck %s -check-prefix=SUMMARY
64# SUMMARY-NOT: Counters:
65# SUMMARY-NOT: Functions shown:
66# SUMMARY: Total functions: 4
67# SUMMARY: Maximum function count: 2305843009213693952
68# SUMMARY: Maximum internal block count: 1152921504606846976
69
70# RUN: llvm-profdata show --detailed-summary %t.profdata.dense | FileCheck %s -check-prefix=DETAILED-SUMMARY
71# DETAILED-SUMMARY: Total number of blocks: 10
72# DETAILED-SUMMARY: Total count: 4539628424389557499
73# DETAILED-SUMMARY: Detailed summary:
74# DETAILED-SUMMARY: 3 blocks with count >= 576460752303423488 account for 80 percentage of the total counts.
75# DETAILED-SUMMARY: 4 blocks with count >= 288230376151711744 account for 90 percentage of the total counts.
76# DETAILED-SUMMARY: 4 blocks with count >= 288230376151711744 account for 95 percentage of the total counts.
77# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99 percentage of the total counts.
78# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99.9 percentage of the total counts.
79# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99.99 percentage of the total counts.
80# DETAILED-SUMMARY: 6 blocks with count >= 72057594037927936 account for 99.999 percentage of the total counts.
81
82# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs=600000 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-2
83# DETAILED-SUMMARY-2: 2 blocks with count >= 1152921504606846976 account for 60 percentage of the total counts.
84#
85# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs=600000,900000,999999 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-3
86# DETAILED-SUMMARY-3: 2 blocks with count >= 1152921504606846976 account for 60 percentage of the total counts.
87# DETAILED-SUMMARY-3: 4 blocks with count >= 288230376151711744 account for 90 percentage of the total counts.
88# DETAILED-SUMMARY-3: 6 blocks with count >= 72057594037927936 account for 99.9999 percentage of the total counts.
89