diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/tiny/ksum.py | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/scripts/tiny/ksum.py b/scripts/tiny/ksum.py index f38ae055db..8f0e4c0517 100755 --- a/scripts/tiny/ksum.py +++ b/scripts/tiny/ksum.py | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python3 |
2 | # | 2 | # |
3 | # Copyright (c) 2016, Intel Corporation. | 3 | # Copyright (c) 2016, Intel Corporation. |
4 | # | 4 | # |
@@ -62,7 +62,7 @@ def is_ko_file(filename): | |||
62 | return False | 62 | return False |
63 | 63 | ||
64 | def collect_object_files(): | 64 | def collect_object_files(): |
65 | print "Collecting object files recursively from %s..." % os.getcwd() | 65 | print("Collecting object files recursively from %s..." % os.getcwd()) |
66 | for dirpath, dirs, files in os.walk(os.getcwd()): | 66 | for dirpath, dirs, files in os.walk(os.getcwd()): |
67 | for filename in files: | 67 | for filename in files: |
68 | if is_ko_file(filename): | 68 | if is_ko_file(filename): |
@@ -70,7 +70,7 @@ def collect_object_files(): | |||
70 | elif is_vmlinux_file(filename): | 70 | elif is_vmlinux_file(filename): |
71 | global vmlinux_file | 71 | global vmlinux_file |
72 | vmlinux_file = os.path.join(dirpath, filename) | 72 | vmlinux_file = os.path.join(dirpath, filename) |
73 | print "Collecting object files [DONE]" | 73 | print("Collecting object files [DONE]") |
74 | 74 | ||
75 | def add_ko_file(filename): | 75 | def add_ko_file(filename): |
76 | p = Popen("size -t " + filename, shell=True, stdout=PIPE, stderr=PIPE) | 76 | p = Popen("size -t " + filename, shell=True, stdout=PIPE, stderr=PIPE) |
@@ -78,9 +78,9 @@ def add_ko_file(filename): | |||
78 | if len(output) > 2: | 78 | if len(output) > 2: |
79 | sizes = output[-1].split()[0:4] | 79 | sizes = output[-1].split()[0:4] |
80 | if verbose: | 80 | if verbose: |
81 | print " %10d %10d %10d %10d\t" % \ | 81 | print(" %10d %10d %10d %10d\t" % \ |
82 | (int(sizes[0]), int(sizes[1]), int(sizes[2]), int(sizes[3])), | 82 | (int(sizes[0]), int(sizes[1]), int(sizes[2]), int(sizes[3])), end=' ') |
83 | print "%s" % filename[len(os.getcwd()) + 1:] | 83 | print("%s" % filename[len(os.getcwd()) + 1:]) |
84 | global n_ko_files, ko_text, ko_data, ko_bss, ko_total | 84 | global n_ko_files, ko_text, ko_data, ko_bss, ko_total |
85 | ko_text += int(sizes[0]) | 85 | ko_text += int(sizes[0]) |
86 | ko_data += int(sizes[1]) | 86 | ko_data += int(sizes[1]) |
@@ -94,9 +94,9 @@ def get_vmlinux_totals(): | |||
94 | if len(output) > 2: | 94 | if len(output) > 2: |
95 | sizes = output[-1].split()[0:4] | 95 | sizes = output[-1].split()[0:4] |
96 | if verbose: | 96 | if verbose: |
97 | print " %10d %10d %10d %10d\t" % \ | 97 | print(" %10d %10d %10d %10d\t" % \ |
98 | (int(sizes[0]), int(sizes[1]), int(sizes[2]), int(sizes[3])), | 98 | (int(sizes[0]), int(sizes[1]), int(sizes[2]), int(sizes[3])), end=' ') |
99 | print "%s" % vmlinux_file[len(os.getcwd()) + 1:] | 99 | print("%s" % vmlinux_file[len(os.getcwd()) + 1:]) |
100 | global vmlinux_text, vmlinux_data, vmlinux_bss, vmlinux_total | 100 | global vmlinux_text, vmlinux_data, vmlinux_bss, vmlinux_total |
101 | vmlinux_text += int(sizes[0]) | 101 | vmlinux_text += int(sizes[0]) |
102 | vmlinux_data += int(sizes[1]) | 102 | vmlinux_data += int(sizes[1]) |
@@ -129,20 +129,20 @@ def main(): | |||
129 | sum_ko_files() | 129 | sum_ko_files() |
130 | get_vmlinux_totals() | 130 | get_vmlinux_totals() |
131 | 131 | ||
132 | print "\nTotals:" | 132 | print("\nTotals:") |
133 | print "\nvmlinux:" | 133 | print("\nvmlinux:") |
134 | print " text\tdata\t\tbss\t\ttotal" | 134 | print(" text\tdata\t\tbss\t\ttotal") |
135 | print " %-10d\t%-10d\t%-10d\t%-10d" % \ | 135 | print(" %-10d\t%-10d\t%-10d\t%-10d" % \ |
136 | (vmlinux_text, vmlinux_data, vmlinux_bss, vmlinux_total) | 136 | (vmlinux_text, vmlinux_data, vmlinux_bss, vmlinux_total)) |
137 | print "\nmodules (%d):" % n_ko_files | 137 | print("\nmodules (%d):" % n_ko_files) |
138 | print " text\tdata\t\tbss\t\ttotal" | 138 | print(" text\tdata\t\tbss\t\ttotal") |
139 | print " %-10d\t%-10d\t%-10d\t%-10d" % \ | 139 | print(" %-10d\t%-10d\t%-10d\t%-10d" % \ |
140 | (ko_text, ko_data, ko_bss, ko_total) | 140 | (ko_text, ko_data, ko_bss, ko_total)) |
141 | print "\nvmlinux + modules:" | 141 | print("\nvmlinux + modules:") |
142 | print " text\tdata\t\tbss\t\ttotal" | 142 | print(" text\tdata\t\tbss\t\ttotal") |
143 | print " %-10d\t%-10d\t%-10d\t%-10d" % \ | 143 | print(" %-10d\t%-10d\t%-10d\t%-10d" % \ |
144 | (vmlinux_text + ko_text, vmlinux_data + ko_data, \ | 144 | (vmlinux_text + ko_text, vmlinux_data + ko_data, \ |
145 | vmlinux_bss + ko_bss, vmlinux_total + ko_total) | 145 | vmlinux_bss + ko_bss, vmlinux_total + ko_total)) |
146 | 146 | ||
147 | if __name__ == "__main__": | 147 | if __name__ == "__main__": |
148 | try: | 148 | try: |