From cf2c58f45e3ea183a85c4a0b81e18b4737671c1f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 17 May 2022 12:18:05 +0200 Subject: [statistics_reporting] Report GPU stats in 7/30/90 fashion --- modules-available/statistics_reporting/inc/remotereport.inc.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules-available/statistics_reporting') 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) { -- cgit v1.2.3-55-g7522