def process(self, influx_client, start_time, end_time): for s_str, e_str in datetime_iter(start_time, end_time): sys.stderr.write('Processing video_sent and video_acked data ' 'between {} and {}\n'.format(s_str, e_str)) self.do_process(influx_client, s_str, e_str) self.video_stream.done_data_points() self.process_expired_sessions()
def process(self, influx_client, start_time, end_time): for s_str, e_str in datetime_iter(start_time, end_time): sys.stderr.write('Processing client_buffer data ' 'between {} and {}\n'.format(s_str, e_str)) self.do_process(influx_client, s_str, e_str) self.expiry_list.expire_all() self.process_expired_sessions()
def collect_rebuffer(): buffer_stream = BufferStream(expt, postgres_cursor) for s_str, e_str in datetime_iter(args.start_time, args.end_time): do_collect_rebuffer(s_str, e_str, buffer_stream) buffer_stream.done_data_points() return buffer_stream.out
def count_hours_users(influx_client): state = {} state['num_chunk'] = 0 state['distinct_users'] = set() for s_str, e_str in datetime_iter(args.start_time, args.end_time): do_count_hours_users(influx_client, s_str, e_str, state) print('Total hours: {:.2f}'.format(state['num_chunk'] * 2.002 / 3600)) print('Distinct users: {}'.format(len(state['distinct_users'])))
def collect_ssim(): d = {} # key: abr_cc; value: [sum, count] for s_str, e_str in datetime_iter(args.start_time, args.end_time): do_collect_ssim(s_str, e_str, d) # calculate average SSIM in dB for abr_cc in d: if d[abr_cc][1] == 0: sys.stderr.write('Warning: {} does not have SSIM data\n' .format(abr_cc)) continue avg_ssim_index = d[abr_cc][0] / d[abr_cc][1] avg_ssim_db = ssim_index_to_db(avg_ssim_index) d[abr_cc] = avg_ssim_db return d