Skip to content

Commit ff9d649

Browse files
authored
donate-cpu-server.py: split time report into improvement and regression report (#3081)
1 parent 3f2d9c0 commit ff9d649

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

tools/donate-cpu-server.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/
2323
# Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic
2424
# changes)
25-
SERVER_VERSION = "1.3.8"
25+
SERVER_VERSION = "1.3.9"
2626

2727
OLD_VERSION = '2.3'
2828

@@ -72,7 +72,8 @@ def overviewReport() -> str:
7272
html += '<a href="diff.html">Diff report</a><br>\n'
7373
html += '<a href="head.html">HEAD report</a><br>\n'
7474
html += '<a href="latest.html">Latest results</a><br>\n'
75-
html += '<a href="time.html">Time report</a><br>\n'
75+
html += '<a href="time_lt.html">Time report (improved)</a><br>\n'
76+
html += '<a href="time_gt.html">Time report (regressed)</a><br>\n'
7677
html += '<a href="check_library_function_report.html">checkLibraryFunction report</a><br>\n'
7778
html += '<a href="check_library_noreturn_report.html">checkLibraryNoReturn report</a><br>\n'
7879
html += '<a href="check_library_use_ignore_report.html">checkLibraryUseIgnore report</a><br>\n'
@@ -377,7 +378,6 @@ def generate_package_diff_statistics(filename: str) -> None:
377378
if not line.endswith(']'):
378379
continue
379380

380-
version = None
381381
if line.startswith(OLD_VERSION + ' '):
382382
version = OLD_VERSION
383383
elif line.startswith('head '):
@@ -612,8 +612,9 @@ def headMessageIdTodayReport(resultPath: str, messageId: str) -> str:
612612
return text
613613

614614

615-
def timeReport(resultPath: str) -> str:
616-
html = '<html><head><title>Time report</title></head><body>\n'
615+
# TODO: sort the results by factor
616+
def timeReport(resultPath: str, show_gt: bool) -> str:
617+
html = '<html><head><title>Time report ({})</title></head><body>\n'.format('regressed' if show_gt else 'improved')
617618
html += '<h1>Time report</h1>\n'
618619
html += '<pre>\n'
619620
column_width = [40, 10, 10, 10, 10]
@@ -645,9 +646,9 @@ def timeReport(resultPath: str) -> str:
645646
total_time_base += time_base
646647
total_time_head += time_head
647648
suspicious_time_difference = False
648-
if time_base > 1 and time_base*2 < time_head:
649+
if show_gt and time_base > 1 and time_base*2 < time_head:
649650
suspicious_time_difference = True
650-
elif time_head > 1 and time_head*2 < time_base:
651+
elif not show_gt and time_head > 1 and time_head*2 < time_base:
651652
suspicious_time_difference = True
652653
if suspicious_time_difference:
653654
if time_base > 0.0:
@@ -659,7 +660,12 @@ def timeReport(resultPath: str) -> str:
659660
break
660661

661662
html += '\n'
662-
html += '(listed above are all suspicious timings with a factor &lt;0.50 or &gt;2.00)\n'
663+
html += '(listed above are all suspicious timings with a factor '
664+
if show_gt:
665+
html += '&gt;2.00'
666+
else:
667+
html += '&lt;0.50'
668+
html += ')\n'
663669
html += '\n'
664670
if total_time_base > 0.0:
665671
total_time_factor = total_time_head / total_time_base
@@ -839,8 +845,11 @@ def run(self):
839845
messageId = url[5:]
840846
text = headMessageIdReport(self.resultPath, messageId)
841847
httpGetResponse(self.connection, text, 'text/plain')
842-
elif url == 'time.html':
843-
text = timeReport(self.resultPath)
848+
elif url == 'time_lt.html':
849+
text = timeReport(self.resultPath, False)
850+
httpGetResponse(self.connection, text, 'text/html')
851+
elif url == 'time_gt.html':
852+
text = timeReport(self.resultPath, True)
844853
httpGetResponse(self.connection, text, 'text/html')
845854
elif url == 'check_library_function_report.html':
846855
text = check_library_report(self.resultPath + '/' + 'info_output', message_id='checkLibraryFunction')
@@ -950,7 +959,7 @@ def server(server_address_port: int, packages: list, packageIndex: int, resultPa
950959
time.sleep(0.2)
951960
t += 0.2
952961
connection.close()
953-
except socket.error as e:
962+
except socket.error:
954963
pass
955964

956965
pos = data.find('\n')
@@ -1019,7 +1028,7 @@ def server(server_address_port: int, packages: list, packageIndex: int, resultPa
10191028
time.sleep(0.2)
10201029
t += 0.2
10211030
connection.close()
1022-
except socket.error as e:
1031+
except socket.error:
10231032
pass
10241033

10251034
pos = data.find('\n')

0 commit comments

Comments
 (0)