6"""Writes a Perf-formated json file with stats about Skia's size in flutter."""
18 stripped_file = sys.argv[1]
22 bloaty_path = sys.argv[5]
25 symbols_file = sys.argv[6]
27 total_size_bytes_key = sys.argv[8]
28 lib_name = sys.argv[9]
29 magic_seperator = sys.argv[10]
36 props = propstr.split(
' ')
37 for i
in range(0,
len(props), 2):
38 results[props[i]] = props[i+1]
40 keys = keystr.split(
' ')
41 for i
in range(0,
len(keys), 2):
42 results[
'key'][keys[i]] = keys[i+1]
45 print(magic_seperator)
46 print(
'Report by file, then by symbol with ellided/combined templates')
47 lines = subprocess.check_output([bloaty_path, stripped_file,
48 '-d',
'compileunits,symbols',
'-s',
'file',
49 '-n',
'0',
'--tsv',
'--demangle=short',
50 '--debug-file=%s' % symbols_file],
53 print(magic_seperator)
54 print(
'Report by file, then by symbol with full templates')
55 lines = subprocess.check_output([bloaty_path, stripped_file,
56 '-d',
'compileunits,symbols',
'-s',
'file',
57 '-n',
'0',
'--tsv',
'--demangle=full',
58 '--debug-file=%s' % symbols_file],
61 print(magic_seperator)
63 print(
'Report by symbol, then by file with ellided/combined templates')
64 lines = subprocess.check_output([bloaty_path, stripped_file,
65 '-d',
'symbols,compileunits',
'-s',
'file',
66 '-n',
'0',
'--tsv',
'--demangle=short',
67 '--debug-file=%s' % symbols_file],
70 print(magic_seperator)
72 print(
'Report by symbol, then by file with full templates')
73 lines = subprocess.check_output([bloaty_path, stripped_file,
74 '-d',
'symbols,compileunits',
'-s',
'file',
75 '-n',
'0',
'--tsv',
'--demangle=full',
76 '--debug-file=%s' % symbols_file],
79 print(magic_seperator)
84 total_size_bytes_key: grand_total
88 results[
'results'][lib_name] = r
91 print(json.dumps(results, indent=2))
93 with open(os.path.join(out_dir, lib_name+
'.json'),
'w')
as output:
94 output.write(json.dumps(results, indent=2))
99 return '%d bytes' % num
101 return '%1.1f KiB' % (num / 1024.0)
105 lines = lines.split(
'\n')
113 parts = line.split(
'\t')
117 if 'third_party/skia' not in this_file:
120 if '.debug' in symbol:
123 filesize =
int(parts[3])
125 if this_file != cur_file:
130 print(this_file.replace(
'../../third_party/skia',
'skia'))
133 sub_total += filesize
134 grand_total += filesize
137 print(
'=======================================')
143 lines = lines.split(
'\n')
148 parts = line.split(
'\t')
152 if 'section' in symbol:
155 if 'third_party/skia' not in this_file:
157 this_file = this_file.replace(
'../../third_party/skia',
'skia')
159 filesize =
int(parts[3])
164if __name__ ==
'__main__':
def print_skia_lines_symbol_file(lines)
def print_skia_lines_file_symbol(lines)
def print(*args, **kwargs)