@@ -75,6 +75,8 @@ function render_pipeline_graph() {
75
75
ctx . translate ( X_LINE , MARGIN ) ;
76
76
77
77
// 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 ( ) ;
78
80
UNIT_COORDS = { } ;
79
81
for ( i = 0 ; i < units . length ; i ++ ) {
80
82
let unit = units [ i ] ;
@@ -86,6 +88,9 @@ function render_pipeline_graph() {
86
88
}
87
89
let width = Math . max ( px_per_sec * unit . duration , 1.0 ) ;
88
90
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 ) ;
89
94
}
90
95
91
96
// Draw the blocks.
@@ -111,7 +116,10 @@ function render_pipeline_graph() {
111
116
ctx . textAlign = 'start' ;
112
117
ctx . textBaseline = 'middle' ;
113
118
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
+
115
123
const text_info = ctx . measureText ( label ) ;
116
124
const label_x = Math . min ( x + 5.0 , canvas_width - text_info . width - X_LINE ) ;
117
125
ctx . fillText ( label , label_x , y + BOX_HEIGHT / 2 ) ;
0 commit comments