@@ -377,7 +377,7 @@ private void RenderStatement(PlanStatement statement)
377377 // Update banners
378378 ShowMissingIndexes ( statement . MissingIndexes ) ;
379379 ShowParameters ( statement ) ;
380- ShowWaitStats ( statement . WaitStats , statement . QueryTimeStats != null ) ;
380+ ShowWaitStats ( statement . WaitStats , statement . WaitBenefits , statement . QueryTimeStats != null ) ;
381381 ShowRuntimeSummary ( statement ) ;
382382 UpdateInsightsHeader ( ) ;
383383
@@ -2635,7 +2635,7 @@ private static long GetChildElapsedMsSum(PlanNode node)
26352635 return sum ;
26362636 }
26372637
2638- private void ShowWaitStats ( List < WaitStatInfo > waits , bool isActualPlan )
2638+ private void ShowWaitStats ( List < WaitStatInfo > waits , List < WaitBenefit > benefits , bool isActualPlan )
26392639 {
26402640 WaitStatsContent . Children . Clear ( ) ;
26412641
@@ -2651,6 +2651,11 @@ private void ShowWaitStats(List<WaitStatInfo> waits, bool isActualPlan)
26512651
26522652 WaitStatsEmpty . IsVisible = false ;
26532653
2654+ // Build benefit lookup
2655+ var benefitLookup = new Dictionary < string , double > ( StringComparer . OrdinalIgnoreCase ) ;
2656+ foreach ( var wb in benefits )
2657+ benefitLookup [ wb . WaitType ] = wb . MaxBenefitPercent ;
2658+
26542659 var sorted = waits . OrderByDescending ( w => w . WaitTimeMs ) . ToList ( ) ;
26552660 var maxWait = sorted [ 0 ] . WaitTimeMs ;
26562661 var totalWait = sorted . Sum ( w => w . WaitTimeMs ) ;
@@ -2659,10 +2664,10 @@ private void ShowWaitStats(List<WaitStatInfo> waits, bool isActualPlan)
26592664 WaitStatsHeader . Text = $ " Wait Stats \u2014 { totalWait : N0} ms total";
26602665
26612666 // Build a single Grid for all rows so columns align
2662- // Name and duration auto-size; bar fills remaining space
2667+ // Name, bar, duration, and benefit columns
26632668 var grid = new Grid
26642669 {
2665- ColumnDefinitions = new ColumnDefinitions ( "Auto,*,Auto" )
2670+ ColumnDefinitions = new ColumnDefinitions ( "Auto,*,Auto,Auto " )
26662671 } ;
26672672 for ( int i = 0 ; i < sorted . Count ; i ++ )
26682673 grid . RowDefinitions . Add ( new RowDefinition ( GridLength . Auto ) ) ;
@@ -2709,11 +2714,27 @@ private void ShowWaitStats(List<WaitStatInfo> waits, bool isActualPlan)
27092714 FontSize = 12 ,
27102715 Foreground = new SolidColorBrush ( Color . Parse ( "#E4E6EB" ) ) ,
27112716 VerticalAlignment = VerticalAlignment . Center ,
2712- Margin = new Thickness ( 0 , 2 , 0 , 2 )
2717+ Margin = new Thickness ( 0 , 2 , 8 , 2 )
27132718 } ;
27142719 Grid . SetRow ( durationText , i ) ;
27152720 Grid . SetColumn ( durationText , 2 ) ;
27162721 grid . Children . Add ( durationText ) ;
2722+
2723+ // Benefit % (if available)
2724+ if ( benefitLookup . TryGetValue ( w . WaitType , out var benefitPct ) && benefitPct > 0 )
2725+ {
2726+ var benefitText = new TextBlock
2727+ {
2728+ Text = $ "up to { benefitPct : N0} %",
2729+ FontSize = 11 ,
2730+ Foreground = new SolidColorBrush ( Color . Parse ( "#8b949e" ) ) ,
2731+ VerticalAlignment = VerticalAlignment . Center ,
2732+ Margin = new Thickness ( 0 , 2 , 0 , 2 )
2733+ } ;
2734+ Grid . SetRow ( benefitText , i ) ;
2735+ Grid . SetColumn ( benefitText , 3 ) ;
2736+ grid . Children . Add ( benefitText ) ;
2737+ }
27172738 }
27182739
27192740 WaitStatsContent . Children . Add ( grid ) ;
0 commit comments