@@ -55,7 +55,7 @@ def print_specialization_stats(name, family_stats, defines):
55
55
label = label [0 ].upper () + label [1 :]
56
56
val = family_stats .get (key , 0 )
57
57
rows .append ((label , val , f"{ 100 * val / total_attempts :0.1f} %" ))
58
- emit_table (("" , "Count" , "Ratio" ), rows )
58
+ emit_table (("" , "Count: " , "Ratio: " ), rows )
59
59
total_failures = family_stats .get ("specialization.failure" , 0 )
60
60
failure_kinds = [ 0 ] * 30
61
61
for key in family_stats :
@@ -71,7 +71,7 @@ def print_specialization_stats(name, family_stats, defines):
71
71
if not value :
72
72
continue
73
73
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 )
75
75
76
76
def gather_stats ():
77
77
stats = collections .Counter ()
@@ -174,8 +174,17 @@ def __exit__(*args):
174
174
175
175
def emit_table (header , rows ):
176
176
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 )
179
188
for row in rows :
180
189
if width is not None and len (row ) != width :
181
190
raise ValueError ("Wrong number of elements in row '" + str (rows ) + "'" )
@@ -204,7 +213,7 @@ def emit_execution_counts(opcode_stats, total):
204
213
rows .append ((name , count , f"{ 100 * count / total :0.1f} %" ,
205
214
f"{ 100 * cumulative / total :0.1f} %" , miss ))
206
215
emit_table (
207
- ("Name" , "Count" , "Self" , "Cumulative" , "Miss ratio" ),
216
+ ("Name" , "Count: " , "Self: " , "Cumulative: " , "Miss ratio: " ),
208
217
rows
209
218
)
210
219
@@ -221,7 +230,7 @@ def emit_specialization_stats(opcode_stats):
221
230
def emit_specialization_overview (opcode_stats , total ):
222
231
basic , not_specialized , specialized = categorized_counts (opcode_stats )
223
232
with Section ("Specialization effectiveness" ):
224
- emit_table (("Instructions" , "Count" , "Ratio" ), (
233
+ emit_table (("Instructions" , "Count: " , "Ratio: " ), (
225
234
("Basic" , basic , f"{ basic * 100 / total :0.1f} %" ),
226
235
("Not specialized" , not_specialized , f"{ not_specialized * 100 / total :0.1f} %" ),
227
236
("Specialized" , specialized , f"{ specialized * 100 / total :0.1f} %" ),
@@ -240,7 +249,7 @@ def emit_call_stats(stats):
240
249
for key , value in stats .items ():
241
250
if key .startswith ("Frame" ):
242
251
rows .append ((key , value , f"{ 100 * value / total :0.1f} %" ))
243
- emit_table (("" , "Count" , "Ratio" ), rows )
252
+ emit_table (("" , "Count: " , "Ratio: " ), rows )
244
253
245
254
def emit_object_stats (stats ):
246
255
with Section ("Object stats" , summary = "allocations, frees and dict materializatons" ):
@@ -255,7 +264,7 @@ def emit_object_stats(stats):
255
264
label = key [6 :].strip ()
256
265
label = label [0 ].upper () + label [1 :]
257
266
rows .append ((label , value , materialize ))
258
- emit_table (("" , "Count" , "Ratio" ), rows )
267
+ emit_table (("" , "Count: " , "Ratio: " ), rows )
259
268
260
269
def main ():
261
270
stats = gather_stats ()
0 commit comments