1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-22 15:20:09 +01:00

Added tracking loading time

This commit is contained in:
Donald Cheng Hong Zou 2022-01-19 10:43:39 -05:00
parent fcfd816cec
commit ed2c3f43c7
2 changed files with 8 additions and 2 deletions

View File

@ -338,9 +338,12 @@
* Load Peers from server to configuration page * Load Peers from server to configuration page
* @param searchString * @param searchString
*/ */
let d1 = new Date();
let time = 0;
let count = 0;
function loadPeers(searchString){ function loadPeers(searchString){
startProgressBar(); startProgressBar();
let d1 = new Date(); d1 = new Date();
$.ajax({ $.ajax({
method: "GET", method: "GET",
url: `/get_config/${conf_name}?search=${encodeURIComponent(searchString)}`, url: `/get_config/${conf_name}?search=${encodeURIComponent(searchString)}`,
@ -357,6 +360,9 @@
endProgressBar(); endProgressBar();
let d2 = new Date(); let d2 = new Date();
let seconds = (d2 - d1); let seconds = (d2 - d1);
time += seconds;
count += 1;
console.log(`Average ${time/count}ms`);
$("#peer_loading_time").html(`Peer Loading Time: ${seconds}ms`); $("#peer_loading_time").html(`Peer Loading Time: ${seconds}ms`);
}).fail(function(){ }).fail(function(){
noResponding(); noResponding();

File diff suppressed because one or more lines are too long