@@ -75,6 +75,8 @@ function render_pipeline_graph() {
7575 ctx . translate ( X_LINE , MARGIN ) ;
7676
7777 // Compute x,y coordinate of each block.
78+ // We also populate a map with the count of each unit name to disambiguate if necessary
79+ const unitCount = new Map ( ) ;
7880 UNIT_COORDS = { } ;
7981 for ( i = 0 ; i < units . length ; i ++ ) {
8082 let unit = units [ i ] ;
@@ -86,6 +88,9 @@ function render_pipeline_graph() {
8688 }
8789 let width = Math . max ( px_per_sec * unit . duration , 1.0 ) ;
8890 UNIT_COORDS [ unit . i ] = { x, y, width, rmeta_x} ;
91+
92+ const count = unitCount . get ( unit . name ) || 0 ;
93+ unitCount . set ( unit . name , count + 1 ) ;
8994 }
9095
9196 // Draw the blocks.
@@ -111,7 +116,10 @@ function render_pipeline_graph() {
111116 ctx . textAlign = 'start' ;
112117 ctx . textBaseline = 'middle' ;
113118 ctx . font = '14px sans-serif' ;
114- const label = `${ unit . name } ${ unit . target } ${ unit . duration } s` ;
119+
120+ const labelName = ( unitCount . get ( unit . name ) || 0 ) > 1 ? `${ unit . name } (v${ unit . version } )${ unit . target } ` : `${ unit . name } ${ unit . target } ` ;
121+ const label = `${ labelName } : ${ unit . duration } s` ;
122+
115123 const text_info = ctx . measureText ( label ) ;
116124 const label_x = Math . min ( x + 5.0 , canvas_width - text_info . width - X_LINE ) ;
117125 ctx . fillText ( label , label_x , y + BOX_HEIGHT / 2 ) ;
0 commit comments