Flutter Engine
The Flutter Engine
Functions
buildstats_wasm Namespace Reference

Functions

def main ()
 

Function Documentation

◆ main()

def buildstats_wasm.main ( )

Definition at line 16 of file buildstats_wasm.py.

16def main():
17 input_file = sys.argv[1]
18 out_dir = sys.argv[2]
19 keystr = sys.argv[3]
20 propstr = sys.argv[4]
21 bloaty_path = sys.argv[5]
22 total_size_bytes_key = sys.argv[6]
23 magic_seperator = sys.argv[7]
24
25 results = {
26 'key': { },
27 'results': { }
28 }
29
30 print(magic_seperator)
31 print('If you see lots of func[19] and such, go check out the debug build')
32 print('Note that template instantiations are grouped together, '
33 'thus the elided types.')
34 print('If you notice an unsymbolized "duplicate" entry, it is simply how '
35 'many bytes the function name itself takes up')
36 print(subprocess.check_output([bloaty_path, input_file,
37 '-d', 'shortsymbols', '-n', '0']))
38
39 print(magic_seperator)
40 print('If you see lots of func[19] and such, go check out the debug build')
41 print(subprocess.check_output([bloaty_path, input_file,
42 '-d', 'fullsymbols', '-n', '0']))
43
44 props = propstr.split(' ')
45 for i in range(0, len(props), 2):
46 results[props[i]] = props[i+1]
47
48 keys = keystr.split(' ')
49 for i in range(0, len(keys), 2):
50 results['key'][keys[i]] = keys[i+1]
51
52 r = {
53 total_size_bytes_key: os.path.getsize(input_file)
54 }
55
56 # Make a copy to avoid destroying the hardlinked file.
57 # Swarming hardlinks in the builds from isolated cache.
58 temp_file = input_file + '_tmp'
59 subprocess.check_call(['cp', input_file, temp_file])
60 subprocess.check_call(['gzip', temp_file])
61
62 r['gzip_size_bytes'] = os.path.getsize(temp_file + '.gz')
63
64 name = os.path.basename(input_file)
65
66 results['results'][name] = {
67 # We need this top level layer 'config'/slice
68 # Other analysis methods (e.g. libskia) might have
69 # slices for data on the 'code' section, etc.
70 'default' : r,
71 }
72
73 print(magic_seperator)
74 print(json.dumps(results, indent=2))
75
76 with open(os.path.join(out_dir, name+'.json'), 'w') as output:
77 output.write(json.dumps(results, indent=2))
78
79
def print(*args, **kwargs)
Definition: run_tests.py:49