Fix averages on admin page

This commit is contained in:
2021-01-18 13:40:28 +01:00
parent 61235749b9
commit 63620bdd3f
3 changed files with 41 additions and 43 deletions

View File

@@ -174,12 +174,6 @@ function navigateTimespan(forward) {
// Load performance statistics
let last_update = new Date().getTime();
let last_local_reads = 0;
let last_local_read_size = 0;
let last_remote_reads = 0;
let last_remote_read_size = 0;
let lastOrder;
function getStats(order) {
lastOrder = order
@@ -193,22 +187,14 @@ function getStats(order) {
resp.stats_watcher_listeners / resp.stats_watcher_threads
).toPrecision(3);
let elapsed = (new Date().getTime() - last_update) / 1000;
document.getElementById("local_reads").innerText = resp.local_reads;
document.getElementById("local_read_size").innerText = formatDataVolume(resp.local_read_size, 4);
document.getElementById("remote_reads").innerText = resp.remote_reads;
document.getElementById("remote_read_size").innerText = formatDataVolume(resp.remote_read_size, 4);
document.getElementById("local_reads_rate").innerText = ((resp.local_reads - last_local_reads) / elapsed).toPrecision(4) + " / s";
document.getElementById("local_read_size_rate").innerText = formatDataVolume((resp.local_read_size - last_local_read_size) / elapsed, 4) + " / s";
document.getElementById("remote_reads_rate").innerText = ((resp.remote_reads - last_remote_reads) / elapsed).toPrecision(4) + " / s";
document.getElementById("remote_read_size_rate").innerText = formatDataVolume((resp.remote_read_size - last_remote_read_size) / elapsed, 4) + " / s";
last_update = new Date().getTime();
last_local_reads = resp.local_reads;
last_local_read_size = resp.local_read_size;
last_remote_reads = resp.remote_reads;
last_remote_read_size = resp.remote_read_size;
document.getElementById("local_reads_rate").innerText = resp.local_reads_per_sec.toPrecision(4) + " / s";
document.getElementById("local_read_size_rate").innerText = formatDataVolume(resp.local_read_size_per_sec, 4) + " / s";
document.getElementById("remote_reads_rate").innerText = resp.remote_reads_per_sec.toPrecision(4) + " / s";
document.getElementById("remote_read_size_rate").innerText = formatDataVolume(resp.remote_read_size_per_sec, 4) + " / s";
document.getElementById("db_time").innerText = printDate(new Date(resp.db_time), true, true, true);
document.getElementById("db_latency").innerText = formatNumber(resp.db_latency / 1000, 3) + " ms";

View File

@@ -24,12 +24,12 @@ function addUploadHistory(fileID) {
function printDate(date, hours, minutes, seconds) {
let dateStr = date.getFullYear()
+"-"+("00"+(date.getMonth()+1)).slice(-2)
+"-"+("00"+date.getDate()).slice(-2)
+ "-" + ("00" + (date.getMonth() + 1)).slice(-2)
+ "-" + ("00" + date.getDate()).slice(-2)
if (hours) { dateStr += " "+("00"+date.getHours()).slice(-2) }
if (minutes) { dateStr += ":"+("00"+date.getMinutes()).slice(-2) }
if (seconds) { dateStr += ":"+("00"+date.getMinutes()).slice(-2) }
if (hours) { dateStr += " " + ("00" + date.getHours()).slice(-2) }
if (minutes) { dateStr += ":" + ("00" + date.getMinutes()).slice(-2) }
if (seconds) { dateStr += ":" + ("00" + date.getMinutes()).slice(-2) }
return dateStr
}
@@ -50,9 +50,9 @@ function copyText(text) {
}
function domainURL() {
let url = window.location.protocol+"//"+window.location.hostname;
let url = window.location.protocol + "//" + window.location.hostname;
if (window.location.port != "") {
url = url+":"+window.location.port;
url = url + ":" + window.location.port;
}
return url;
}
@@ -60,44 +60,45 @@ function domainURL() {
function formatNumber(amt, precision) {
if (precision < 3) { precision = 3; }
if (amt >= 1e6) {
return (amt/1e6).toPrecision(precision) + "M";
return (amt / 1e6).toPrecision(precision) + "M";
} else if (amt >= 1e3) {
return (amt/1e3).toPrecision(precision) + "k";
return (amt / 1e3).toPrecision(precision) + "k";
}
return amt
}
function formatThousands(x) {
// Inject a space every three digits
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
function formatDataVolume(amt, precision) {
if (precision < 3) { precision = 3; }
if (amt >= 1e18) {
return (amt/1e18).toPrecision(precision) + " EB";
}else if (amt >= 1e15) {
return (amt/1e15).toPrecision(precision) + " PB";
}else if (amt >= 1e12) {
return (amt/1e12).toPrecision(precision) + " TB";
return (amt / 1e18).toPrecision(precision) + " EB";
} else if (amt >= 1e15) {
return (amt / 1e15).toPrecision(precision) + " PB";
} else if (amt >= 1e12) {
return (amt / 1e12).toPrecision(precision) + " TB";
} else if (amt >= 1e9) {
return (amt/1e9).toPrecision(precision) + " GB";
return (amt / 1e9).toPrecision(precision) + " GB";
} else if (amt >= 1e6) {
return (amt/1e6).toPrecision(precision) + " MB";
return (amt / 1e6).toPrecision(precision) + " MB";
} else if (amt >= 1e3) {
return (amt/1e3).toPrecision(precision) + " kB";
return (amt / 1e3).toPrecision(precision) + " kB";
}
return amt + " B"
return Math.floor(amt) + " B"
}
const second = 1000
const minute = second*60
const hour = minute*60
const day = hour*24
const minute = second * 60
const hour = minute * 60
const day = hour * 24
function formatDuration(ms) {
let res = ""
if (ms >= day) { res += Math.floor(ms/day) + "d " }
if (ms >= hour) { res += Math.floor((ms%day)/hour) + "h " }
if (ms >= minute) { res += Math.floor((ms%hour)/minute) + "m " }
return res + ((ms%minute)/second).toFixed(3) + "s"
if (ms >= day) { res += Math.floor(ms / day) + "d " }
if (ms >= hour) { res += Math.floor((ms % day) / hour) + "h " }
if (ms >= minute) { res += Math.floor((ms % hour) / minute) + "m " }
return res + ((ms % minute) / second).toFixed(3) + "s"
}

View File

@@ -263,6 +263,17 @@
logging
</div>
</div>
<div>
<div class="feat_label">Bandwidth prioritization</div>
<div class="feat_normal">
Bandwidth will be throttled if the servers are
overloaded
</div>
<div class="feat_pro">
<span class="text_highlight">High priority</span>
bandwidth during times of peak usage
</div>
</div>
<div>
<div class="feat_label">Online file previews</div>
<div class="feat_pro">View image, video, audio, PDF and text files directly in your web browser</div>