6"""Writes a Perf-formated json file with stats about the given web file."""
9from __future__
import print_function
17 input_file = sys.argv[1]
21 bloaty_path = sys.argv[5]
22 total_size_bytes_key = sys.argv[6]
23 magic_seperator = sys.argv[7]
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']))
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']))
44 props = propstr.split(
' ')
45 for i
in range(0,
len(props), 2):
46 results[props[i]] = props[i+1]
48 keys = keystr.split(
' ')
49 for i
in range(0,
len(keys), 2):
50 results[
'key'][keys[i]] = keys[i+1]
53 total_size_bytes_key: os.path.getsize(input_file)
58 temp_file = input_file +
'_tmp'
59 subprocess.check_call([
'cp', input_file, temp_file])
60 subprocess.check_call([
'gzip', temp_file])
62 r[
'gzip_size_bytes'] = os.path.getsize(temp_file +
'.gz')
64 name = os.path.basename(input_file)
66 results[
'results'][name] = {
73 print(magic_seperator)
74 print(json.dumps(results, indent=2))
76 with open(os.path.join(out_dir, name+
'.json'),
'w')
as output:
77 output.write(json.dumps(results, indent=2))
80if __name__ ==
'__main__':
def print(*args, **kwargs)