Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
tools.skpbench.skpbench.SKPBench Class Reference

Public Member Functions

def get_header (cls, outfile=sys.stdout)
 
def run_warmup (cls, warmup_time, config)
 
def __init__ (self, src, config, max_stddev, best_result=None)
 
def __enter__ (self)
 
def __exit__ (self, exception_type, exception_value, traceback)
 
def execute (self, hardware)
 
def terminate (self)
 

Public Attributes

 src
 
 config
 
 max_stddev
 
 best_result
 

Static Public Attributes

list ARGV = [FLAGS.skpbench, '--verbosity', str(FLAGS.verbosity)]
 

Detailed Description

Definition at line 138 of file skpbench.py.

Constructor & Destructor Documentation

◆ __init__()

def tools.skpbench.skpbench.SKPBench.__init__ (   self,
  src,
  config,
  max_stddev,
  best_result = None 
)

Definition at line 207 of file skpbench.py.

207 def __init__(self, src, config, max_stddev, best_result=None):
208 self.src = src
209 self.config = config
210 self.max_stddev = max_stddev
211 self.best_result = best_result
212 self._queue = Queue()
213 self._proc = None
214 self._monitor = None
215 self._hw_poll_timer = None
216

Member Function Documentation

◆ __enter__()

def tools.skpbench.skpbench.SKPBench.__enter__ (   self)

Definition at line 217 of file skpbench.py.

217 def __enter__(self):
218 return self
219

◆ __exit__()

def tools.skpbench.skpbench.SKPBench.__exit__ (   self,
  exception_type,
  exception_value,
  traceback 
)

Definition at line 220 of file skpbench.py.

220 def __exit__(self, exception_type, exception_value, traceback):
221 if self._proc:
222 self.terminate()
223 if self._hw_poll_timer:
224 self._hw_poll_timer.cancel()
225

◆ execute()

def tools.skpbench.skpbench.SKPBench.execute (   self,
  hardware 
)

Definition at line 226 of file skpbench.py.

226 def execute(self, hardware):
227 hardware.sanity_check()
228 self._schedule_hardware_poll()
229
230 commandline = self.ARGV + ['--config', self.config,
231 '--src', self.src,
232 '--suppressHeader', 'true']
233 if FLAGS.write_path:
234 pngfile = _path.join(FLAGS.write_path, self.config,
235 _path.basename(self.src) + '.png')
236 commandline.extend(['--png', pngfile])
237 dump_commandline_if_verbose(commandline)
238 self._proc = subprocess.Popen(commandline, stdout=subprocess.PIPE,
239 stderr=subprocess.STDOUT)
240 self._monitor = SubprocessMonitor(self._queue, self._proc)
241 self._monitor.start()
242
243 while True:
244 message = self._queue.get()
245 if message.message == Message.READLINE:
246 result = BenchResult.match(message.value)
247 if result:
248 hardware.sanity_check()
249 self._process_result(result)
250 elif hardware.filter_line(message.value):
251 print(message.value, file=sys.stderr)
252 continue
253 if message.message == Message.POLL_HARDWARE:
254 hardware.sanity_check()
255 self._schedule_hardware_poll()
256 continue
257 if message.message == Message.EXIT:
258 self._monitor.join()
259 self._proc.wait()
260 if self._proc.returncode != 0:
261 raise Exception("skpbench exited with nonzero exit code %i" %
262 self._proc.returncode)
263 self._proc = None
264 break
265
def execute(*command)
Definition: buildapp.py:25
const myers::Point & get(const myers::Segment &)
def print(*args, **kwargs)
Definition: run_tests.py:49
def dump_commandline_if_verbose(commandline)
Definition: skpbench.py:109
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ get_header()

def tools.skpbench.skpbench.SKPBench.get_header (   cls,
  outfile = sys.stdout 
)

Definition at line 183 of file skpbench.py.

183 def get_header(cls, outfile=sys.stdout):
184 commandline = cls.ARGV + ['--duration', '0']
185 dump_commandline_if_verbose(commandline)
186 out = subprocess.check_output(commandline, stderr=subprocess.STDOUT, encoding='utf-8')
187 return out.rstrip()
188

◆ run_warmup()

def tools.skpbench.skpbench.SKPBench.run_warmup (   cls,
  warmup_time,
  config 
)

Definition at line 190 of file skpbench.py.

190 def run_warmup(cls, warmup_time, config):
191 if not warmup_time:
192 return
193 print('running %i second warmup...' % warmup_time, file=sys.stderr)
194 commandline = cls.ARGV + ['--duration', str(warmup_time * 1000),
195 '--config', config,
196 '--src', 'warmup']
197 dump_commandline_if_verbose(commandline)
198 output = subprocess.check_output(commandline, stderr=subprocess.STDOUT, encoding='utf-8')
199
200 # validate the warmup run output.
201 for line in output.split('\n'):
202 match = BenchResult.match(line.rstrip())
203 if match and match.bench == 'warmup':
204 return
205 raise Exception('Invalid warmup output:\n%s' % output)
206

◆ terminate()

def tools.skpbench.skpbench.SKPBench.terminate (   self)

Definition at line 284 of file skpbench.py.

284 def terminate(self):
285 if self._proc:
286 self._proc.terminate()
287 self._monitor.join()
288 self._proc.wait()
289 self._proc = None
290

Member Data Documentation

◆ ARGV

list tools.skpbench.skpbench.SKPBench.ARGV = [FLAGS.skpbench, '--verbosity', str(FLAGS.verbosity)]
static

Definition at line 139 of file skpbench.py.

◆ best_result

tools.skpbench.skpbench.SKPBench.best_result

Definition at line 211 of file skpbench.py.

◆ config

tools.skpbench.skpbench.SKPBench.config

Definition at line 209 of file skpbench.py.

◆ max_stddev

tools.skpbench.skpbench.SKPBench.max_stddev

Definition at line 210 of file skpbench.py.

◆ src

tools.skpbench.skpbench.SKPBench.src

Definition at line 208 of file skpbench.py.


The documentation for this class was generated from the following file: