Linux / Tools
Duplication

Places in code with 6 or more lines that are exactly the same.

Intro
  • For duplication, we look at places in code where there are 6 or more lines of code that are exactly the same.
  • Before duplication is calculated, the code is cleaned to remove empty lines, comments, and frequently duplicated constructs such as imports.
  • You should aim at having as little as possible (<5%) of duplicated code as high-level of duplication can lead to maintenance difficulties, poor factoring, and logical contradictions.
Learn more...
Duplication Overall
  • 12% duplication:
    • 411,688 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 51,095 duplicated lines
  • 21,282 duplicates
system12% (51,095 lines)
Duplication per Extension
c12% (40,642 lines)
h11% (4,939 lines)
po62% (2,480 lines)
py7% (1,444 lines)
S14% (643 lines)
pl10% (471 lines)
y16% (298 lines)
cfg42% (129 lines)
l2% (19 lines)
pm10% (18 lines)
boot17% (12 lines)
Duplication per Component (primary)
testing21% (33,480 lines)
perf5% (7,896 lines)
power14% (4,079 lines)
lib4% (1,722 lines)
bpf6% (883 lines)
include7% (784 lines)
tracing17% (725 lines)
usb14% (611 lines)
hv11% (149 lines)
iio9% (147 lines)
arch3% (144 lines)
objtool2% (120 lines)
edid23% (105 lines)
build19% (94 lines)
firewire3% (40 lines)
virtio2% (36 lines)
gpio4% (28 lines)
thermal1% (16 lines)
wmi10% (14 lines)
vm<1% (12 lines)
bootconfig2% (10 lines)
accounting0% (0 lines)
pci0% (0 lines)
firmware0% (0 lines)
cgroup0% (0 lines)
memory-model0% (0 lines)
leds0% (0 lines)
spi0% (0 lines)
rcu0% (0 lines)
pcmcia0% (0 lines)
io_uring0% (0 lines)
counter0% (0 lines)
laptop0% (0 lines)

Duplication Between Components (50+ lines)

G lib lib perf perf lib--perf 679 testing testing lib--testing 142 bpf bpf bpf--lib 132 bpf--perf 59 bpf--testing 142 include include include--testing 93 power power power--testing 64

Download: SVG DOT (open online Graphviz editor)

Open 3D force graph...

Show more details on duplication between components...
Longest Duplicates
The list of 50 longest duplicates.
See data for all 21,282 duplicates...
Size#FoldersFilesLinesCode
159 x 2 power/cpupower/po
power/cpupower/po
16:214 (19%)
14:212 (19%)
view
157 x 2 power/cpupower/po
power/cpupower/po
18:214 (19%)
18:214 (19%)
view
157 x 2 power/cpupower/po
power/cpupower/po
18:214 (19%)
16:212 (19%)
view
156 x 2 power/cpupower/po
power/cpupower/po
23:217 (19%)
20:214 (19%)
view
156 x 2 power/cpupower/po
power/cpupower/po
23:217 (19%)
20:214 (19%)
view
156 x 2 power/cpupower/po
power/cpupower/po
23:217 (19%)
18:212 (19%)
view
142 x 2 lib/bpf
perf/util
24:239 (100%)
24:239 (100%)
view
89 x 2 lib/bpf
perf/util
15:193 (100%)
15:193 (100%)
view
81 x 2 usb/ffs-aio-example/multibuff/device_app
usb/ffs-aio-example/simple/device_app
56:139 (33%)
54:137 (34%)
view
73 x 2 usb/ffs-aio-example/multibuff/host_app
usb/ffs-aio-example/simple/host_app
48:158 (85%)
48:158 (82%)
view
63 x 2 power/cpupower/po
power/cpupower/po
667:742 (7%)
669:744 (7%)
view
62 x 2 power/cpupower/po
power/cpupower/po
659:733 (7%)
669:743 (7%)
view
62 x 2 power/cpupower/po
power/cpupower/po
659:733 (7%)
669:743 (7%)
view
62 x 2 testing/selftests/rseq
testing/selftests/rseq
615:688 (10%)
737:810 (10%)
view
62 x 2 power/cpupower/po
power/cpupower/po
659:733 (7%)
667:741 (7%)
view
62 x 2 power/cpupower/po
power/cpupower/po
659:733 (7%)
659:733 (7%)
view
62 x 2 power/cpupower/po
power/cpupower/po
659:733 (7%)
667:741 (7%)
view
62 x 2 testing/selftests/rseq
testing/selftests/rseq
623:696 (10%)
748:821 (10%)
view
58 x 2 testing/selftests/bpf/progs
testing/selftests/bpf/progs
26:97 (58%)
32:103 (53%)
view
54 x 2 testing/selftests/rseq
testing/selftests/rseq
1112:1174 (5%)
1225:1287 (5%)
view
52 x 2 power/cpupower/po
power/cpupower/po
845:908 (6%)
845:908 (6%)
view
49 x 2 testing/selftests/arm64/fp
testing/selftests/arm64/fp
151:210 (18%)
303:362 (11%)
view
48 x 2 testing/selftests/bpf/prog_tests
testing/selftests/bpf/prog_tests
233:293 (8%)
587:647 (8%)
view
47 x 2 perf/scripts/python
perf/scripts/python
496:547 (5%)
334:385 (7%)
view
44 x 2 testing/selftests/bpf/prog_tests
testing/selftests/bpf/prog_tests
36:98 (58%)
78:140 (43%)
view
43 x 2 power/cpupower/po
power/cpupower/po
736:787 (5%)
745:796 (5%)
view
43 x 2 testing/ktest
testing/ktest
256:315 (8%)
3158:3217 (1%)
view
43 x 2 power/cpupower/po
power/cpupower/po
736:787 (5%)
736:787 (5%)
view
43 x 2 power/cpupower/po
power/cpupower/po
736:787 (5%)
745:796 (5%)
view
43 x 2 power/cpupower/po
power/cpupower/po
736:787 (5%)
747:798 (5%)
view
43 x 2 power/cpupower/po
power/cpupower/po
736:787 (5%)
747:798 (5%)
view
43 x 2 power/cpupower/po
power/cpupower/po
745:796 (5%)
747:798 (5%)
view
42 x 2 testing/selftests/timens
testing/selftests/timens
66:125 (56%)
73:132 (53%)
view
41 x 2 testing/selftests/bpf/verifier
testing/selftests/bpf/verifier
1258:1317 (2%)
1330:1389 (2%)
view
38 x 2 testing/selftests/bpf/verifier
testing/selftests/bpf/verifier
1471:1524 (2%)
1540:1593 (2%)
view
38 x 2 testing/selftests/bpf/prog_tests
testing/selftests/bpf/prog_tests
4783:4840 (<1%)
4848:4907 (<1%)
view
37 x 2 testing/selftests/arm64/fp
testing/selftests/arm64/fp
213:259 (14%)
365:411 (8%)
view
37 x 2 testing/selftests/net/mptcp
testing/selftests/net/mptcp
108:162 (10%)
156:210 (7%)
view
35 x 2 testing/selftests/rseq
testing/selftests/rseq
377:419 (6%)
451:493 (6%)
view
35 x 2 testing/selftests/net/mptcp
testing/selftests/net/mptcp
51:106 (9%)
99:154 (7%)
view
35 x 2 testing/selftests/rseq
testing/selftests/rseq
578:621 (6%)
702:745 (6%)
view
35 x 2 testing/selftests/rseq
testing/selftests/rseq
376:418 (6%)
452:494 (6%)
view
35 x 2 testing/selftests/net
testing/selftests/net
32:77 (21%)
28:73 (20%)
view
34 x 2 power/cpupower/lib
power/cpupower/lib
346:388 (6%)
402:444 (6%)
view
34 x 2 testing/selftests/rseq
testing/selftests/rseq
1069:1111 (3%)
1181:1223 (3%)
view
33 x 2 testing/selftests/bpf/prog_tests
testing/selftests/bpf/prog_tests
328:372 (5%)
416:460 (5%)
view
33 x 2 testing/selftests/bpf/progs
testing/selftests/bpf/progs
8:71 (20%)
8:71 (18%)
view
32 x 2 power/cpupower/lib
power/cpupower/utils/helpers
87:130 (15%)
158:201 (13%)
view
32 x 2 testing/selftests/bpf/verifier
testing/selftests/bpf/verifier
3:39 (17%)
63:99 (17%)
view
32 x 2 testing/selftests/rseq
testing/selftests/rseq
573:613 (5%)
694:734 (5%)
view
Duplicated Units
The list of top 50 duplicated units.
See data for all 128 unit duplicates...
Size#FoldersFilesLinesCode
68 x 2 usb/ffs-aio-example/simple/host_app
usb/ffs-aio-example/multibuff/host_app
59:139 
59:139 
view
58 x 2 testing/selftests/rseq
testing/selftests/rseq
173:235 
751:813 
view
51 x 2 testing/selftests/rseq
testing/selftests/rseq
113:167 
691:745 
view
42 x 2 testing/selftests/timens
testing/selftests/timens
71:126 
78:133 
view
42 x 2 lib/bpf
perf/util
154:204 
154:204 
view
39 x 2 testing/selftests/rseq
testing/selftests/rseq
237:280 
815:858 
view
36 x 2 testing/selftests/net
testing/selftests/net
30:71 
34:75 
view
33 x 2 testing/ktest
testing/ktest
110:145 
597:632 
view
30 x 2 testing/selftests/bpf/progs
testing/selftests/bpf/progs
32:64 
26:58 
view
29 x 2 power/cpupower/utils/helpers
power/cpupower/lib
47:87 
67:107 
view
29 x 2 testing/selftests/kvm/include/x86_64
testing/selftests/kvm/include/x86_64
1033:1064 
1069:1100 
view
25 x 2 testing/selftests/net
testing/selftests/net
281:307 
294:320 
view
25 x 2 bpf/bpftool
bpf/bpftool
189:217 
219:247 
view
23 x 2 testing/selftests/net/mptcp
testing/selftests/net/mptcp
182:211 
134:163 
view
22 x 2 lib/bpf
perf/util
101:128 
101:128 
view
22 x 2 perf/util/scripting-engines
perf/util/scripting-engines
76:102 
134:160 
view
21 x 2 usb/ffs-aio-example/simple/device_app
usb/ffs-aio-example/multibuff/device_app
141:162 
153:174 
view
21 x 2 bpf/bpftool
bpf/bpftool
163:187 
249:273 
view
20 x 2 power/cpupower/utils/helpers
power/cpupower/lib
157:182 
86:111 
view
20 x 2 testing/selftests/net
testing/selftests/net
61:82 
115:136 
view
19 x 2 lib/subcmd
perf/util
84:104 
8:28 
view
19 x 2 lib/bpf
perf/util
130:152 
130:152 
view
19 x 2 perf/arch/powerpc/util
perf/arch/arm64/util
90:114 
57:81 
view
18 x 2 power/cpupower/utils/helpers
power/cpupower/lib
354:376 
284:306 
view
17 x 2 testing/selftests/vm
testing/selftests/memfd
1559:1578 
19:38 
view
17 x 2 testing/selftests/bpf/progs
testing/selftests/bpf/progs
66:85 
60:79 
view
16 x 2 lib/bpf
perf/util
220:240 
220:240 
view
16 x 5 build/feature
build/feature
build/feature
build/feature
build/feature
5:28 
5:28 
5:27 
5:28 
5:28 
view
15 x 2 power/cpupower/utils/helpers
testing/selftests/vm
18:37 
121:140 
view
15 x 2 power/cpupower/lib
power/x86/x86_energy_perf_policy
17:36 
727:746 
view
15 x 2 testing/selftests/powerpc/pmu
testing/selftests/powerpc/pmu
79:97 
74:92 
view
15 x 2 testing/selftests/uevent
testing/selftests/filesystems
54:74 
62:80 
view
15 x 2 testing/selftests/vm
testing/selftests/vm
25:44 
208:227 
view
14 x 2 testing/selftests/net
testing/selftests/net
319:335 
528:544 
view
14 x 2 testing/selftests/bpf/progs
testing/selftests/bpf/progs
87:104 
81:98 
view
14 x 2 perf/bench
perf/bench
97:116 
123:142 
view
13 x 2 testing/selftests/net/mptcp
testing/selftests/net/mptcp
671:685 
548:562 
view
13 x 2 testing/selftests/clone3
testing/selftests/pidfd
27:44 
71:88 
view
13 x 2 testing/selftests/membarrier
testing/selftests/membarrier
119:134 
176:191 
view
12 x 2 testing/selftests/powerpc/ptrace
testing/selftests/powerpc/ptrace
39:53 
56:70 
view
12 x 2 testing/ktest
testing/ktest
274:290 
3176:3192 
view
12 x 2 perf/util
perf/util
996:1009 
3273:3286 
view
12 x 2 perf/arch/x86/util
perf/arch/x86/util
1103:1118 
347:362 
view
12 x 2 perf/scripts/python
perf/scripts/python
0:0 
0:0 
view
12 x 5 perf/scripts/perl
perf/scripts/perl
perf/scripts/perl
perf/scripts/perl
perf/scripts/perl
81:96 
84:99 
180:195 
75:90 
161:176 
view
11 x 2 power/cpupower/utils/helpers
power/cpupower/lib
103:116 
29:42 
view
11 x 3 testing/selftests/net/mptcp
testing/selftests/net/mptcp
testing/selftests/net/mptcp
121:134 
73:86 
165:178 
view
11 x 2 testing/selftests/net/mptcp
testing/selftests/net/mptcp
520:534 
1010:1024 
view
11 x 2 testing/selftests/x86
testing/selftests/x86
55:66 
55:66 
view
11 x 2 testing/selftests/bpf/prog_tests
testing/selftests/bpf/prog_tests
166:181 
9:24 
view