summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting
diff options
context:
space:
mode:
authorSimon Rettberg2022-04-13 12:50:21 +0200
committerSimon Rettberg2022-04-13 12:50:21 +0200
commit2f719eafb15cfe0a8d10a284b0857d98cc0f89ac (patch)
treeddcbb6ad60d82d29676cc7f602f3c29d3738cfe1 /modules-available/statistics_reporting
parent[statistics] Add PCI device filter option (diff)
downloadslx-admin-2f719eafb15cfe0a8d10a284b0857d98cc0f89ac.tar.gz
slx-admin-2f719eafb15cfe0a8d10a284b0857d98cc0f89ac.tar.xz
slx-admin-2f719eafb15cfe0a8d10a284b0857d98cc0f89ac.zip
[statistics_reporting] Add GPU type counts
Diffstat (limited to 'modules-available/statistics_reporting')
-rw-r--r--modules-available/statistics_reporting/inc/queries.inc.php2
-rw-r--r--modules-available/statistics_reporting/inc/remotereport.inc.php20
2 files changed, 21 insertions, 1 deletions
diff --git a/modules-available/statistics_reporting/inc/queries.inc.php b/modules-available/statistics_reporting/inc/queries.inc.php
index 8c6ff9a8..90c43918 100644
--- a/modules-available/statistics_reporting/inc/queries.inc.php
+++ b/modules-available/statistics_reporting/inc/queries.inc.php
@@ -84,7 +84,7 @@ class Queries
$total['sessions'] = array_merge($total['sessions'], $machine['sessions']);
}
}
- $total['medianSessionLength'] = self::calcMedian($total['sessions']);
+ $total['medianSessionLength'] = $total ? self::calcMedian($total['sessions']) : 0;
unset($total['sessions']);
return $total;
}
diff --git a/modules-available/statistics_reporting/inc/remotereport.inc.php b/modules-available/statistics_reporting/inc/remotereport.inc.php
index fec78542..13daae3a 100644
--- a/modules-available/statistics_reporting/inc/remotereport.inc.php
+++ b/modules-available/statistics_reporting/inc/remotereport.inc.php
@@ -96,6 +96,7 @@ class RemoteReport
$result['days' . $day] = $data;
}
$result['server'] = self::getLocalHardware();
+ $result['gpus'] = self::getGpus();
}
$result['version'] = CONFIG_FOOTER;
return $result;
@@ -138,4 +139,23 @@ class RemoteReport
return $data;
}
+ private static function getGpus()
+ {
+
+ $q = new HardwareQuery(HardwareInfo::PCI_DEVICE, null, true);
+ $q->addGlobalColumn('vendor');
+ $q->addGlobalColumn('device');
+ $q->addGlobalColumn('class')->addCondition('=', '0300'); // VGA adapter
+ $res = $q->query(['vendor', 'device']);
+ $return = [];
+ foreach ($res as $row) {
+ $return[] = [
+ 'group_count' => $row['group_count'],
+ 'device' => $row['device'],
+ 'vendor' => $row['vendor'],
+ ];
+ }
+ return $return;
+ }
+
}