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 + ' |