Performance improvements for CDash reporter
* Record build output as an array of lines rather than concatenating to a single large string. * Use string.find to avoid running re.search on every line of output.
This commit is contained in:
parent
6355ee208c
commit
b90f619037
1 changed files with 12 additions and 9 deletions
|
@ -78,7 +78,7 @@ def build_report(self, filename, report_data):
|
|||
|
||||
for phase in cdash_phases:
|
||||
report_data[phase] = {}
|
||||
report_data[phase]['log'] = ""
|
||||
report_data[phase]['loglines'] = []
|
||||
report_data[phase]['status'] = 0
|
||||
report_data[phase]['endtime'] = self.endtime
|
||||
|
||||
|
@ -97,7 +97,9 @@ def build_report(self, filename, report_data):
|
|||
current_phase = ''
|
||||
cdash_phase = ''
|
||||
for line in package['stdout'].splitlines():
|
||||
match = phase_regexp.search(line)
|
||||
match = None
|
||||
if line.find("Executing phase: '") != -1:
|
||||
match = phase_regexp.search(line)
|
||||
if match:
|
||||
current_phase = match.group(1)
|
||||
if current_phase not in map_phases_to_cdash:
|
||||
|
@ -107,12 +109,12 @@ def build_report(self, filename, report_data):
|
|||
map_phases_to_cdash[current_phase]
|
||||
if cdash_phase not in phases_encountered:
|
||||
phases_encountered.append(cdash_phase)
|
||||
report_data[cdash_phase]['log'] += \
|
||||
text_type("{0} output for {1}:\n".format(
|
||||
cdash_phase, package['name']))
|
||||
report_data[cdash_phase]['loglines'].append(
|
||||
text_type("{0} output for {1}:".format(
|
||||
cdash_phase, package['name'])))
|
||||
elif cdash_phase:
|
||||
report_data[cdash_phase]['log'] += \
|
||||
xml.sax.saxutils.escape(line) + "\n"
|
||||
report_data[cdash_phase]['loglines'].append(
|
||||
xml.sax.saxutils.escape(line))
|
||||
|
||||
phases_encountered.append('update')
|
||||
|
||||
|
@ -126,8 +128,9 @@ def build_report(self, filename, report_data):
|
|||
self.starttime = self.endtime - total_duration
|
||||
for phase in phases_encountered:
|
||||
report_data[phase]['starttime'] = self.starttime
|
||||
errors, warnings = parse_log_events(
|
||||
report_data[phase]['log'].splitlines())
|
||||
report_data[phase]['log'] = \
|
||||
'\n'.join(report_data[phase]['loglines'])
|
||||
errors, warnings = parse_log_events(report_data[phase]['loglines'])
|
||||
nerrors = len(errors)
|
||||
|
||||
if phase == 'configure' and nerrors > 0:
|
||||
|
|
Loading…
Reference in a new issue