Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
malisc.py
Go to the documentation of this file.
1# Copyright 2019 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
6from __future__ import print_function
7import json
8import os
9import subprocess
10import sys
11
12
13if len(sys.argv) != 3:
14 print(sys.argv[0], ' <compiler> <folder>')
15 sys.exit(1)
16
17compiler = sys.argv[1]
18folder = sys.argv[2]
19
20stats = {}
21
22for filename in os.listdir(folder):
23 basename, ext = os.path.splitext(filename)
24 if ext not in ['.frag', '.spv']:
25 continue
26 cmdline = [compiler]
27 if ext == '.spv':
28 cmdline.extend(['-f', '-p'])
29 cmdline.append(os.path.join(folder, filename))
30 try:
31 output = subprocess.check_output(cmdline)
32 except subprocess.CalledProcessError:
33 continue
34 stats.setdefault(basename, {})
35 for line in output.splitlines():
36 if line.startswith('Instructions Emitted'):
37 inst = line.split(':')[1].split()
38 stats[basename][ext] = inst
39
40for k, v in stats.iteritems():
41 gl = v.get('.frag', ['', '', ''])
42 vk = v.get('.spv', ['', '', ''])
43 print('{0},{1},{2},{3},{4},{5},{6}'.format(
44 k, gl[0], gl[1], gl[2], vk[0], vk[1], vk[2]))
void print(void *str)
Definition bridge.cpp:126
uint32_t uint32_t * format