#! /usr/bin/env python import time from threading import Event from launch_time import LaunchTimeBenchmark, DefaultLaunchTimeHandler class StartupBenchmark(LaunchTimeBenchmark): def initialize(self): self.benchmark_description = 'Measure startup time of a given browser.' self.response_handler = StartupBenchmark.ResponseHandler(self) self.start_time = None self.stop_time = None self.stop_signal_was_received = Event() def run_iteration(self): self.start_time = time.time() * 1000 self.open_tab() while self.stop_time is None: self.stop_signal_was_received.wait() result = self.stop_time - self.start_time self.stop_time = None self.stop_signal_was_received.clear() self.quit_browser() return result @staticmethod def ResponseHandler(startup_benchmark): class Handler(DefaultLaunchTimeHandler): def get_test_page(self): return ''' Startup Benchmark

Startup Benchmark

''' def on_receive_stop_signal(self, data): startup_benchmark.stop_time = float(data) startup_benchmark.stop_signal_was_received.set() return Handler if __name__ == '__main__': StartupBenchmark().run()