From 8dd56469a429a6069055b588868dc3680cc52ef1 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 11 Feb 2019 16:19:21 +0800 Subject: [PATCH] Update sphinx.js --- plugins/sphinx/js/sphinx.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/plugins/sphinx/js/sphinx.js b/plugins/sphinx/js/sphinx.js index 960a0b5d5..f74cb7693 100755 --- a/plugins/sphinx/js/sphinx.js +++ b/plugins/sphinx/js/sphinx.js @@ -45,6 +45,26 @@ function rebuildIndex(){ }); } +function secToTime(s) { + var t; + if(s > -1){ + var hour = Math.floor(s/3600); + var min = Math.floor(s/60) % 60; + var sec = s % 60; + if(hour < 10) { + t = '0'+ hour + ":"; + } else { + t = hour + ":"; + } + + if(min < 10){t += "0";} + t += min + ":"; + if(sec < 10){t += "0";} + t += sec.toFixed(2); + } + return t; +} + function runStatus(){ spPost('run_status', '', function(data){ @@ -57,7 +77,7 @@ function runStatus(){ console.log(idata); var con = '
\ \ - \ + \ \ \ \
运行时间' + idata.uptime + 's每秒查询' + parseInt(parseInt(idata.queries) / parseInt(idata.uptime)) + '
运行时间' + secToTime(idata.uptime) + '每秒查询' + parseInt(parseInt(idata.queries) / parseInt(idata.uptime)) + '
总连接次数' + idata.connections + 'work_queue_length' +idata.work_queue_length + '
agent_connect' + idata.agent_connect+ 'workers_active' + idata.workers_active + '
agent_retry' + idata.agent_retry + 'workers_total' + idata.workers_total + '