summaryrefslogtreecommitdiffstats
path: root/scripts/tiny/ksize.py
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2016-09-07 09:45:15 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-16 18:05:14 +0000
commit1cae998af9b45015c1c9701cb662b78e5cafe6ba (patch)
tree2bcc05f4dd88f1542b37b9761aa6b1013608ddf7 /scripts/tiny/ksize.py
parent9d0b36d9ffbc718d215ea31d9a5e5973f341f580 (diff)
downloadpoky-1cae998af9b45015c1c9701cb662b78e5cafe6ba.tar.gz
scripts: python3 fixes and new tool ksum
'ksum.py' generates a combined summary of vmlinux and module sizes for a built kernel, as a quick tool for comparing the overall effects of systemic tinification changes. Execute from the base directory of the kernel build you want to summarize. Setting the 'verbose' flag will display the sizes for each file included in the summary. (From OE-Core rev: 016b19c2589582d7ec3c8cac9cfa75a1edc716fe) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/tiny/ksize.py')
-rwxr-xr-xscripts/tiny/ksize.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/scripts/tiny/ksize.py b/scripts/tiny/ksize.py
index b9d2b192cf..ea1ca7ff23 100755
--- a/scripts/tiny/ksize.py
+++ b/scripts/tiny/ksize.py
@@ -41,7 +41,7 @@ def usage():
41class Sizes: 41class Sizes:
42 def __init__(self, glob): 42 def __init__(self, glob):
43 self.title = glob 43 self.title = glob
44 p = Popen("size -t " + glob, shell=True, stdout=PIPE, stderr=PIPE) 44 p = Popen("size -t " + str(glob), shell=True, stdout=PIPE, stderr=PIPE)
45 output = p.communicate()[0].splitlines() 45 output = p.communicate()[0].splitlines()
46 if len(output) > 2: 46 if len(output) > 2:
47 sizes = output[-1].split()[0:4] 47 sizes = output[-1].split()[0:4]
@@ -62,18 +62,18 @@ class Report:
62 r = Report(filename, title) 62 r = Report(filename, title)
63 path = os.path.dirname(filename) 63 path = os.path.dirname(filename)
64 64
65 p = Popen("ls " + path + "/*.o | grep -v built-in.o", 65 p = Popen("ls " + str(path) + "/*.o | grep -v built-in.o",
66 shell=True, stdout=PIPE, stderr=PIPE) 66 shell=True, stdout=PIPE, stderr=PIPE)
67 glob = ' '.join(p.communicate()[0].splitlines()) 67 glob = ' '.join(p.communicate()[0].splitlines())
68 oreport = Report(glob, path + "/*.o") 68 oreport = Report(glob, str(path) + "/*.o")
69 oreport.sizes.title = path + "/*.o" 69 oreport.sizes.title = str(path) + "/*.o"
70 r.parts.append(oreport) 70 r.parts.append(oreport)
71 71
72 if subglob: 72 if subglob:
73 p = Popen("ls " + subglob, shell=True, stdout=PIPE, stderr=PIPE) 73 p = Popen("ls " + subglob, shell=True, stdout=PIPE, stderr=PIPE)
74 for f in p.communicate()[0].splitlines(): 74 for f in p.communicate()[0].splitlines():
75 path = os.path.dirname(f) 75 path = os.path.dirname(f)
76 r.parts.append(Report.create(f, path, path + "/*/built-in.o")) 76 r.parts.append(Report.create(f, path, str(path) + "/*/built-in.o"))
77 r.parts.sort(reverse=True) 77 r.parts.sort(reverse=True)
78 78
79 for b in r.parts: 79 for b in r.parts:
@@ -116,6 +116,13 @@ class Report:
116 self.deltas["data"], self.deltas["bss"])) 116 self.deltas["data"], self.deltas["bss"]))
117 print("\n") 117 print("\n")
118 118
119 def __lt__(this, that):
120 if that is None:
121 return 1
122 if not isinstance(that, Report):
123 raise TypeError
124 return this.sizes.total < that.sizes.total
125
119 def __cmp__(this, that): 126 def __cmp__(this, that):
120 if that is None: 127 if that is None:
121 return 1 128 return 1