def add_action_frames(self, frames, drop_threshold, generate_csv): # pylint: disable=too-many-locals ''' Uses FpsProcessor to parse frame.csv extracting fps, frame count, jank and vsync metrics on a per action basis. Adds results to metrics. ''' refresh_period = self._parse_refresh_peroid() for action in self.actions: # default values fps, frame_count, janks, not_at_vsync = float('nan'), 0, 0, 0 p90, p95, p99 = [float('nan')] * 3 metrics = (fps, frame_count, janks, not_at_vsync) df = self._create_sub_df(self.actions[action], frames) if not df.empty: # pylint: disable=maybe-no-member fp = FpsProcessor(df, action=action) try: per_frame_fps, metrics = fp.process( refresh_period, drop_threshold) fps, frame_count, janks, not_at_vsync = metrics if generate_csv: name = action + '_fps' filename = name + '.csv' fps_outfile = os.path.join( self.context.output_directory, filename) per_frame_fps.to_csv(fps_outfile, index=False, header=True) self.context.add_artifact(name, path=filename, kind='data') p90, p95, p99 = fp.percentiles() except AttributeError: self.logger.warning( 'Non-matched timestamps in dumpsys output: action={}'. format(action)) self.context.result.add_metric(action + '_FPS', fps) self.context.result.add_metric(action + '_frame_count', frame_count) self.context.result.add_metric(action + '_janks', janks, lower_is_better=True) self.context.result.add_metric(action + '_not_at_vsync', not_at_vsync, lower_is_better=True) self.context.result.add_metric(action + '_frame_time_90percentile', p90, 'ms', lower_is_better=True) self.context.result.add_metric(action + '_frame_time_95percentile', p95, 'ms', lower_is_better=True) self.context.result.add_metric(action + '_frame_time_99percentile', p99, 'ms', lower_is_better=True)
def update_result(self, context): if self.is_enabled: fps, frame_count, janks, not_at_vsync = float('nan'), 0, 0, 0 p90, p95, p99 = [float('nan')] * 3 data = pd.read_csv(self.outfile) if not data.empty: # pylint: disable=maybe-no-member # gfxinfo method has an additional file generated that contains statistics stats_file = None if self.fps_method == 'gfxinfo': stats_file = os.path.join(os.path.dirname(self.outfile), 'gfxinfo.csv') fp = FpsProcessor(data, extra_data=stats_file) per_frame_fps, metrics = fp.process(self.collector.refresh_period, self.drop_threshold) fps, frame_count, janks, not_at_vsync = metrics if self.generate_csv: per_frame_fps.to_csv(self.fps_outfile, index=False, header=True) context.add_artifact('fps', path='fps.csv', kind='data') p90, p95, p99 = fp.percentiles() context.result.add_metric('FPS', fps) context.result.add_metric('frame_count', frame_count) context.result.add_metric('janks', janks, lower_is_better=True) context.result.add_metric('not_at_vsync', not_at_vsync, lower_is_better=True) context.result.add_metric('frame_time_90percentile', p90, 'ms', lower_is_better=True) context.result.add_metric('frame_time_95percentile', p95, 'ms', lower_is_better=True) context.result.add_metric('frame_time_99percentile', p99, 'ms', lower_is_better=True)
def add_action_frames(self, frames, drop_threshold, generate_csv): # pylint: disable=too-many-locals ''' Uses FpsProcessor to parse frame.csv extracting fps, frame count, jank and vsync metrics on a per action basis. Adds results to metrics. ''' refresh_period = self._parse_refresh_peroid() for action in self.actions: df = self._create_data_dict(action, frames) fp = FpsProcessor(pd.DataFrame(df), action=action) per_frame_fps, metrics = fp.process(refresh_period, drop_threshold) if generate_csv: name = action + '_fps' filename = name + '.csv' fps_outfile = os.path.join(self.context.output_directory, filename) per_frame_fps.to_csv(fps_outfile, index=False, header=True) self.context.add_artifact(name, path=filename, kind='data') fps, frame_count, janks, not_at_vsync = metrics result = self.context.result result.add_metric(action + '_FPS', fps) result.add_metric(action + '_frame_count', frame_count) result.add_metric(action + '_janks', janks) result.add_metric(action + '_not_at_vsync', not_at_vsync)
def update_result(self, context): if self.is_enabled: data = pd.read_csv(self.outfile) if not data.empty: # pylint: disable=maybe-no-member fp = FpsProcessor(data) per_frame_fps, metrics = fp.process(self.collector.refresh_period, self.drop_threshold) fps, frame_count, janks, not_at_vsync = metrics context.result.add_metric('FPS', fps) context.result.add_metric('frame_count', frame_count) context.result.add_metric('janks', janks) context.result.add_metric('not_at_vsync', not_at_vsync) if self.generate_csv: per_frame_fps.to_csv(self.fps_outfile, index=False, header=True) context.add_artifact('fps', path='fps.csv', kind='data')
def update_result(self, context): if self.is_enabled: fps, frame_count, janks, not_at_vsync = float('nan'), 0, 0, 0 data = pd.read_csv(self.outfile) if not data.empty: # pylint: disable=maybe-no-member fp = FpsProcessor(data) per_frame_fps, metrics = fp.process(self.collector.refresh_period, self.drop_threshold) fps, frame_count, janks, not_at_vsync = metrics if self.generate_csv: per_frame_fps.to_csv(self.fps_outfile, index=False, header=True) context.add_artifact('fps', path='fps.csv', kind='data') context.result.add_metric('FPS', fps) context.result.add_metric('frame_count', frame_count) context.result.add_metric('janks', janks) context.result.add_metric('not_at_vsync', not_at_vsync)
def add_action_frames(self, frames, drop_threshold, generate_csv): # pylint: disable=too-many-locals ''' Uses FpsProcessor to parse frame.csv extracting fps, frame count, jank and vsync metrics on a per action basis. Adds results to metrics. ''' refresh_period = self._parse_refresh_peroid() for action in self.actions: # default values fps, frame_count, janks, not_at_vsync = float('nan'), 0, 0, 0 p90, p95, p99 = [float('nan')] * 3 metrics = (fps, frame_count, janks, not_at_vsync) df = self._create_sub_df(self.actions[action], frames) if not df.empty: # pylint: disable=maybe-no-member fp = FpsProcessor(df, action=action) try: per_frame_fps, metrics = fp.process(refresh_period, drop_threshold) fps, frame_count, janks, not_at_vsync = metrics if generate_csv: name = action + '_fps' filename = name + '.csv' fps_outfile = os.path.join(self.context.output_directory, filename) per_frame_fps.to_csv(fps_outfile, index=False, header=True) self.context.add_artifact(name, path=filename, kind='data') p90, p95, p99 = fp.percentiles() except AttributeError: self.logger.warning('Non-matched timestamps in dumpsys output: action={}' .format(action)) self.context.result.add_metric(action + '_FPS', fps) self.context.result.add_metric(action + '_frame_count', frame_count) self.context.result.add_metric(action + '_janks', janks, lower_is_better=True) self.context.result.add_metric(action + '_not_at_vsync', not_at_vsync, lower_is_better=True) self.context.result.add_metric(action + '_frame_time_90percentile', p90, 'ms', lower_is_better=True) self.context.result.add_metric(action + '_frame_time_95percentile', p95, 'ms', lower_is_better=True) self.context.result.add_metric(action + '_frame_time_99percentile', p99, 'ms', lower_is_better=True)
def add_action_frames(self, frames, drop_threshold, generate_csv): # pylint: disable=too-many-locals ''' Uses FpsProcessor to parse frame.csv extracting fps, frame count, jank and vsync metrics on a per action basis. Adds results to metrics. ''' refresh_period = self._parse_refresh_peroid() for action in self.actions: # default values fps = float('nan') frame_count, janks, not_at_vsync = 0, 0, 0 metrics = fps, frame_count, janks, not_at_vsync df = self._create_data_dict(action, frames) fp = FpsProcessor(pd.DataFrame(df), action=action) try: per_frame_fps, metrics = fp.process(refresh_period, drop_threshold) if generate_csv: name = action + '_fps' filename = name + '.csv' fps_outfile = os.path.join(self.context.output_directory, filename) per_frame_fps.to_csv(fps_outfile, index=False, header=True) self.context.add_artifact(name, path=filename, kind='data') except AttributeError: self.logger.warning( 'Non-matched timestamps in dumpsys output: action={}'. format(action)) fps, frame_count, janks, not_at_vsync = metrics result = self.context.result result.add_metric(action + '_FPS', fps) result.add_metric(action + '_frame_count', frame_count) result.add_metric(action + '_janks', janks) result.add_metric(action + '_not_at_vsync', not_at_vsync)