// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// script to show task failure rate broken down by vendor or model
require_once("../inc/boinc_db.inc");
require_once("../inc/cache.inc");
require_once("../inc/util.inc");
functioncompare($x,$y){
$n1=$x[1]+$x[3];
$n2=$y[1]+$y[3];
if($n1==$n2)return0;
return($n1<$n2)?1:-1;
}
functionget_models(){
$db=BoincDb::get();
$result=$db->do_query("select result.appid, result.outcome, host.product_name from result join host where host.os_name='Android' and result.hostid=host.id");
$models=array();
while($r=$result->fetch_object()){
// standardize case to combine e.g. Samsung and samsung
//
$name_uc=strtoupper($r->product_name);
if(array_key_exists($name_uc,$models)){
$m=$models[$name_uc];
$m[$r->outcome]++;
$models[$name_uc]=$m;
}else{
$m=array(0,0,0,0,0,0,0,0);
$m[$r->outcome]++;
$models[$name_uc]=$m;
}
}
return$models;
}
functionget_vendors($models){
$vendors=array();
foreach($modelsas$model=>$m){
$name=explode("",$model);
$name=$name[0];
if(array_key_exists($name,$vendors)){
$v=$vendors[$name];
for($i=0;$i<8;$i++){
$v[$i]+=$m[$i];
}
$vendors[$name]=$v;
}else{
$vendors[$name]=$m;
}
}
return$vendors;
}
functionshow_item($name,$c){
$s=$c[1];
$f=$c[3];
$n=$s+$f;
if($n==0)return;
$pct=number_format(100*$s/$n,0)."%";
table_row($name,$s,$f,$pct);
}
functionshow_vendor($vendor,$models){
page_head("Android task success by $vendor models");