From 30571dae27c68d3d7dad11c1dd7ca595d0f0ced1 Mon Sep 17 00:00:00 2001 From: Schalk Neethling Date: Wed, 28 Mar 2012 13:46:32 +0200 Subject: [PATCH] using new column added to tcbs instead of sig summary service prevents the 100 queries horror --- .../application/config/topcrashers.php-dist | 11 --------- .../application/controllers/topcrasher.php | 8 +++++-- webapp-php/application/models/topcrashers.php | 23 ------------------- 3 files changed, 6 insertions(+), 36 deletions(-) diff --git a/webapp-php/application/config/topcrashers.php-dist b/webapp-php/application/config/topcrashers.php-dist index 0ca5d3376a..477d063f84 100644 --- a/webapp-php/application/config/topcrashers.php-dist +++ b/webapp-php/application/config/topcrashers.php-dist @@ -4,15 +4,4 @@ * The number of signatures to display. */ $config['numberofsignatures'] = 20; - -/** - * The category value against which to check for startup crashes - */ -$config['total_uptime_condition'] = "< 1 min"; - -/** - * The percentage of crashes that needs to be surpased to be marked - * a startup crasher. - */ - $config['percentage_uptime_condition'] = "50"; ?> diff --git a/webapp-php/application/controllers/topcrasher.php b/webapp-php/application/controllers/topcrasher.php index 68f9b0e9e3..769876eafb 100644 --- a/webapp-php/application/controllers/topcrasher.php +++ b/webapp-php/application/controllers/topcrasher.php @@ -317,7 +317,9 @@ public function byversion($product=null, $version=null, $duration=null, $crash_t $top_crasher->{'display_percent'} = number_format($top_crasher->percentOfTotal * 100, 2) . "%"; $top_crasher->{'display_previous_percent'} = number_format($top_crasher->previousPercentOfTotal * 100, 2) . "%"; $top_crasher->{'display_change_percent'} = number_format($top_crasher->changeInPercentOfTotal * 100, 2) . "%"; - $top_crasher->{'startup_crash'} = $this->topcrashers_model->isStartupCrasher($top_crasher->signature, $resp->start_date, $params->end_date); + if(isset($top_crasher->startup_percent) && !empty($top_crasher->startup_percent)) { + $top_crasher->{'startup_crash'} = (round($top_crasher->startup_percent) > 50); + } array_push($signatures, $top_crasher->signature); @@ -410,7 +412,9 @@ public function byos($product=null, $version=null, $os=null, $duration=null, $cr $top_crasher->{'display_percent'} = number_format($top_crasher->percentOfTotal * 100, 2) . "%"; $top_crasher->{'display_previous_percent'} = number_format($top_crasher->previousPercentOfTotal * 100, 2) . "%"; $top_crasher->{'display_change_percent'} = number_format($top_crasher->changeInPercentOfTotal * 100, 2) . "%"; - $top_crasher->{'startup_crash'} = $this->topcrashers_model->isStartupCrasher($top_crasher->signature, $resp->start_date, $params->end_date); + if(isset($top_crasher->startup_percent) && !empty($top_crasher->startup_percent)) { + $top_crasher->{'startup_crash'} = (round($top_crasher->startup_percent) > 50); + } array_push($signatures, $top_crasher->signature); $top_crasher->{'correlation_os'} = Correlation::correlationOsName($top_crasher->win_count, $top_crasher->mac_count, $top_crasher->linux_count); diff --git a/webapp-php/application/models/topcrashers.php b/webapp-php/application/models/topcrashers.php index 096adbde54..9251391071 100644 --- a/webapp-php/application/models/topcrashers.php +++ b/webapp-php/application/models/topcrashers.php @@ -80,29 +80,6 @@ public function buildURI($params, $apiEntry) return implode($separator, $apiData); } - - /** - * Determined whether the current signature can be labeled as a - * startup crasher based on the total percentage for uptime < 1min - * - * @param string the signature - * @param date the start date - * @param date the end date - * @return bool - */ - public function isStartupCrasher($signature, $start_date, $end_date) { - $summary_model = new Signature_Summary_Model(); - $uptime = $summary_model->getSummary('uptime', $signature, $start_date, $end_date); - foreach($uptime as $up) { - $total_uptime = $up->category; - $percentage = round($up->percentage * 100); - - if(($total_uptime === Kohana::config('topcrashers.total_uptime_condition')) && ($percentage > Kohana::config('topcrashers.percentage_uptime_condition'))) { - return TRUE; - } - } - return FALSE; - } /** * Fetch the top crashers data via a web service call.