Skip to content

Commit d9f0fa3

Browse files
qiuminxujart
authored andcommitted
Fix the bug that Op Profile tool doesn't update to multiple runs. (#687)
1 parent 05a6cf6 commit d9f0fa3

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tensorboard/plugins/profile/tf_op_profile/tf-op-table.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
on-mouseenter="_handleHeaderMouseEnter"
198198
on-mouseleave="_handleHeaderMouseLeave"
199199
hidden="[[!level]]">
200-
<div id="bar"></div>
200+
<div id="bar" style$="width:{{_barWidth(node)}}"></div>
201201
<span id="time">{{_percent(node.metrics.time)}}</span>
202202
<span id="name" style$="padding-left:[[level]]em;">
203203
<span id="disclosure">
@@ -208,7 +208,8 @@
208208
</span>{{node.name}}
209209
</span>
210210
<span id="provenance">{{_provenance(node)}}&nbsp;</span>
211-
<span id="utilization"><div></div></span>
211+
<span id="utilization" style$="background-color:{{_flameColor(node)}}">
212+
{{_utilization(node)}}</span>
212213
</div>
213214
<template is="dom-if" if="[[expanded]]">
214215
<template is="dom-repeat" items="{{node.children}}" sort="_sortEntry">
@@ -266,13 +267,6 @@
266267
var rightTime = right.metrics ? right.metrics.time : 0;
267268
return rightTime - leftTime;
268269
},
269-
ready: function() {
270-
if (!this.node || !this.node.metrics || !this.$.bar) return;
271-
this.$.bar.style.width = percent(this.node.metrics.time);
272-
this.$.utilization.firstChild.innerText = percent(utilization(this.node));
273-
this.$.utilization.style.backgroundColor =
274-
flameColor(utilization(this.node), 1, 0.2);
275-
},
276270
_nextLevel: function(level) { return level + 1; },
277271
_handleHeaderClick: function(e) {
278272
this.expanded ^= true;
@@ -285,8 +279,16 @@
285279
return (node.xla && node.xla.provenance)
286280
? node.xla.provenance.replace(/^.*\//, '') : "";
287281
},
282+
_utilization: function(node) {
283+
return percent(utilization(node));
284+
},
285+
_flameColor: function(node) {
286+
return flameColor(utilization(node), 1, 0.2);
287+
},
288+
_barWidth: function(node) {
289+
return percent(node.metrics.time);
290+
},
288291
_selectedChanged: function(v) { this.classList.toggle('selected', v); }
289292
});
290293
</script>
291294
</dom-module>
292-

0 commit comments

Comments
 (0)