diff --git a/htdocs/crashes.php b/htdocs/crashes.php index 0ac4fc0..3b23f49 100644 --- a/htdocs/crashes.php +++ b/htdocs/crashes.php @@ -17,6 +17,101 @@ Layout::header(); $filter->render(); ?> +

Reports

@@ -26,14 +121,16 @@ $filter->render(); + - + +
Operating System GPU Grid (region)
id, $reports[$i]->id) ?> id, $reports[$i]->client_channel . " " . $reports[$i]->client_version) ?> id, $reports[$i]->os) ?> id, $reports[$i]->gpu) ?> id, $reports[$i]->grid . " (" . $reports[$i]->region . ")") ?>Similar
diff --git a/htdocs/lib/CrashReport.php b/htdocs/lib/CrashReport.php index 596f173..7221a64 100644 --- a/htdocs/lib/CrashReport.php +++ b/htdocs/lib/CrashReport.php @@ -83,7 +83,7 @@ class CrashReport } } - function getReports($filter, $fields = "id, reported, client_version, client_channel, os, gpu, grid, region") + function getReports($filter, $fields = "id, reported, client_version, client_channel, os, gpu, grid, region, signature_id") { $ret = array(); $q = "select $fields from reports " . $filter->getWhere() . kl_str_sql(" order by id desc limit !i offset !i", $filter->limit, $filter->offset); @@ -305,7 +305,15 @@ class CrashReport } } - if ($function == $singu_function) $function = ""; + if ($function == $singu_function) + { + $function = ""; + } + if (!$singu_function && strpos($function, "LL") !== false) + { + $singu_function = $function; + $function = ""; + } $this->signature_text = "$module|$function|$singu_function"; $this->signature = md5($this->signature_text); } diff --git a/htdocs/lib/CrashStats.php b/htdocs/lib/CrashStats.php index f226c56..ff95ae9 100644 --- a/htdocs/lib/CrashStats.php +++ b/htdocs/lib/CrashStats.php @@ -6,7 +6,14 @@ class CrashStats function __construct($filter = null) { - $this->filter = $filter; + if ($filter) + { + $this->filter = $filter; + } + else + { + $this->filter = new SearchFilter; + } } function setFilter($filter) @@ -14,6 +21,49 @@ class CrashStats $this->filter = $filter; } + function getTopCrashers() + { + $ret = array(); + $where = $this->filter->getWhere(); + $q = "select count(r.id) as nr, s.id as signature_id, s.signature as signature_text from reports r join signature s on r.signature_id = s.id $where group by signature_id order by nr desc"; + $q .= kl_str_sql(" limit !i", 100); + if (false !== $cached = Memc::getq($q)) return $cached; + + if (!$res = DBH::$db->query($q)) + { + return $ret; + } + + while ($row = DBH::$db->fetchRow($res)) + { + $r = new stdClass; + DBH::$db->loadFromDbRow($r, $res, $row); + $ret[] = $r; + } + + Memc::setq($q, $ret); + return $ret; + } + + function getSignature($id) + { + $ret = new stdClass; + $q = kl_str_sql("select * from signature where id=!i", $id); + + if (!$res = DBH::$db->query($q)) + { + return false; + } + + if ($row = DBH::$db->fetchRow($res)) + { + DBH::$db->loadFromDbRow($ret, $res, $row); + return $ret; + } + + return false; + } + function getGPUStats() { $ret = array(); diff --git a/htdocs/lib/SearchFilter.php b/htdocs/lib/SearchFilter.php index 31b5883..4c584ab 100644 --- a/htdocs/lib/SearchFilter.php +++ b/htdocs/lib/SearchFilter.php @@ -9,6 +9,7 @@ class SearchFilter public $region; public $gpu; public $stacktrace; + public $signature_id; public $sort_by; public $sort_order; @@ -18,7 +19,7 @@ class SearchFilter public $offset = 0; public $page = 0; - var $fields = array("os", "chan", "version", "grid", "region", "gpu", "stacktrace"); + var $fields = array("os", "chan", "version", "grid", "region", "gpu", "stacktrace", "signature_id"); function __construct() { @@ -76,6 +77,7 @@ class SearchFilter if ($this->grid) $cond[] = kl_str_sql("grid=!s", $this->grid); if ($this->region) $cond[] = kl_str_sql("region=!s", $this->region); if ($this->gpu) $cond[] = kl_str_sql("gpu=!s", $this->gpu); + if ($this->signature_id) $cond[] = kl_str_sql("signature_id=!s", $this->signature_id); if ($this->stacktrace) { @@ -213,6 +215,10 @@ for($i = 0; $i < count($grids); $i++) +signature_id): ?> + + + fetchRow($res)) DBH::$db->loadFromDbRow($r, $res, $row); $r->parseStackTrace(); $r->updateSignature(); - var_dump($r); print "Updating signature for {$r->id}\n"; $r->saveSignature(); } -DBH::$db->commit(); \ No newline at end of file +DBH::$db->commit(); +Memc::flush(); \ No newline at end of file diff --git a/htdocs/report_tip.php b/htdocs/report_tip.php new file mode 100644 index 0000000..7030595 --- /dev/null +++ b/htdocs/report_tip.php @@ -0,0 +1,36 @@ +requireUser(); + +/* +$report = CrashReport::getReport((int)$_GET["id"]); +if (!$report) +{ + print "

No such report

"; + return; +} + + +$full = ReportParser::parse($report->id); +//print_r (array_keys($full)); + +print "

Reported: " . date("r", (int)$report->reported). "

"; +*/ + +$stats = new CrashStats($filter); + +if (false === $r = $stats->getSignature((int)$_GET["signature_id"])) +{ + print "

No such signature

"; +} + +$parts = explode("|", $r->signature); +$txt = ""; +if ($parts[1]) $txt .= preg_replace("/((::|<|>|,|\\(|\\)))/", "\\1", htmlentities($parts[1])); +if ($txt) $txt .= "

"; +if ($parts[2]) $txt .= preg_replace("/((::|<|>|,|\\(|\\)))/", "\\1", htmlentities($parts[2])); + +print "

Module: " . $parts[0]; +if ($txt) print "

" . $txt . "

"; \ No newline at end of file diff --git a/htdocs/statistics.php b/htdocs/statistics.php index 294ae01..fa94800 100644 --- a/htdocs/statistics.php +++ b/htdocs/statistics.php @@ -28,7 +28,39 @@ $filter->render();
-

Working on it

+getURLArgs() . "&signature_id=" . urlencode($r->signature_id); + } + $sigs = $stats->getTopCrashers(); + $c = count($sigs); + if ($c) : +?> + + + + + + +signature_text); + $txt = ""; + if ($parts[1]) $txt .= preg_replace("/((<|>|,|\\(|\\)))/", " \\1 ", htmlentities($parts[1])); + if ($txt) $txt .= "

"; + if ($parts[2]) $txt .= preg_replace("/((<|>|,|\\(|\\)))/", " \\1 ", htmlentities($parts[2])); +?> + + + + + + +
NrModuleStack Top
nr) ?>
+ +