def process(log): # Match patterns here lines = log.split('\n') # only for -debug t1 = 0 t2 = 0 t3 = 0 ln = log_util.get_next_ln_starts_with(lines, 0, ' POWER ') hb = lines[ln] for i in range(ln, 0, -1): if lines[i].startswith('END_FUNC: propagate_switching_activity'): match = re.search('ELAPSE:\s+(\d+) s', lines[i]) if match: t2 = int(match.group(1)) elif lines[i].startswith('START_FUNC: propagate_switching_activity'): match = re.search('ELAPSE:\s+(\d+) s', lines[i]) if match: t1 = int(match.group(1)) break qor = log_util.parse_heartbeat(hb) if qor['valid']: hh, mm, ss = qor['elapsed'].split(':') t3 = int(hh) * 3600 + int(mm) * 60 + int(ss) print "runtime", t1, t2, t3 else: print "runtime" return
def process(log): # Match patterns here lines = log.split('\n') ln_init = log_util.get_next_ln_starts_with(lines, 0, ' * * ') hb1 = lines[ln_init] ln_delay = log_util.get_next_ln_starts_with(lines, ln_init, 'INFO: check if proc nro_prelude_delay-Wlb-Tlb exists') t_delay = log_util.get_elapse_time(lines, ln_delay, forward=False) ln_sbo = log_util.get_next_ln_starts_with(lines, ln_delay, ' SBO Optimization Summary') t_sbo = log_util.get_elapse_time(lines, ln_sbo, forward=True) ln_end = log_util.get_next_ln_starts_with(lines, ln_sbo, ' * * ') t_end = log_util.get_elapse_time(lines, ln_end, forward=False) hb2 = lines[ln_end] # print scenarios scenarios = [] for m in range(ln_end - 3, max(0, ln_end - 100), -1): match = re.search('^\s+\d+\s+\*\s+', lines[m]) if match: scenarios.append(lines[m]) if lines[m].startswith('Scene'): break for l in reversed(scenarios): print l qor1 = log_util.parse_heartbeat(hb1) qor2 = log_util.parse_heartbeat(hb2) if qor1['valid'] and qor2['valid']: print 'runtime', t_delay, t_sbo, t_end print "wns", qor1['wns'], qor2['wns'] print "tns", qor1['tns'], qor2['tns'] print "maxtran", qor1['maxtran'], qor2['maxtran'] print "area", qor1['area'], qor2['area'] print "buf", qor1['bufcnt'], qor2['bufcnt'] print "inv", qor1['invcnt'], qor2['invcnt'] return
def process(log): # Match patterns here lines = log.split('\n') ln_fo = 0 for i in range(len(lines)): if lines[i] == 'Running final optimization step.': ln_fo = i break ln_begin = ln_fo for i in range(ln_fo, len(lines)): if lines[i].startswith('END_FUNC: APS_S_DRC'): ln_begin = i break ln_end = ln_begin for i in range(ln_begin + 10, len(lines)): if lines[i].startswith('END_FUNC: psynopt_delay_opto'): ln_end = i break hb1 = '' for i in range(ln_begin, ln_fo, -1): match = re.search('\s+ELAPSED\s+WORST NEG\s+TOTAL NEG', lines[i]) if match: hb1 = lines[i + 3] break hb2 = '' for i in range(ln_end, ln_begin, -1): match = re.search('\s+ELAPSED\s+WORST NEG\s+TOTAL NEG', lines[i]) if match: hb2 = lines[i + 3] # print out scenarios scenarios = [] for j in range(i - 2, max(0, i - 100), -1): if lines[j].strip().startswith('Scenario'): scenarios.append(lines[j]) else: break for l in reversed(scenarios): print l break ok = True qor1 = log_util.parse_heartbeat(hb1) qor2 = log_util.parse_heartbeat(hb2) if qor1['valid'] and qor2['valid']: hh, mm, ss = qor1['elapsed'].split(':') t1 = int(hh) * 3600 + int(mm) * 60 + int(ss) hh, mm, ss = qor2['elapsed'].split(':') t2 = int(hh) * 3600 + int(mm) * 60 + int(ss) print "runtime", t1, t2 print "wns", qor1['wns'], qor2['wns'] print "tns", qor1['tns'], qor2['tns'] print "maxtran", qor1['maxtran'], qor2['maxtran'] print "area", qor1['area'], qor2['area'] print "buf", qor1['bufcnt'], qor2['bufcnt'] print "inv", qor1['invcnt'], qor2['invcnt'] else: print "runtime" print "wns" print "tns" print "maxtran" print "area" print "buf" print "inv" return
def process(log): # Match patterns here lines = log.split('\n') ln_init = log_util.get_next_ln_starts_with(lines, 0, ' * * ') ln_delay = log_util.get_next_ln_starts_with( lines, ln_init, 'INFO: check if proc nro_prelude_delay-Wlb-Tb exists') t_delay = log_util.get_elapse_time(lines, ln_delay, forward=False) ln_prev_hb = log_util.get_next_ln_starts_with(lines, ln_delay, ' * * ', forward=False) if ln_prev_hb == None: hb1 = "" else: hb1 = lines[ln_prev_hb] print "SCN BEFORE:" print_scn_table(lines, ln_prev_hb) ln_sbo = log_util.get_next_ln_starts_with(lines, ln_delay, ' SBO Optimization Summary') t_sbo = log_util.get_elapse_time(lines, ln_sbo, forward=True) ln_pbo_w1 = log_util.get_next_ln_starts_with(lines, ln_sbo, 'PBO-WNS: Iteration 2') t_pbo_wns_1 = log_util.get_elapse_time(lines, ln_pbo_w1, forward=True) ln_pbo_w2 = log_util.get_next_ln_starts_with( lines, ln_pbo_w1, ' WNS Optimization Summary') t_pbo_wns_2 = log_util.get_elapse_time(lines, ln_pbo_w2, forward=True) ln_pbo_t1 = log_util.get_next_ln_starts_with(lines, ln_pbo_w2, 'PBO-TNS: Iteration 2') t_pbo_tns_1 = log_util.get_elapse_time(lines, ln_pbo_t1, forward=True) ln_end = log_util.get_next_ln_starts_with(lines, ln_pbo_t1, ' * * ') t_end = log_util.get_elapse_time(lines, ln_end, forward=False) if ln_end == None: hb2 = "" else: hb2 = lines[ln_end] print "SCN AFTER:" print_scn_table(lines, ln_end) qor1 = log_util.parse_heartbeat(hb1) qor2 = log_util.parse_heartbeat(hb2) if qor1['valid'] and qor2['valid']: print 'runtime', t_delay, t_sbo, t_pbo_wns_1, t_pbo_wns_2, t_pbo_tns_1, t_end print "wns", qor1['wns'], qor2['wns'] print "tns", qor1['tns'], qor2['tns'] print "maxtran", qor1['maxtran'], qor2['maxtran'] print "area", qor1['area'], qor2['area'] print "buf", qor1['bufcnt'], qor2['bufcnt'] print "inv", qor1['invcnt'], qor2['invcnt'] else: print 'runtime' print "wns" print "tns" print "maxtran" print "area" print "buf" print "inv" return