From 0ccae36b5eba55a6b728110e17205d76715c204b Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sat, 12 Oct 2013 04:00:02 +0200 Subject: [PATCH] Added GPU stats --- htdocs/lib/CrashStats.php | 30 ++++++++++++++++++++++++++++++ htdocs/statistics.php | 25 +++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/htdocs/lib/CrashStats.php b/htdocs/lib/CrashStats.php index 0c4a91d..f226c56 100644 --- a/htdocs/lib/CrashStats.php +++ b/htdocs/lib/CrashStats.php @@ -14,6 +14,36 @@ class CrashStats $this->filter = $filter; } + function getGPUStats() + { + $ret = array(); + $where = $this->filter->getWhere(); + if ($where) + { + $where .= " and "; + } + else + { + $where = "where "; + } + $where .= "gpu is not null"; + $q = "select count(id) as nr, gpu from reports $where group by gpu order by nr desc"; + $q .= kl_str_sql(" limit !i", $this->filter->limit); + if (false !== $cached = Memc::getq($q)) return $cached; + + if (!$res = DBH::$db->query($q)) return $ret; + + while ($row = DBH::$db->fetchRow($res)) + { + $o = new stdClass; + DBH::$db->loadFromDbRow($o, $res, $row); + $ret[] = $o; + } + + Memc::setq($q, $ret); + return $ret; + } + function getOSStats() { $ret = array(); diff --git a/htdocs/statistics.php b/htdocs/statistics.php index c0bd2fe..9bb4a00 100644 --- a/htdocs/statistics.php +++ b/htdocs/statistics.php @@ -28,12 +28,37 @@ $filter->render();
+

Working on it

+getURLArgs() . "&gpu=" . urlencode($r->gpu); + } + $gpus = $stats->getGPUStats(); + $c = count($gpus); + if ($c) : +?> + + + + + + + + + + + +
Nr. reportsGPU Identifier
nr) ?>gpu) ?>
+ +