def read_logs(self, files): self.name = files current_file = open(files, 'rU') lines = current_file.readlines() for line in lines: r = RateControlUtil.SETTING_TYPE_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) self.usage_type = int(r.groups()[0]) continue r = RateControlUtil.LAYER_SETTING_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) self.get_settings(cur_dt, r) continue r = RateControlUtil.SETOPTION_BR_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) RateControlUtil.option_br_update(self.settings, cur_dt, int(r.group(1))) continue r = RateControlUtil.SETOPTION_MAXBR_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) RateControlUtil.option_max_br_update(self.settings, cur_dt, int(r.group(1))) continue r = RateControlUtil.ENCODER_STAT_LOG_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) ts = self.check_ts(r.group(14)) encoded_bytes = int(r.group(13)) self.stats.append((cur_dt, ts, encoded_bytes)) self.idr.append(int(r.group(12))) self.frame_skipped.append(int(r.group(9))) continue r = RateControlUtil.VIDEO_LAYER_LOG_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) did = __init__.get_did_from_resolution(int(r.group(1)), int(r.group(2))) br = int(r.group(4)) if br > 0: self.layer_stats.append((cur_dt, did, br)) continue current_file.close()
def read_logs(self, files): self.name = files current_file = open(files, 'rU') lines = current_file.readlines() for line in lines: r = RateControlUtil.SETTING_TYPE_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) self.usage_type = int(r.groups()[0]) continue r = RateControlUtil.LAYER_SETTING_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) self.get_settings(cur_dt, r) continue r = RateControlUtil.SETOPTION_BR_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) RateControlUtil.option_br_update(self.settings, cur_dt, int(r.group(1))) continue r = RateControlUtil.SETOPTION_MAXBR_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) RateControlUtil.option_max_br_update(self.settings, cur_dt, int(r.group(1))) continue r = RateControlUtil.ENCODER_STAT_LOG_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) ts = self.check_ts(r.group(14)) encoded_bytes = int(r.group(13)) self.stats.append((cur_dt, ts, encoded_bytes)) self.idr.append(int(r.group(12))) self.frame_skipped.append(int(r.group(9))) continue r = RateControlUtil.VIDEO_LAYER_LOG_RE.search(line) if r is not None: cur_dt = RateControlUtil.extract_timestamp(line) did = __init__.get_did_from_resolution(int(r.group(1)),int(r.group(2))) br = int(r.group(4)) if br>0: self.layer_stats.append((cur_dt, did, br)) continue current_file.close()
def read_logs(self, files): self.name = files current_file = open(files, 'rU') lines = current_file.readlines() for line in lines: r = self.basic_setting_match_re1.search(line) if r is not None: self.usage_type = int(r.groups()[0]) continue r = self.setting_match_re.search(line) if r is not None: setting_time = 0 if len(self.frames[0]['timestamp']) > 0: setting_time = self.frames[-1].ts self.get_settings(setting_time, r) continue r = self.rc_log_match_re.search(line) if r is not None: self.add_one_frame(self.check_ts(r.group(1)), [int( r.group(i)) for i in range(2,9)] ) continue r = self.rc_m_log_match_re.search(line) if r is not None: self.add_one_multi_layer_frame(self.check_ts(r.group(2)), int(r.group(1)), [int( r.group(i)) for i in range(3,10)]) continue r = self.rc_skip_frame_match_re.search(line) if r is not None: self.add_one_skipped_frame(self.check_ts(r.group(1)), r) continue r = self.setoption_br_match.search(line) if r is not None: setting_time = self.get_last_frame_ts() RateControlUtil.option_br_update(self.settings, setting_time, int(r.group(1))) continue r = self.setoption_maxbr_match.search(line) if r is not None: setting_time = self.get_last_frame_ts() RateControlUtil.option_max_br_update(self.settings, setting_time, int(r.group(1))) continue current_file.close()