summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting
diff options
context:
space:
mode:
authorSimon Rettberg2022-05-17 12:18:05 +0200
committerSimon Rettberg2022-05-17 12:18:05 +0200
commitcf2c58f45e3ea183a85c4a0b81e18b4737671c1f (patch)
tree673590238ddb17258692926cd77aa2ffbcbdd35e /modules-available/statistics_reporting
parent[locationinfo] His: Remove lecture IDs from event names (diff)
downloadslx-admin-cf2c58f45e3ea183a85c4a0b81e18b4737671c1f.tar.gz
slx-admin-cf2c58f45e3ea183a85c4a0b81e18b4737671c1f.tar.xz
slx-admin-cf2c58f45e3ea183a85c4a0b81e18b4737671c1f.zip
[statistics_reporting] Report GPU stats in 7/30/90 fashion
Diffstat (limited to 'modules-available/statistics_reporting')
-rw-r--r--modules-available/statistics_reporting/inc/remotereport.inc.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules-available/statistics_reporting/inc/remotereport.inc.php b/modules-available/statistics_reporting/inc/remotereport.inc.php
index 13daae3a..e1f2d20e 100644
--- a/modules-available/statistics_reporting/inc/remotereport.inc.php
+++ b/modules-available/statistics_reporting/inc/remotereport.inc.php
@@ -80,7 +80,7 @@ class RemoteReport
foreach ($days as $day) {
if (isset($result['days' . $day]))
continue;
- $from = strtotime("-{$day} days", $to);
+ $from = (int)strtotime("-{$day} days", $to);
GetData::$from = $from;
GetData::$to = $to;
$data = array('total' => GetData::total(GETDATA_ANONYMOUS));
@@ -93,10 +93,10 @@ class RemoteReport
$data['exams'] = Queries::getExamStats($from, $to);
$data['baseSystem'] = Queries::getBaseSystemStats($from, $to);
$data['runmode'] = Queries::getRunmodeStats($from, $to);
+ $data['gpus'] = self::getGpus($from, $to);
$result['days' . $day] = $data;
}
$result['server'] = self::getLocalHardware();
- $result['gpus'] = self::getGpus();
}
$result['version'] = CONFIG_FOOTER;
return $result;
@@ -139,13 +139,15 @@ class RemoteReport
return $data;
}
- private static function getGpus()
+ private static function getGpus(int $from, int $to)
{
$q = new HardwareQuery(HardwareInfo::PCI_DEVICE, null, true);
$q->addGlobalColumn('vendor');
$q->addGlobalColumn('device');
$q->addGlobalColumn('class')->addCondition('=', '0300'); // VGA adapter
+ $q->addMachineWhere('lastseen', '>=', $from);
+ $q->addMachineWhere('lastseen', '<=', $to);
$res = $q->query(['vendor', 'device']);
$return = [];
foreach ($res as $row) {