fix(frontend/player): show nodes count even if no performance tracked. (temp)

This commit is contained in:
Alex Kaminskii 2022-09-19 18:13:25 +02:00
parent 2bd57e2704
commit 3b8ec97a42
2 changed files with 27 additions and 3 deletions

View file

@ -526,6 +526,7 @@ export default class MessageDistributor extends StatedScreen {
this.performanceTrackManager.setCurrentNodesCount(this.windowNodeCounter.count);
break;
}
this.performanceTrackManager.addNodeCountPointIfNeed(msg.time)
this.pagesManager.appendMessage(msg);
break;
}

View file

@ -65,11 +65,34 @@ export default class PerformanceTrackManager extends ListWalker<PerformanceTrack
super.append(msg);
}
// TODO: refactor me
private prevNCTime = 0
addNodeCountPointIfNeed(time: number) {
if ((this.prevTime && time - this.prevTime < 200) || (time - this.prevNCTime < 200)) {
return
}
const lastPoint = this.chart[this.chart.length - 1]
if (lastPoint && lastPoint.nodesCount === this.prevNodesCount) {
return
}
const newPoint = Object.assign({
usedHeap:0,
totalHeap: 0,
fps: null,
cpu: null,
}, lastPoint)
newPoint.time = time
newPoint.nodesCount = this.prevNodesCount
this.chart.push(newPoint)
this.prevNCTime = time
}
setCurrentNodesCount(count: number) {
this.prevNodesCount = count;
if (this.chart.length > 0) {
this.chart[ this.chart.length - 1 ].nodesCount = count;
}
// if (this.chart.length > 0) {
// this.chart[ this.chart.length - 1 ].nodesCount = count;
// }
}
handleVisibility(msg: SetPageVisibility):void {