xref: /llvm-project/llvm/test/tools/llvm-profdata/sample-overlap.test (revision e68fafa49f91c5e775605cbbde0815fc4809bf46)
1; RUN: llvm-profdata overlap --sample %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-0.proftext | FileCheck %s --check-prefix=OVERLAP0  --match-full-lines --strict-whitespace
2; OVERLAP0:Program level:
3; OVERLAP0:  Whole program profile similarity: 100.000%
4; OVERLAP0:  Whole program sample overlap: 100.000%
5; OVERLAP0:    percentage of samples unique in base profile: 0.000%
6; OVERLAP0:    percentage of samples unique in test profile: 0.000%
7; OVERLAP0:    total samples in base profile: 13943
8; OVERLAP0:    total samples in test profile: 13943
9; OVERLAP0:  Function overlap: 100.000%
10; OVERLAP0:    overlap functions: 4
11; OVERLAP0:    functions unique in base profile: 0
12; OVERLAP0:    functions unique in test profile: 0
13; OVERLAP0:  Hot-function overlap: 100.000%
14; OVERLAP0:    overlap hot functions: 4
15; OVERLAP0:    hot functions unique in base profile: 0
16; OVERLAP0:    hot functions unique in test profile: 0
17; OVERLAP0:  Hot-block overlap: 100.000%
18; OVERLAP0:    overlap hot blocks: 12
19; OVERLAP0:    hot blocks unique in base profile: 0
20; OVERLAP0:    hot blocks unique in test profile: 0
21
22; RUN: llvm-profdata overlap --sample %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-1.proftext | FileCheck %s --check-prefix=OVERLAP1  --match-full-lines --strict-whitespace
23; OVERLAP1:Program level:
24; OVERLAP1:  Whole program profile similarity: 100.000%
25; OVERLAP1:  Whole program sample overlap: 10.000%
26; OVERLAP1:    percentage of samples unique in base profile: 0.000%
27; OVERLAP1:    percentage of samples unique in test profile: 0.000%
28; OVERLAP1:    total samples in base profile: 13943
29; OVERLAP1:    total samples in test profile: 139430
30; OVERLAP1:  Function overlap: 100.000%
31; OVERLAP1:    overlap functions: 4
32; OVERLAP1:    functions unique in base profile: 0
33; OVERLAP1:    functions unique in test profile: 0
34; OVERLAP1:  Hot-function overlap: 100.000%
35; OVERLAP1:    overlap hot functions: 4
36; OVERLAP1:    hot functions unique in base profile: 0
37; OVERLAP1:    hot functions unique in test profile: 0
38; OVERLAP1:  Hot-block overlap: 100.000%
39; OVERLAP1:    overlap hot blocks: 12
40; OVERLAP1:    hot blocks unique in base profile: 0
41; OVERLAP1:    hot blocks unique in test profile: 0
42
43; RUN: llvm-profdata overlap --sample --similarity-cutoff=800000 %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-2.proftext | FileCheck %s --check-prefix=OVERLAP2  --match-full-lines --strict-whitespace
44; OVERLAP2:Program level:
45; OVERLAP2:  Whole program profile similarity: 63.720%
46; OVERLAP2:  Whole program sample overlap: 29.649%
47; OVERLAP2:    percentage of samples unique in base profile: 0.000%
48; OVERLAP2:    percentage of samples unique in test profile: 0.000%
49; OVERLAP2:    total samples in base profile: 13943
50; OVERLAP2:    total samples in test profile: 4134
51; OVERLAP2:  Function overlap: 100.000%
52; OVERLAP2:    overlap functions: 4
53; OVERLAP2:    functions unique in base profile: 0
54; OVERLAP2:    functions unique in test profile: 0
55; OVERLAP2:  Hot-function overlap: 100.000%
56; OVERLAP2:    overlap hot functions: 4
57; OVERLAP2:    hot functions unique in base profile: 0
58; OVERLAP2:    hot functions unique in test profile: 0
59; OVERLAP2:  Hot-block overlap: 100.000%
60; OVERLAP2:    overlap hot blocks: 12
61; OVERLAP2:    hot blocks unique in base profile: 0
62; OVERLAP2:    hot blocks unique in test profile: 0
63; OVERLAP2:Function-level details:
64; OVERLAP2:Base weight    Test weight    Similarity   Overlap   Base unique   Test unique   Base samples   Test samples   Function name
65; OVERLAP2:78.15%         26.29%         48.09%       9.98%     0.00%         0.00%         10896          1087           main
66; OVERLAP2:10.31%         34.76%         75.55%       100.00%   0.00%         0.00%         1437           1437           _Z3bari
67
68; RUN: llvm-profdata overlap --sample --value-cutoff=1000 %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-3.proftext | FileCheck %s --check-prefix=OVERLAP3  --match-full-lines --strict-whitespace
69; OVERLAP3:Program level:
70; OVERLAP3:  Whole program profile similarity: 14.301%
71; OVERLAP3:  Whole program sample overlap: 6.040%
72; OVERLAP3:    percentage of samples unique in base profile: 82.522%
73; OVERLAP3:    percentage of samples unique in test profile: 88.216%
74; OVERLAP3:    total samples in base profile: 13943
75; OVERLAP3:    total samples in test profile: 13043
76; OVERLAP3:  Function overlap: 33.333%
77; OVERLAP3:    overlap functions: 2
78; OVERLAP3:    functions unique in base profile: 2
79; OVERLAP3:    functions unique in test profile: 2
80; OVERLAP3:  Hot-function overlap: 16.667%
81; OVERLAP3:    overlap hot functions: 1
82; OVERLAP3:    hot functions unique in base profile: 3
83; OVERLAP3:    hot functions unique in test profile: 2
84; OVERLAP3:  Hot-block overlap: 4.545%
85; OVERLAP3:    overlap hot blocks: 1
86; OVERLAP3:    hot blocks unique in base profile: 11
87; OVERLAP3:    hot blocks unique in test profile: 10
88; OVERLAP3:Function-level details:
89; OVERLAP3:Base weight    Test weight    Similarity   Overlap   Base unique   Test unique   Base samples   Test samples   Function name
90; OVERLAP3:10.31%         11.02%         99.29%       100.00%   0.00%         0.00%         1437           1437           _Z3bari
91; OVERLAP3:0.00%          83.54%         0.00%        0.00%     0.00%         100.00%       0              10896          main2
92
93; RUN: llvm-profdata overlap --sample --function=main %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-4.proftext | FileCheck %s --check-prefix=OVERLAP4  --match-full-lines --strict-whitespace
94; OVERLAP4:Program level:
95; OVERLAP4:  Whole program profile similarity: 17.302%
96; OVERLAP4:  Whole program sample overlap: 8.134%
97; OVERLAP4:    percentage of samples unique in base profile: 73.542%
98; OVERLAP4:    percentage of samples unique in test profile: 82.209%
99; OVERLAP4:    total samples in base profile: 13943
100; OVERLAP4:    total samples in test profile: 10213
101; OVERLAP4:  Function overlap: 100.000%
102; OVERLAP4:    overlap functions: 4
103; OVERLAP4:    functions unique in base profile: 0
104; OVERLAP4:    functions unique in test profile: 0
105; OVERLAP4:  Hot-function overlap: 100.000%
106; OVERLAP4:    overlap hot functions: 4
107; OVERLAP4:    hot functions unique in base profile: 0
108; OVERLAP4:    hot functions unique in test profile: 0
109; OVERLAP4:  Hot-block overlap: 14.286%
110; OVERLAP4:    overlap hot blocks: 3
111; OVERLAP4:    hot blocks unique in base profile: 9
112; OVERLAP4:    hot blocks unique in test profile: 9
113; OVERLAP4:Function-level details:
114; OVERLAP4:Base weight    Test weight    Similarity   Overlap   Base unique   Test unique   Base samples   Test samples   Function name
115; OVERLAP4:78.15%         70.17%         23.33%       11.18%    66.14%        74.64%        10896          7166           main
116
117; RUN: llvm-profdata overlap --sample %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-5.proftext | FileCheck %s --check-prefix=OVERLAP5  --match-full-lines --strict-whitespace
118; OVERLAP5:Sum of sample counts for profile {{.*}}/Inputs/sample-overlap-5.proftext is 0.
119
120
121; RUN: llvm-profdata overlap --sample %S/Inputs/cs-sample.proftext %S/Inputs/cs-sample.proftext | FileCheck %s --check-prefix=CS  --match-full-lines --strict-whitespace
122; CS:Program level:
123; CS:  Whole program profile similarity: 100.000%
124; CS:  Whole program sample overlap: 100.000%
125; CS:    percentage of samples unique in base profile: 0.000%
126; CS:    percentage of samples unique in test profile: 0.000%
127; CS:    total samples in base profile: 772562
128; CS:    total samples in test profile: 772562
129; CS:  Function overlap: 100.000%
130; CS:    overlap functions: 8
131; CS:    functions unique in base profile: 0
132; CS:    functions unique in test profile: 0
133; CS:  Hot-function overlap: 100.000%
134; CS:    overlap hot functions: 2
135; CS:    hot functions unique in base profile: 0
136; CS:    hot functions unique in test profile: 0
137; CS:  Hot-block overlap: 100.000%
138; CS:    overlap hot blocks: 6
139; CS:    hot blocks unique in base profile: 0
140; CS:    hot blocks unique in test profile: 0
141