Skip to content

Commit 9364c47

Browse files
committed
analyze_code_size.py sort the categories by size
1 parent 7e8ce6c commit 9364c47

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

utils/analyze_code_size.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,20 @@ def print_summary(self, section_size):
207207
names.extend([c[0] for c in self.category_mangled_matching])
208208
names.append('Unknown')
209209
total_size = 0
210+
sorted_categories = []
210211
for name in names:
211212
category = self.categories.get(name)
212213
size = 0
213214
if category:
214215
size = category.size
215216
total_size += size
216217
if size > 0:
217-
print("%60s: %8d (%6.2f%%)" %
218-
(name, size, (float(size) * 100) / section_size))
218+
sorted_categories.append(
219+
(name, size, (float(size) * 100) / section_size))
220+
sorted_categories.sort(key = lambda entry : entry [1], reverse=True)
221+
for category in sorted_categories:
222+
print("%60s: %8d (%6.2f%%)" %
223+
(category[0], category[1], category[2]))
219224
print("%60s: %8d (%6.2f%%)" % ('TOTAL', total_size, float(100)))
220225

221226
def uncatorizedSymbols(self):

0 commit comments

Comments
 (0)