Skip to content

Commit

Permalink
using new column added to tcbs instead of sig summary service prevent…
Browse files Browse the repository at this point in the history
…s the 100 queries horror
  • Loading branch information
Schalk Neethling committed Mar 28, 2012
1 parent 1856640 commit 30571da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 36 deletions.
11 changes: 0 additions & 11 deletions webapp-php/application/config/topcrashers.php-dist
Original file line number Diff line number Diff line change
Expand Up @@ -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";
?>
8 changes: 6 additions & 2 deletions webapp-php/application/controllers/topcrasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
23 changes: 0 additions & 23 deletions webapp-php/application/models/topcrashers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 30571da

Please sign in to comment.