Update git submodules
[LibreOffice.git] / bin / find-most-repeated-functions.py
blob767f802406fbfac599dfed9f08f63a87483b250d
1 #!/usr/bin/python
3 # Find the top 100 functions that are repeated in multiple .o files, so we can out-of-line those
7 import subprocess
8 from collections import defaultdict
10 # the odd bash construction here is because some of the .o files returned by find are not object files
11 # and I don't want xargs to stop when it hits an error
12 a = subprocess.Popen("find instdir/program/ -name *.so | xargs echo nm --radix=d --size-sort --demangle | bash", stdout=subprocess.PIPE, shell=True)
14 #xargs sh -c "somecommand || true"
16 nameDict = defaultdict(int)
17 with a.stdout as txt:
18 for line in txt:
19 line = line.strip()
20 idx1 = line.find(" ")
21 idx2 = line.find(" ", idx1 + 1)
22 name = line[idx2:]
23 nameDict[name] += 1
25 sizeDict = defaultdict(set)
26 for k, v in nameDict.iteritems():
27 sizeDict[v].add(k)
29 cnt = 0
30 for k in sorted(list(sizeDict), reverse=True):
31 print k
32 for v in sizeDict[k]:
33 print v
34 cnt += 1
35 if cnt > 100 : break
37 #first = sorted(list(sizeDict))[-1]
38 #print first
41 #include/vcl/ITiledRenderable.hxx
42 # why is gaLOKPointerMap declared inside this header?