in frontend/app/components/pod_viewer/topology_graph/topology_graph.ts [402:458]
showTooltip(id: string) {
this.tooltipText = '';
let podStatsRecord: PodStatsRecord|null = null;
let coreId = '';
const found =
Object.entries(this.podStatsPerCore || {}).find(([, value]) => {
const chipId = value.chipId || 0;
const nodeId = value.nodeId || 0;
return id === 'node-' + chipId.toString() + '-' + nodeId.toString();
});
if (!found || found.length !== 2) {
return;
}
coreId = found[0];
podStatsRecord = found[1];
if (!podStatsRecord) {
return;
}
const chipId = podStatsRecord.chipId || 0;
const nodeId = podStatsRecord.nodeId || 0;
this.tooltipText += 'pos: (';
this.tooltipText +=
(chipId % (this.hostColumns * this.hostXStride)).toString();
this.tooltipText += ',';
this.tooltipText +=
Math.floor(chipId / (this.hostColumns * this.hostXStride)).toString();
this.tooltipText += ')\n';
this.tooltipText += 'host: ' + (podStatsRecord.hostName || '') + '\n';
this.tooltipText += 'chip id: ' + chipId.toString() + '\n';
this.tooltipText += 'node id: ' + nodeId.toString() + '\n';
if (this.coreIdToReplicaIdMap &&
this.coreIdToReplicaIdMap[coreId] !== undefined) {
this.tooltipText +=
'replica id: ' + this.coreIdToReplicaIdMap[coreId].toString() + '\n';
}
if (this.selectedMetric && this.selectedMetricLabel) {
const value: number = utils.getPodStatsRecordBreakdownProperty(
podStatsRecord, this.selectedMetric.toString());
this.tooltipText += this.selectedMetricLabel.replace('Color: ', '');
this.tooltipText += ' spends ';
this.tooltipText += value.toFixed(2);
this.tooltipText += 'us in total, ';
this.tooltipText += 'taking ';
this.tooltipText += podStatsRecord.totalDurationUs ?
(100 * value / podStatsRecord.totalDurationUs).toFixed(2) :
'0.00';
this.tooltipText += '% of a step.';
}
const nodeInfo = this.getNodePosition(chipId, nodeId);
this.tooltipX = nodeInfo.x + TOOLTIP_OFFSET_X;
this.tooltipY = nodeInfo.y + TOOLTIP_OFFSET_Y;
}