aboutsummaryrefslogtreecommitdiffstats
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:01:57 +0000
commit016b19c2589582d7ec3c8cac9cfa75a1edc716fe (patch)
tree9d29d728558903c099b734f3675aa0e9831b0379 /scripts/tiny/ksize.py
parent7e459843e0371953d3d9d3ad05b019947ed7ca04 (diff)
downloadopenembedded-core-contrib-016b19c2589582d7ec3c8cac9cfa75a1edc716fe.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. 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>
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():
class Sizes:
def __init__(self, glob):
self.title = glob
- p = Popen("size -t " + glob, shell=True, stdout=PIPE, stderr=PIPE)
+ p = Popen("size -t " + str(glob), shell=True, stdout=PIPE, stderr=PIPE)
output = p.communicate()[0].splitlines()
if len(output) > 2:
sizes = output[-1].split()[0:4]
@@ -62,18 +62,18 @@ class Report:
r = Report(filename, title)
path = os.path.dirname(filename)
- p = Popen("ls " + path + "/*.o | grep -v built-in.o",
+ p = Popen("ls " + str(path) + "/*.o | grep -v built-in.o",
shell=True, stdout=PIPE, stderr=PIPE)
glob = ' '.join(p.communicate()[0].splitlines())
- oreport = Report(glob, path + "/*.o")
- oreport.sizes.title = path + "/*.o"
+ oreport = Report(glob, str(path) + "/*.o")
+ oreport.sizes.title = str(path) + "/*.o"
r.parts.append(oreport)
if subglob:
p = Popen("ls " + subglob, shell=True, stdout=PIPE, stderr=PIPE)
for f in p.communicate()[0].splitlines():
path = os.path.dirname(f)
- r.parts.append(Report.create(f, path, path + "/*/built-in.o"))
+ r.parts.append(Report.create(f, path, str(path) + "/*/built-in.o"))
r.parts.sort(reverse=True)
for b in r.parts:
@@ -116,6 +116,13 @@ class Report:
self.deltas["data"], self.deltas["bss"]))
print("\n")
+ def __lt__(this, that):
+ if that is None:
+ return 1
+ if not isinstance(that, Report):
+ raise TypeError
+ return this.sizes.total < that.sizes.total
+
def __cmp__(this, that):
if that is None:
return 1