@@ -459,10 +459,7 @@ def get_optimization_stats(self) -> dict[str, tuple[int, int | None]]:
459
459
"The number of times a potential trace is identified. Specifically, this "
460
460
"occurs in the JUMP BACKWARD instruction when the counter reaches a "
461
461
"threshold." ,
462
- ): (
463
- attempts ,
464
- None ,
465
- ),
462
+ ): (attempts , None ),
466
463
Doc (
467
464
"Traces created" , "The number of traces that were successfully created."
468
465
): (created , attempts ),
@@ -512,6 +509,26 @@ def get_optimization_stats(self) -> dict[str, tuple[int, int | None]]:
512
509
),
513
510
}
514
511
512
+ def get_optimizer_stats (self ) -> dict [str , tuple [int , int | None ]]:
513
+ attempts = self ._data ["Optimization optimizer attempts" ]
514
+ successes = self ._data ["Optimization optimizer successes" ]
515
+ no_memory = self ._data ["Optimization optimizer failure no memory" ]
516
+
517
+ return {
518
+ Doc (
519
+ "Optimizer attempts" ,
520
+ "The number of times the trace optimizer (_Py_uop_analyze_and_optimize) was run." ,
521
+ ): (attempts , None ),
522
+ Doc (
523
+ "Optimizer successes" ,
524
+ "The number of traces that were successfully optimized." ,
525
+ ): (successes , attempts ),
526
+ Doc (
527
+ "Optimizer no memory" ,
528
+ "The number of optimizations that failed due to no memory." ,
529
+ ): (no_memory , attempts ),
530
+ }
531
+
515
532
def get_histogram (self , prefix : str ) -> list [tuple [int , int ]]:
516
533
rows = []
517
534
for k , v in self ._data .items ():
@@ -1118,6 +1135,14 @@ def calc_optimization_table(stats: Stats) -> Rows:
1118
1135
for label , (value , den ) in optimization_stats .items ()
1119
1136
]
1120
1137
1138
+ def calc_optimizer_table (stats : Stats ) -> Rows :
1139
+ optimizer_stats = stats .get_optimizer_stats ()
1140
+
1141
+ return [
1142
+ (label , Count (value ), Ratio (value , den ))
1143
+ for label , (value , den ) in optimizer_stats .items ()
1144
+ ]
1145
+
1121
1146
def calc_histogram_table (key : str , den : str ) -> RowCalculator :
1122
1147
def calc (stats : Stats ) -> Rows :
1123
1148
histogram = stats .get_histogram (key )
@@ -1159,6 +1184,7 @@ def iter_optimization_tables(base_stats: Stats, head_stats: Stats | None = None)
1159
1184
return
1160
1185
1161
1186
yield Table (("" , "Count:" , "Ratio:" ), calc_optimization_table , JoinMode .CHANGE )
1187
+ yield Table (("" , "Count:" , "Ratio:" ), calc_optimizer_table , JoinMode .CHANGE )
1162
1188
for name , den in [
1163
1189
("Trace length" , "Optimization traces created" ),
1164
1190
("Optimized trace length" , "Optimization traces created" ),
0 commit comments