@@ -55,7 +55,7 @@ def print_specialization_stats(name, family_stats, defines):
5555 label = label [0 ].upper () + label [1 :]
5656 val = family_stats .get (key , 0 )
5757 rows .append ((label , val , f"{ 100 * val / total_attempts :0.1f} %" ))
58- emit_table (("" , "Count" , "Ratio" ), rows )
58+ emit_table (("" , "Count: " , "Ratio: " ), rows )
5959 total_failures = family_stats .get ("specialization.failure" , 0 )
6060 failure_kinds = [ 0 ] * 30
6161 for key in family_stats :
@@ -71,7 +71,7 @@ def print_specialization_stats(name, family_stats, defines):
7171 if not value :
7272 continue
7373 rows .append ((kind_to_text (index , defines , name ), value , f"{ 100 * value / total_failures :0.1f} %" ))
74- emit_table (("Failure kind" , "Count" , "Ratio" ), rows )
74+ emit_table (("Failure kind" , "Count: " , "Ratio: " ), rows )
7575
7676def gather_stats ():
7777 stats = collections .Counter ()
@@ -174,8 +174,17 @@ def __exit__(*args):
174174
175175def emit_table (header , rows ):
176176 width = len (header )
177- print ("|" , " | " .join (header ), "|" )
178- print ("|" , " | " .join (["---" ]* width ), "|" )
177+ header_line = "|"
178+ under_line = "|"
179+ for item in header :
180+ under = "---"
181+ if item .endswith (":" ):
182+ item = item [:- 1 ]
183+ under += ":"
184+ header_line += item + " | "
185+ under_line += under + "|"
186+ print (header_line )
187+ print (under_line )
179188 for row in rows :
180189 if width is not None and len (row ) != width :
181190 raise ValueError ("Wrong number of elements in row '" + str (rows ) + "'" )
@@ -204,7 +213,7 @@ def emit_execution_counts(opcode_stats, total):
204213 rows .append ((name , count , f"{ 100 * count / total :0.1f} %" ,
205214 f"{ 100 * cumulative / total :0.1f} %" , miss ))
206215 emit_table (
207- ("Name" , "Count" , "Self" , "Cumulative" , "Miss ratio" ),
216+ ("Name" , "Count: " , "Self: " , "Cumulative: " , "Miss ratio: " ),
208217 rows
209218 )
210219
@@ -221,7 +230,7 @@ def emit_specialization_stats(opcode_stats):
221230def emit_specialization_overview (opcode_stats , total ):
222231 basic , not_specialized , specialized = categorized_counts (opcode_stats )
223232 with Section ("Specialization effectiveness" ):
224- emit_table (("Instructions" , "Count" , "Ratio" ), (
233+ emit_table (("Instructions" , "Count: " , "Ratio: " ), (
225234 ("Basic" , basic , f"{ basic * 100 / total :0.1f} %" ),
226235 ("Not specialized" , not_specialized , f"{ not_specialized * 100 / total :0.1f} %" ),
227236 ("Specialized" , specialized , f"{ specialized * 100 / total :0.1f} %" ),
@@ -240,7 +249,7 @@ def emit_call_stats(stats):
240249 for key , value in stats .items ():
241250 if key .startswith ("Frame" ):
242251 rows .append ((key , value , f"{ 100 * value / total :0.1f} %" ))
243- emit_table (("" , "Count" , "Ratio" ), rows )
252+ emit_table (("" , "Count: " , "Ratio: " ), rows )
244253
245254def emit_object_stats (stats ):
246255 with Section ("Object stats" , summary = "allocations, frees and dict materializatons" ):
@@ -255,7 +264,7 @@ def emit_object_stats(stats):
255264 label = key [6 :].strip ()
256265 label = label [0 ].upper () + label [1 :]
257266 rows .append ((label , value , materialize ))
258- emit_table (("" , "Count" , "Ratio" ), rows )
267+ emit_table (("" , "Count: " , "Ratio: " ), rows )
259268
260269def main ():
261270 stats = gather_stats ()
0 commit comments