Round all numbers in stats using roundDigits
This commit is contained in:
parent
cc2b41527a
commit
e094372308
|
@ -272,29 +272,29 @@ class Client {
|
|||
|
||||
private setStatistics (stats : SequenceStatistics) {
|
||||
if (stats !== null) {
|
||||
this.set('statsFrameTotalAvg', this.roundDigits(stats.totalFrameAvg, 2).toString());
|
||||
this.set('statsFrameTotalLast', Math.round(stats.totalFrameLast).toString());
|
||||
this.set('statsFrameTotalMargin', Math.round(stats.totalFrameMargin).toString());
|
||||
this.set('statsFrameTotalLast', this.roundDigits(stats.totalFrameLast, 0));
|
||||
this.set('statsFrameTotalAvg', this.roundDigits(stats.totalFrameAvg, 2));
|
||||
this.set('statsFrameTotalMargin', this.roundDigits(stats.totalFrameMargin, 1));
|
||||
|
||||
this.set('statsFPS', this.roundDigits(stats.fps, 2).toString());
|
||||
this.set('statsFPS', this.roundDigits(stats.fps, 2));
|
||||
|
||||
this.set('statsFrameLoadAvg', this.roundDigits(stats.loadAvg, 2).toString());
|
||||
this.set('statsFrameLoadMargin', Math.round(stats.loadMargin).toString());
|
||||
this.set('statsFrameLoadAvg', this.roundDigits(stats.loadAvg, 2));
|
||||
this.set('statsFrameLoadMargin', this.roundDigits(stats.loadMargin, 1));
|
||||
|
||||
this.set('statsFrameOpenLast', Math.round(stats.openLast).toString());
|
||||
this.set('statsFrameOpenAvg', this.roundDigits(stats.openAvg, 2).toString());
|
||||
this.set('statsFrameOpenMargin', Math.round(stats.openMargin).toString());
|
||||
this.set('statsFrameOpenLast', this.roundDigits(stats.openLast, 0));
|
||||
this.set('statsFrameOpenAvg', this.roundDigits(stats.openAvg, 2));
|
||||
this.set('statsFrameOpenMargin', this.roundDigits(stats.openMargin, 1));
|
||||
|
||||
this.set('statsFrameCloseLast', Math.round(stats.closeLast).toString());
|
||||
this.set('statsFrameCloseAvg', this.roundDigits(stats.closeAvg, 2).toString());
|
||||
this.set('statsFrameCloseMargin', Math.round(stats.closeMargin).toString());
|
||||
this.set('statsFrameCloseLast', this.roundDigits(stats.closeLast, 0));
|
||||
this.set('statsFrameCloseAvg', this.roundDigits(stats.closeAvg, 2));
|
||||
this.set('statsFrameCloseMargin', this.roundDigits(stats.closeMargin, 1));
|
||||
|
||||
this.set('statsExposureLast', Math.round(stats.exposureLast).toString());
|
||||
this.set('statsExposureAvg', this.roundDigits(stats.exposureAvg, 2).toString());
|
||||
this.set('statsExposureMargin', Math.round(stats.exposureMargin).toString());
|
||||
this.set('statsExposureLast', this.roundDigits(stats.exposureLast, 0));
|
||||
this.set('statsExposureAvg', this.roundDigits(stats.exposureAvg, 2));
|
||||
this.set('statsExposureMargin', this.roundDigits(stats.exposureMargin, 1));
|
||||
|
||||
this.set('statsElapsed', Math.round(stats.elapsed).toString());
|
||||
this.set('statsEstimate', Math.round(stats.estimate).toString());
|
||||
this.set('statsElapsed', this.roundDigits(stats.elapsed, 0));
|
||||
this.set('statsEstimate', this.roundDigits(stats.estimate, 0));
|
||||
|
||||
this.set('statsElapsedHuman', this.shortenHumanize(Math.round(stats.elapsed)));
|
||||
this.set('statsEstimateHuman', this.shortenHumanize(Math.round(stats.estimate)));
|
||||
|
@ -492,9 +492,10 @@ class Client {
|
|||
.replace('seconds', 's').replace('second', 's');
|
||||
}
|
||||
|
||||
private roundDigits (val : number, digits : number) {
|
||||
private roundDigits (val : number, digits : number) : string {
|
||||
const mult : number = Math.pow(10.0, digits);
|
||||
return Math.round(val * mult) / mult;
|
||||
const rounded : number = Math.round(val * mult) / mult;
|
||||
return rounded.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -225,23 +225,23 @@ class Client {
|
|||
}
|
||||
setStatistics(stats) {
|
||||
if (stats !== null) {
|
||||
this.set('statsFrameTotalAvg', this.roundDigits(stats.totalFrameAvg, 2).toString());
|
||||
this.set('statsFrameTotalLast', Math.round(stats.totalFrameLast).toString());
|
||||
this.set('statsFrameTotalMargin', Math.round(stats.totalFrameMargin).toString());
|
||||
this.set('statsFPS', this.roundDigits(stats.fps, 2).toString());
|
||||
this.set('statsFrameLoadAvg', this.roundDigits(stats.loadAvg, 2).toString());
|
||||
this.set('statsFrameLoadMargin', Math.round(stats.loadMargin).toString());
|
||||
this.set('statsFrameOpenLast', Math.round(stats.openLast).toString());
|
||||
this.set('statsFrameOpenAvg', this.roundDigits(stats.openAvg, 2).toString());
|
||||
this.set('statsFrameOpenMargin', Math.round(stats.openMargin).toString());
|
||||
this.set('statsFrameCloseLast', Math.round(stats.closeLast).toString());
|
||||
this.set('statsFrameCloseAvg', this.roundDigits(stats.closeAvg, 2).toString());
|
||||
this.set('statsFrameCloseMargin', Math.round(stats.closeMargin).toString());
|
||||
this.set('statsExposureLast', Math.round(stats.exposureLast).toString());
|
||||
this.set('statsExposureAvg', this.roundDigits(stats.exposureAvg, 2).toString());
|
||||
this.set('statsExposureMargin', Math.round(stats.exposureMargin).toString());
|
||||
this.set('statsElapsed', Math.round(stats.elapsed).toString());
|
||||
this.set('statsEstimate', Math.round(stats.estimate).toString());
|
||||
this.set('statsFrameTotalLast', this.roundDigits(stats.totalFrameLast, 0));
|
||||
this.set('statsFrameTotalAvg', this.roundDigits(stats.totalFrameAvg, 2));
|
||||
this.set('statsFrameTotalMargin', this.roundDigits(stats.totalFrameMargin, 1));
|
||||
this.set('statsFPS', this.roundDigits(stats.fps, 2));
|
||||
this.set('statsFrameLoadAvg', this.roundDigits(stats.loadAvg, 2));
|
||||
this.set('statsFrameLoadMargin', this.roundDigits(stats.loadMargin, 1));
|
||||
this.set('statsFrameOpenLast', this.roundDigits(stats.openLast, 0));
|
||||
this.set('statsFrameOpenAvg', this.roundDigits(stats.openAvg, 2));
|
||||
this.set('statsFrameOpenMargin', this.roundDigits(stats.openMargin, 1));
|
||||
this.set('statsFrameCloseLast', this.roundDigits(stats.closeLast, 0));
|
||||
this.set('statsFrameCloseAvg', this.roundDigits(stats.closeAvg, 2));
|
||||
this.set('statsFrameCloseMargin', this.roundDigits(stats.closeMargin, 1));
|
||||
this.set('statsExposureLast', this.roundDigits(stats.exposureLast, 0));
|
||||
this.set('statsExposureAvg', this.roundDigits(stats.exposureAvg, 2));
|
||||
this.set('statsExposureMargin', this.roundDigits(stats.exposureMargin, 1));
|
||||
this.set('statsElapsed', this.roundDigits(stats.elapsed, 0));
|
||||
this.set('statsEstimate', this.roundDigits(stats.estimate, 0));
|
||||
this.set('statsElapsedHuman', this.shortenHumanize(Math.round(stats.elapsed)));
|
||||
this.set('statsEstimateHuman', this.shortenHumanize(Math.round(stats.estimate)));
|
||||
}
|
||||
|
@ -414,7 +414,8 @@ class Client {
|
|||
}
|
||||
roundDigits(val, digits) {
|
||||
const mult = Math.pow(10.0, digits);
|
||||
return Math.round(val * mult) / mult;
|
||||
const rounded = Math.round(val * mult) / mult;
|
||||
return rounded.toString();
|
||||
}
|
||||
}
|
||||
client = new Client();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -136,7 +136,7 @@
|
|||
<form id="statisticsForm" onsubmit="return false;" class="flex">
|
||||
<div id="statisticsFrame" class="quarter">
|
||||
<div>
|
||||
<label for="statsFrameTotalAvg">Frame Total Avg</label><input id="statsFrameTotalAvg" class="large" type="text" readonly value="0" /><span> ms +/-</span>
|
||||
<label for="statsFrameTotalAvg">Frame Total Avg</label><input id="statsFrameTotalAvg" class="large" type="text" readonly value="0" /><span> ms ±</span>
|
||||
<input id="statsFrameTotalMargin" class="small" type="text" readonly value="0"/><span>%</span>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -146,20 +146,20 @@
|
|||
<label for="statsFPS">FPS</label><input id="statsFPS" class="large" type="text" readonly value="0" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="statsFrameLoadAvg">Frame Load Avg</label><input id="statsFrameLoadAvg" class="large" type="text" readonly value="0" /><span> ms +/-</span>
|
||||
<label for="statsFrameLoadAvg">Frame Load Avg</label><input id="statsFrameLoadAvg" class="large" type="text" readonly value="0" /><span> ms ±</span>
|
||||
<input id="statsFrameLoadMargin" class="small" type="text" readonly value="0"/><span>%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="statisticsOpenClose" class="quarter">
|
||||
<div>
|
||||
<label for="statsFrameOpenAvg">Cam Open Avg</label><input id="statsFrameOpenAvg" class="large" type="text" readonly value="0" /><span> ms +/-</span>
|
||||
<label for="statsFrameOpenAvg">Cam Open Avg</label><input id="statsFrameOpenAvg" class="large" type="text" readonly value="0" /><span> ms ±</span>
|
||||
<input id="statsFrameOpenMargin" class="small" type="text" readonly value="0"/><span>%</span>
|
||||
</div>
|
||||
<div>
|
||||
<label for="statsFrameOpenLast">Frame Open Last</label><input id="statsFrameOpenLast" class="large" type="text" readonly value="0" /><span> ms</span>
|
||||
</div>
|
||||
<div>
|
||||
<label for="statsFrameCloseAvg">Cam Close Avg</label><input id="statsFrameCloseAvg" class="large" type="text" readonly value="0" /><span> ms +/-</span>
|
||||
<label for="statsFrameCloseAvg">Cam Close Avg</label><input id="statsFrameCloseAvg" class="large" type="text" readonly value="0" /><span> ms ±</span>
|
||||
<input id="statsFrameCloseMargin" class="small" type="text" readonly value="0"/><span>%</span>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -168,7 +168,7 @@
|
|||
</div>
|
||||
<div id="statisticsExposure" class="quarter">
|
||||
<div>
|
||||
<label for="statsExposureAvg">Exposure Avg</label><input id="statsExposureAvg" class="large" type="text" readonly value="0" /><span> ms +/-</span>
|
||||
<label for="statsExposureAvg">Exposure Avg</label><input id="statsExposureAvg" class="large" type="text" readonly value="0" /><span> ms ±</span>
|
||||
<input id="statsExposureMargin" class="small" type="text" readonly value="0"/><span>%</span>
|
||||
</div>
|
||||
<div>
|
||||
|
|
Loading…
Reference in New Issue