mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
Pass loadavg as array from Perfstats
There's no reason we should format the data into a string in the Perfstats module. Let the recipient do what they want with it instead. As an example, we reduce the precision of the loadavg stats in the system status widget. 3 digits precision should be more than enough for this type of status display. Project......: Performance Profiling Sponsored-by.: NLnet NGI0 Commons Fund
This commit is contained in:
@@ -54,7 +54,7 @@ class Perfstats extends Controller
|
||||
$stats = [];
|
||||
|
||||
if (function_exists('sys_getloadavg')) {
|
||||
$stats['loadavg'] = implode(' / ', sys_getloadavg());
|
||||
$stats['loadavg'] = sys_getloadavg();
|
||||
}
|
||||
|
||||
$stats['dbqueries'] = $this->getNumQueries();
|
||||
|
||||
@@ -31,7 +31,11 @@
|
||||
for (const item in json) {
|
||||
element = document.getElementById(`perfstat-${item}-value`);
|
||||
if (element) {
|
||||
if (item === "dbqueries") {
|
||||
if (item === "loadavg") {
|
||||
element.innerText = json['loadavg']
|
||||
.map((v) => v.toPrecision(3))
|
||||
.join(" / ");
|
||||
} else if (item === "dbqueries") {
|
||||
console.log(`dbqueries = ${json['dbqueries']}, ts = ${json['ts']}`);
|
||||
if (status_update_ts !== 0) {
|
||||
let dt = json['ts'] - status_update_ts;
|
||||
|
||||
Reference in New Issue
Block a user