Ignore:
Timestamp:
Jun 28, 2018, 1:19:10 PM (18 months ago)
Author:
mabarracus
Message:

Allow app query with like value in extended stats
Fix bugs with query app

Location:
lliurex-analytics-server/trunk/fuentes
Files:
3 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • lliurex-analytics-server/trunk/fuentes/debian/changelog

    r7280 r7577  
     1lliurex-analytics-server (0.3.1) xenial; urgency=medium
     2
     3  * Allow app query with like value in extended stats
     4  * Fix bugs with query app
     5
     6 -- M.Angel Juan <m.angel.juan@gmail.com>  Thu, 28 Jun 2018 13:11:56 +0200
     7
     8lliurex-analytics-server (0.3) unreleased; urgency=medium
     9
     10  * New improved release
     11
     12 -- M.Angel Juan <m.angel.juan@gmail.com>  Wed, 27 Jun 2018 15:04:12 +0200
     13
    114lliurex-analytics-server (0.2.6.5) xenial; urgency=medium
    215
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/db.php

    r7204 r7577  
    341341            }
    342342        }
     343    function execute_sql_array($arr,$fkey=false){
     344        if (! is_array($arr)){
     345                return false;
     346        }
     347        $time=0;
     348        foreach ($arr as $key => $value){
     349                if (! $fkey or $key == $fkey){
     350                        $stime=microtime(true);
     351                        $result=$this->dbconn->query($value);
     352                        if (!$result){
     353                                die("Error in sql '".$value."' -> ".$this->dbconn->error);
     354                        }
     355                        $time += microtime(true) - $stime;
     356                }
     357        }
     358        return $time;
     359    }
    343360    function get_extended_data($app){
    344         //$today=date("Y-m-d");
    345         //$min_date=date("Y-m",strtotime($today." -1 year")).'-01';
    346361        $this->times=0;
    347         // CLIENTS DISTRIBUTION PER RELEASE/FLAVOUR
    348         //$sql="select year(date) as year,month(date) as month,Releases_name,Flavours_name,count(*) as num_hosts from (select distinct Client_uid,date,Releases_name,Flavours_name from Client_Versions where date >= '$min_date' )t group by year,month,Releases_name,Flavours_name order by year Desc,month desc,Releases_name asc,num_hosts desc";
    349         $sql="select compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name,Flavours_name,count(Client_uid) as total from (select DISTINCT Client_uid,year(date) as year,month(date) as month,Releases_name,Flavours_name from Client_Versions) q group by year,month,Releases_name,Flavours_name) target on compat.year = target.year and compat.month = target.month and compat.rel = target.Releases_name and compat.fla = target.Flavours_name order by year desc,month desc,rel asc,fla asc";
    350         $cache = new Cache;
    351         $cache_key='extended_1';
     362        $cache = new Cache;
     363        $use_memtable=true;
     364        $use_views=false;
     365        $split_tables=false;
     366         // CLIENT UPDATES
     367        $sql_compat_tables=array();
     368        $table = 'Client_Versions';
     369        if ($use_views){
     370                $split_tables=true;
     371                $sql_compat_tables[]="create or replace view cv as (select Client_uid,date,Releases_name,Flavours_name,string_release from $table)";
     372                $sql_compat_tables[]="create or replace view cv_a as (select Client_uid,date,Releases_name,Flavours_name,arch from $table)";
     373                $sql_compat_tables[]="create or replace view cv_m as (select Client_uid,date,Releases_name,Flavours_name,mem from $table)";     
     374                $sql_compat_tables[]="create or replace view cv_c as (select Client_uid,date,Releases_name,Flavours_name,ncpu from $table)";
     375                $sql_compat_tables[]="create or replace view cv_l as (select Client_uid,date,Releases_name,Flavours_name,ltsp,mode from $table)";
     376                $table = 'cv';
     377        }
     378        if ($use_memtable){
     379                if (! $split_tables){
     380                        $sql_compat_tables[]="create temporary table if not exists cv engine=memory as (select Client_uid,date,Releases_name,Flavours_name,string_release,arch,mem,ncpu,ltsp,mode from $table)";
     381                //      $sql_compat_tables[]="alter table cv add primary key(Client_uid,date,Releases_name,Flavours_name,arch,mem,ncpu,uuid)"; 
     382                //      $sql_compat_tables[]="create index a on cv(Client_uid,date) using btree";
     383                //      $sql_compat_tables[]="create index b on cv(arch,date,) using btree";
     384                //      $sql_compat_tables[]="create index c on cv(date,mem) using btree";
     385                //      $sql_compat_tables[]="create index d on cv(date,ncpu) using btree";
     386                }else{
     387                        $sql_compat_tables[]="create temporary table if not exists cv engine=memory as (select Client_uid,date,Releases_name,Flavours_name,string_release from $table)";
     388                        $sql_compat_tables[]="create temporary table if not exists cv_a engine=memory as (select Client_uid,date,Releases_name,Flavours_name,arch from $table)";
     389                        $sql_compat_tables[]="create temporary table if not exists cv_m engine=memory as (select Client_uid,date,Releases_name,Flavours_name,mem from $table)";
     390                        $sql_compat_tables[]="create temporary table if not exists cv_c engine=memory as (select Client_uid,date,Releases_name,Flavours_name,ncpu from $table)";
     391                        $sql_compat_tables[]="create temporary table if not exists cv_l engine=memory as (select Client_uid,date,Releases_name,Flavours_name,ltsp,mode from $table)";
     392                }
     393        }
     394        if ($use_memtable or $use_views){
     395                $table='cv';
     396        }
     397        if($split_tables){
     398                $table_a=$table.'_a';
     399                $table_m=$table.'_m';
     400                $table_c=$table.'_c';
     401                $table_l=$table.'_l';
     402        }else{
     403                $table_a=$table;
     404                $table_m=$table;
     405                $table_c=$table;
     406                $table_l=$table;
     407        }
     408        $sql_compat_tables[]="create temporary table if not exists dates engine=memory as (select * from (select year,month from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now())compat)dates order by year, month)";
     409        $sql_compat_tables[]="create temporary table if not exists compat_rf engine=memory as (select * from dates join (select name as rel from Releases where Releases.name != 'other')rels join (select name as fla from Flavours)flas)";
     410        $sql_compat_tables[]="create temporary table if not exists compat_rfa engine=memory as (select * from compat_rf join (select 'x86_64' as arch union all select 'i686' union all select 'UNKN')arches)";
     411        $sql_compat_tables[]="create temporary table if not exists compat_t engine=memory as (select * from dates join(select 0 as type union all select 1 union all select 'UNKN') types)";
     412        $sql_compat_tables[]="create temporary table if not exists compat_m engine=memory as (select * from dates join (select 'THIN' as mode union all select 'SEMI' union all select 'FAT' union all select 'UNKN') types)";
     413       
     414        $sql_nhosts=array();
     415        $sql_nhosts[]="/*Num total hosts detailed*/ create temporary table if not exists nhosts_detail engine=memory as (select * from compat_rf left join (select year,month,rel,fla,ifnull(count(*),0) as total_hosts from (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,Client_uid from (select Client_uid,Releases_name,Flavours_name,date from $table order by date desc)t group by year(date),month(date),Client_uid)unique_last_clients group by year,month,rel,fla)detailed using (year,month,rel,fla));";
     416        $sql_nhosts[]="/*Num total hosts*/ create temporary table if not exists nhosts engine=memory as (select year,month,sum(total_hosts) as total_hosts from nhosts_detail group by year,month);";
     417        $sql_upd=array();
     418        $sql_upd[]="/*Num host single entry*/ create temporary table if not exists single_entry engine=memory as (select year,month,ifnull(single_entry,0) as single_entry from dates left join (select year,month,count(*) as single_entry from (select year(date) as year, month(date) as month from $table group by year(date),month(date),Client_uid having count(*) = 1)a group by year,month)singles using(year,month));";
     419        $sql_upd[]="/*A+B*/ create temporary table if not exists ab engine=memory as (select distinct year,month,Client_uid from ( select Distinct Client_uid,Releases_name,year(date) as year,month(date) as month from $table)t group by year,month,Client_uid having count(*) > 1);";
     420        $sql_upd[]="create index a on ab (Client_uid,year,month) using btree;";
     421        $sql_upd[]="/*B+C+D*/ create temporary table if not exists bcd engine=memory as (select distinct year,month,Client_uid from ( select Distinct Client_uid,Flavours_name,year(date) as year,month(date) as month from $table)t group by year,month,Client_uid having count(*) > 1);";
     422        $sql_upd[]="create index a on bcd (Client_uid,year,month) using btree;";       
     423        $sql_upd[]="/* B */ create temporary table if not exists b engine=memory as (select * from ab join bcd using(year,month,Client_uid));";
     424        $sql_upd[]="/* A */ create temporary table if not exists a engine=memory as (select * from ab left join bcd using(year,month,Client_uid) where bcd.Client_uid is null); ";
     425        $sql_upd[]="/* A+B+C */ create temporary table if not exists abc_plus_part_e engine=memory as (select distinct year,month,Client_uid from ( select Distinct Client_uid,string_release,year(date) as year,month(date) as month from $table)t group by year,month,Client_uid having count(*) > 1);";
     426        $sql_upd[]="create index a on abc_plus_part_e (Client_uid,year,month) using btree;";
     427        $sql_upd[]="/* C+D */ create temporary table if not exists cd engine=memory as (select * from ab right join bcd using(year,month,Client_uid) where ab.Client_uid is null);";
     428        $sql_upd[]="create index a on cd (Client_uid,year,month) using btree;";
     429        $sql_upd[]="/* D */ create temporary table if not exists d engine=memory as (select * from cd left join abc_plus_part_e using(year,month,Client_uid) where abc_plus_part_e.Client_uid is null);";
     430        $sql_upd[]="create index a on d (Client_uid,year,month) using btree;";
     431        $sql_upd[]="/* C */ create temporary table if not exists c engine=memory as (select * from cd left join d using(year,month,Client_uid) where d.Client_uid is null );";
     432        $sql_upd[]="create temporary table if not exists na engine=memory as (select year,month,ifnull(a,0) as a from dates left join (select year,month,count(*) as a from a group by year,month)t using(year,month));";
     433        $sql_upd[]="create temporary table if not exists nb engine=memory as (select year,month,ifnull(b,0) as b from dates left join (select year,month,count(*) as b from b group by year,month)t using(year,month));";
     434        $sql_upd[]="create temporary table if not exists nc engine=memory as (select year,month,ifnull(c,0) as c from dates left join (select year,month,count(*) as c from c group by year,month)t using(year,month));";
     435        $sql_upd[]="create temporary table if not exists nd engine=memory as (select year,month,ifnull(d,0) as d from dates left join (select year,month,count(*) as d from d group by year,month)t using(year,month));";
     436        $sql_upd[]="/* temp */ create temporary table tmp_resume engine=memory as (select * from dates left join nhosts using(year,month) join single_entry using(year,month) join na using(year,month) join nb using(year,month) join nc using(year,month) join nd using(year,month));";
     437        $sql_upd[]="/* resume */ create temporary table resume engine=memory as (select year,month,total_hosts,single_entry,total_hosts-single_entry as target_hosts,a,b,c,d, total_hosts-single_entry-a-b-c-d as e from tmp_resume);";
     438       
     439        $sql_targets=array();
     440        $sql_targets['arch']="create temporary table if not exists target_arch engine=memory as (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,ifnull(if( arch like 'NULL',NULL,arch),'UNKN') as arch,count(distinct Client_uid) as total from $table_a group by year,month,Releases_name,Flavours_name,arch)";
     441        $sql_targets['memnull']="create temporary table if not exists target_memnull engine=memory as (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(distinct Client_uid) as total from $table_m where mem is null and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla)";
     442        $sql_targets['mem2G']="create temporary table if not exists target_mem2G engine=memory as (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(distinct Client_uid) as total from $table_m where mem < 2048000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla)";
     443        $sql_targets['mem4G']="create temporary table if not exists target_mem4G engine=memory as (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(distinct Client_uid) as total from $table_m where mem > 2048000 and mem < 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla)";
     444        $sql_targets['mem8G']="create temporary table if not exists target_mem8G engine=memory as (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(distinct Client_uid) as total from $table_m where mem > 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla)";
     445        $sql_targets['cpunull']="create temporary table if not exists target_cpunull engine=memory as (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(distinct Client_uid) as total from $table_c where ncpu is null and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla)";
     446        $sql_targets['cpu_mono']="create temporary table if not exists target_cpu_mono engine=memory as (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(distinct Client_uid) as total from $table_c where ncpu < 2 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla)";
     447        $sql_targets['cpu_dual']="create temporary table if not exists target_cpu_dual engine=memory as (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(distinct Client_uid) as total from $table_c where ncpu > 1 and ncpu < 5 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla)";
     448        $sql_targets['cpu_more']="create temporary table if not exists target_cpu_more engine=memory as (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(distinct Client_uid) as total from $table_c where ncpu  > 4 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla)";
     449        $sql_targets['ltsp_type']="create temporary table if not exists target_type engine=memory as(select year(date) as year,month(date) as month,ifnull(ltsp,'UNKN') as type,count(distinct Client_uid) as total from $table_l where Flavours_name = 'client' and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,ltsp)";
     450        $sql_targets['ltsp_mode']="create temporary table if not exists target_mode engine=memory as (select year(date) as year,month(date) as month,ifnull(mode,'UNKN') as mode,count(distinct Client_uid) as total from $table_l where Flavours_name = 'client' and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,mode)";
     451       
     452
     453        $exec_time=$this->execute_sql_array($sql_compat_tables);
     454        if ($exec_time){
     455                $this->times+=$exec_time;
     456        }
     457
     458        $sql_upd_show="select * from resume order by year desc, month desc";
     459        $cache_key='updates';
     460        $data = $cache->get($cache_key);
     461        $updated_nhosts=false;
     462        $stime=microtime(true);
     463        if ($data != false){
     464                $num_updates_month=$data['num_updates_month'];
     465                $machines_month=$data['machines_month'];
     466                $change_releases=$data['change_releases'];
     467                $change_flavour=$data['change_flavour'];
     468        }else{
     469                if($this->execute_sql_array($sql_nhosts)){
     470                        $updated_nhosts=true;
     471                }
     472                $this->execute_sql_array($sql_upd);
     473                $result=$this->dbconn->query($sql_upd_show);
     474                if ($result){
     475                        $machines_month=[0,0,0,0,0,0,0,0,0,0,0,0];
     476                        $num_updates_month=[0,0,0,0,0,0,0,0,0,0,0,0];
     477                        $change_releases=[0,0,0,0,0,0,0,0,0,0,0,0];
     478                        $change_flavour=[0,0,0,0,0,0,0,0,0,0,0,0];
     479                        $num_updates_month=array();
     480                        $this->times+=microtime(true)-$stime;
     481                        $i=0;
     482                        $tmp=[];
     483                        while($row=$result->fetch_array(MYSQLI_ASSOC)){
     484                                $machines_month[$i]=intval($row['total_hosts']);
     485                                $change_releases[$i]=intval($row['a'])+intval($row['b']);
     486                                $change_flavour[$i]=intval($row['c'])+intval($row['d']);
     487                                $num_updates_month[$i]=intval($row['e']);
     488                                $i++;
     489                        }
     490                        $cache->store(array('num_updates_month'=>$num_updates_month,'machines_month'=>$machines_month,'change_releases'=>$change_releases,'change_flavour'=>$change_flavour),$cache_key);
     491                }else{
     492                        $num_updates_month=$this->dbconn->error;
     493                        $machines_month=$this->dbconn->error;
     494                        $change_releases=$this->dbconn->error;
     495                        $change_flavour=$this->dbconn->error;
     496                }
     497        }
     498        $sql="select * from nhosts_detail order by year desc, month desc;";
     499        $cache_key='nhosts_detail';
    352500        $data = $cache->get($cache_key);
    353501        $stime=microtime(true);
     
    355503            $clients_month=$data;
    356504        }else{
     505            if (!$updated_nhosts){
     506                $this->execute_sql_array($sql_nhosts);
     507            }
    357508            $result=$this->dbconn->query($sql);
    358509            if ($result){
    359510                $this->times+=microtime(true)-$stime;
    360511                $clients_month=[];
    361                 $tmp=[];
    362                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    363                     $date=$row['year'].'_'.$row['month'];
     512                $tmp=[];
     513                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     514                    $date=$row['year'].'_'.$row['month'];
     515                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total_hosts']);
     516                }
     517                foreach($tmp as $date_value){
     518                        $clients_month[]=$date_value;
     519                }
     520                $cache->store($clients_month,$cache_key);
     521            }else{
     522                $clients_month=$this->dbconn->error;
     523            }
     524        }
     525        // architecture
     526        $sql_arch="select compat_rfa.year,compat_rfa.month,compat_rfa.rel,compat_rfa.fla,compat_rfa.arch,ifnull(target_arch.total,0) as total from compat_rfa left join target_arch using(year,month,rel,fla,arch) order by year desc,month desc,rel asc,fla asc, arch asc";
     527        $cache_key='extended_arch';
     528        $data = $cache->get($cache_key);
     529        $stime=microtime(true);
     530        if ($data != false){
     531            $clients_arch=$data;
     532        }else{
     533            $this->execute_sql_array($sql_targets,'arch');
     534            $result=$this->dbconn->query($sql_arch);
     535            if ($result){
     536                $this->times+=microtime(true)-$stime;
     537                $clients_arch=[];
     538                $tmp=[];
     539                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     540                        $date=$row['year']+'_'+$row['month'];
     541                        $tmp[$date][$row['rel']][$row['fla']][strtolower($row['arch'])]=intval($row['total']);
     542                }
     543                foreach($tmp as $d){
     544                        $clients_arch[]=$d;
     545                }
     546                $cache->store($clients_arch,$cache_key);
     547            }else{
     548                $clients_arch=$this->dbconn->error;
     549            }
     550        }
     551        // memory
     552        $sql_memnull="select compat_rf.year,compat_rf.month,compat_rf.rel,compat_rf.fla,ifnull(target_memnull.total,0) as total from compat_rf left join target_memnull using(year,month,rel,fla) order by year desc,month desc,compat_rf.rel asc,compat_rf.fla asc";
     553        $cache_key='extended_memory_null';
     554        $data = $cache->get($cache_key);
     555        $stime=microtime(true);
     556        if ($data != false){
     557            $clients_memnull=$data;
     558        }else{
     559            $this->execute_sql_array($sql_targets,'memnull');
     560            $result=$this->dbconn->query($sql_memnull);
     561            if ($result){
     562                $this->times+=microtime(true)-$stime;
     563                $clients_memnull=[];
     564                $tmp=[];
     565                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     566                    $date=$row['year']+'_'+$row['month'];
    364567                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    365568                }
    366                 foreach ($tmp as $date){
    367                     $clients_month[]=$date;
    368                 }
    369                 $cache->store($clients_month,$cache_key);
    370             }else{
    371                 $clients_month=$this->dbconn->error;
    372             }
    373         }
    374         $sql="select compat.year,compat.month,ifnull(target.total,0) as total from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat left join (select year,month,count(Client_uid) as total from (select DISTINCT Client_uid,year(date) as year,month(date) as month from Client_Versions) q group by year,month) target on compat.year = target.year and compat.month = target.month order by year desc,month desc ";
    375         $cache = new Cache;
    376         $cache_key='extended_1b';
    377         $data = $cache->get($cache_key);
    378         $stime=microtime(true);
    379         if ($data != false){
    380             $machines_month=$data;
    381         }else{
    382             $result=$this->dbconn->query($sql);
    383             if ($result){
    384                 $this->times+=microtime(true)-$stime;
    385                 $machines_month=[];
    386                 $tmp=[0,0,0,0,0,0,0,0,0,0,0,0];
    387                 $i=0;
    388                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    389                     $tmp[$i++]=intval($row['total']);
    390                 }
    391                 foreach ($tmp as $date){
    392                     $machines_month[]=$date;
    393                 }
    394                 $cache->store($machines_month,$cache_key);
    395             }else{
    396                 $machines_month=$this->dbconn->error;
    397             }
    398         }   
    399         // architecture
    400         //$sql="select year(date) as year, month(date) as month, Releases_name, count(arch) as count, arch from Client_Versions group by Releases_name,year,month,arch order by year desc,month desc,Releases_name asc,arch asc;";
    401         $sql="select compat.year,compat.month,compat.rel,compat.fla,compat.arch,ifnull(target.total,0) as total from (select year,month,rel,fla,arch from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours inner join (select 'x86_64' as arch union all select 'i386') arches) compat left join (select year,month,Releases_name,Flavours_name,arch,count(Client_uid) as total from (select DISTINCT Client_uid,year(date) as year,month(date) as month,Releases_name,Flavours_name,arch from Client_Versions) q group by year,month,Releases_name,Flavours_name,arch) target on compat.year = target.year and compat.month = target.month and compat.rel = target.Releases_name and compat.fla = target.Flavours_name and compat.arch = target.arch order by year desc,month desc,rel asc,fla asc, arch asc";
    402         $cache_key='extended_arch';
    403         $data = $cache->get($cache_key);
    404         $stime=microtime(true);
    405         if ($data != false){
    406             $clients_arch=$data;
    407         }else{
    408             $result=$this->dbconn->query($sql);
    409             if ($result){
    410                 $this->times+=microtime(true)-$stime;
    411                 $clients_arch=[];
    412                 $tmp=[];
    413                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    414                     $date=$row['year'].'_'.$row['month'];
    415                     $tmp[$date][$row['rel']][$row['fla']][$row['arch']]=intval($row['total']);
    416                 }
    417                 foreach ($tmp as $date){
    418                     $clients_arch[]=$date;
    419                 }
    420                 $cache->store($clients_arch,$cache_key);
    421             }else{
    422                 $clients_arch=$this->dbconn->error;
    423             }
    424         }
    425         // memory
    426         //$sql_2G = "select year(date) as year,month(date) as month,Releases_name as rel,count(uuid) as count from Client_Versions where mem < 2048000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel order by year  desc,month desc,rel asc";
    427         //$sql_2G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(uuid) as total from Client_Versions where mem < 2048000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc";
    428         $sql_2G="SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where mem < 2048000 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc";
     569                foreach($tmp as $d){
     570                        $clients_memnull[]=$d;
     571                }
     572                $cache->store($clients_memnull,$cache_key);
     573            }else{
     574                $clients_memnull=$this->dbconn->error;
     575            }
     576        }
     577        $sql_mem2G="select compat_rf.year,compat_rf.month,compat_rf.rel,compat_rf.fla,ifnull(target_mem2G.total,0) as total from compat_rf left join target_mem2G using(year,month,rel,fla) order by year desc,month desc,compat_rf.rel asc,compat_rf.fla asc";
    429578        $cache_key='extended_memory_2G';
    430579        $data = $cache->get($cache_key);
     
    433582            $clients_2G=$data;
    434583        }else{
    435             $result=$this->dbconn->query($sql_2G);
     584            $this->execute_sql_array($sql_targets,'mem2G');
     585            $result=$this->dbconn->query($sql_mem2G);
    436586            if ($result){
    437587                $this->times+=microtime(true)-$stime;
    438588                $clients_2G=[];
    439                 $tmp=[];
    440                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    441                     $date=$row['year'].'_'.$row['month'];
     589                $tmp=[];
     590                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     591                    $date=$row['year']+'_'+$row['month'];
    442592                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    443593                }
    444                 foreach ($tmp as $date){
    445                     $clients_2G[]=$date;
    446                 }
     594                foreach($tmp as $d){
     595                        $clients_2G[]=$d;
     596                }
    447597                $cache->store($clients_2G,$cache_key);
    448598            }else{
     
    450600            }
    451601        }
    452         //$sql_4G = "select year(date) as year,month(date) as month,Releases_name as rel,count(uuid) as count from Client_Versions where mem > 2048000  and mem < 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel order by year  desc,month desc,rel asc";
    453         //$sql_4G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(uuid) as total from Client_Versions where mem > 2048000 and mem < 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc";
    454         $sql_4G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where mem > 2048000 and mem < 4096000 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc";
     602        $sql_mem4G="select compat_rf.year,compat_rf.month,compat_rf.rel,compat_rf.fla,ifnull(target_mem4G.total,0) as total from compat_rf left join target_mem4G using(year,month,rel,fla) order by year desc,month desc,compat_rf.rel asc,compat_rf.fla asc";
    455603        $cache_key='extended_memory_4G';
    456604        $data = $cache->get($cache_key);
     
    459607            $clients_4G=$data;
    460608        }else{
    461             $result=$this->dbconn->query($sql_4G);
     609            $this->execute_sql_array($sql_targets,'mem4G');
     610            $result=$this->dbconn->query($sql_mem4G);
    462611            if ($result){
    463612                $this->times+=microtime(true)-$stime;
    464613                $clients_4G=[];
    465                 $tmp=[];
    466                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    467                     $date=$row['year'].'_'.$row['month'];
     614                $tmp=[];
     615                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     616                    $date=$row['year']+'_'+$row['month'];
    468617                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    469618                }
    470                 foreach ($tmp as $date){
    471                     $clients_4G[]=$date;
    472                 }
     619                foreach($tmp as $d){
     620                        $clients_4G[]=$d;
     621                }
    473622                $cache->store($clients_4G,$cache_key);
    474623            }else{
     
    476625            }
    477626        }
    478         //$sql_8G = "select year(date) as year,month(date) as month,Releases_name as rel,count(uuid) as count from Client_Versions where mem > 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel order by year  desc,month desc,rel asc";
    479         //$sql_8G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(uuid) as total from Client_Versions where mem > 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc";
    480         $sql_8G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where mem > 4096000 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc";
     627        $sql_mem8G="select compat_rf.year,compat_rf.month,compat_rf.rel,compat_rf.fla,ifnull(target_mem8G.total,0) as total from compat_rf left join target_mem8G using(year,month,rel,fla) order by year desc,month desc,compat_rf.rel asc,compat_rf.fla asc";
    481628        $cache_key='extended_memory_8G';
    482629        $data = $cache->get($cache_key);
     
    485632            $clients_8G=$data;
    486633        }else{
    487             $result=$this->dbconn->query($sql_8G);
     634            $this->execute_sql_array($sql_targets,'mem8G');
     635            $result=$this->dbconn->query($sql_mem8G);
    488636            if ($result){
    489637                $this->times+=microtime(true)-$stime;
    490638                $clients_8G=[];
    491                 $tmp=[];
    492                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    493                     $date=$row['year'].'_'.$row['month'];
     639                $tmp=[];
     640                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     641                    $date=$row['year']+'_'+$row['month'];
    494642                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    495643                }
    496                 foreach ($tmp as $date){
    497                     $clients_8G[]=$date;
    498                 }
     644                foreach($tmp as $d){
     645                        $clients_8G[]=$d;
     646                }
    499647                $cache->store($clients_8G,$cache_key);
    500648            }else{
     
    503651        }
    504652        // cpu
    505         //$sql_mono= "select compact.year,compact.month,compact.rel,ifnull(total,0) as total from (select year,month,rel from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu = 1 group by year,month,rel) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel";
    506         //$sql_mono = "select compact.year,compact.month,compact.rel,compact.fla,ifnull(total,0) as total from (select year,month,rel,fla from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other')flavours) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, Flavours_name as fla,count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu = 1 group by year,month,rel,fla) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel and compact.fla = ct.fla order by year desc,month desc,rel asc,fla asc";
    507         $sql_mono = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where ncpu < 2 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc";
     653        $sql_cpunull="select compat_rf.year,compat_rf.month,compat_rf.rel,compat_rf.fla,ifnull(target_cpunull.total,0) as total from compat_rf left join target_cpunull using(year,month,rel,fla) order by year desc,month desc,compat_rf.rel asc,compat_rf.fla asc";
     654        $cache_key='extended_memory_cpunull';
     655        $data = $cache->get($cache_key);
     656        $stime=microtime(true);
     657        if ($data != false){
     658            $clients_cpunull=$data;
     659        }else{
     660            $this->execute_sql_array($sql_targets,'cpunull');
     661            $result=$this->dbconn->query($sql_cpunull);
     662            if ($result){
     663                $this->times+=microtime(true)-$stime;
     664                $clients_cpunull=[];
     665                $tmp=[];
     666                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     667                    $date=$row['year']+'_'+$row['month'];
     668                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
     669                }
     670                foreach($tmp as $d){
     671                        $clients_cpunull[]=$d;
     672                }
     673                $cache->store($clients_cpunull,$cache_key);
     674            }else{
     675                $clients_mono=$this->dbconn->error;
     676            }
     677        }
     678        $sql_cpu_mono="select compat_rf.year,compat_rf.month,compat_rf.rel,compat_rf.fla,ifnull(target_cpu_mono.total,0) as total from compat_rf left join target_cpu_mono using(year,month,rel,fla) order by year desc,month desc,compat_rf.rel asc,compat_rf.fla asc";
    508679        $cache_key='extended_memory_cpu_mono';
    509680        $data = $cache->get($cache_key);
     
    512683            $clients_mono=$data;
    513684        }else{
    514             $result=$this->dbconn->query($sql_mono);
     685            $this->execute_sql_array($sql_targets,'cpu_mono');
     686            $result=$this->dbconn->query($sql_cpu_mono);
    515687            if ($result){
    516688                $this->times+=microtime(true)-$stime;
    517689                $clients_mono=[];
    518                 $tmp=[];
    519                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    520                     $date=$row['year'].'_'.$row['month'];
     690                $tmp=[];
     691                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     692                    $date=$row['year']+'_'+$row['month'];
    521693                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    522694                }
    523                 foreach ($tmp as $date){
    524                     $clients_mono[]=$date;
    525                 }
     695                foreach($tmp as $d){
     696                        $clients_mono[]=$d;
     697                }
    526698                $cache->store($clients_mono,$cache_key);
    527699            }else{
     
    529701            }
    530702        }
    531         //$sql_dualquad = "select compact.year,compact.month,compact.rel,ifnull(total,0) as total from (select year,month,rel from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu > 1 and ncpu < 5 group by year,month,rel) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel";
    532         //$sql_dualquad = "select compact.year,compact.month,compact.rel,compact.fla,ifnull(total,0) as total from (select year,month,rel,fla from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other')flavours) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, Flavours_name as fla,count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu > 1 and ncpu < 5 group by year,month,rel,fla) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel and compact.fla = ct.fla order by year desc,month desc,rel asc,fla asc";
    533         $sql_dualquad = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where ncpu > 1 and ncpu < 5 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc";
     703        $sql_cpu_dual="select compat_rf.year,compat_rf.month,compat_rf.rel,compat_rf.fla,ifnull(target_cpu_dual.total,0) as total from compat_rf left join target_cpu_dual using(year,month,rel,fla) order by year desc,month desc,compat_rf.rel asc,compat_rf.fla asc";
    534704        $cache_key='extended_memory_cpu_dualquad';
    535705        $data = $cache->get($cache_key);
     
    538708            $clients_dualquad=$data;
    539709        }else{
    540             $result=$this->dbconn->query($sql_dualquad);
     710            $this->execute_sql_array($sql_targets,'cpu_dual');
     711            $result=$this->dbconn->query($sql_cpu_dual);
    541712            if ($result){
    542713                $this->times+=microtime(true)-$stime;
    543714                $clients_dualquad=[];
    544                 $tmp=[];
    545                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    546                     $date=$row['year'].'_'.$row['month'];
     715                $tmp=[];
     716                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     717                    $date=$row['year']+'_'+$row['month'];
    547718                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    548719                }
    549                 foreach ($tmp as $date){
    550                     $clients_dualquad[]=$date;
    551                 }
     720                foreach($tmp as $d){
     721                        $clients_dualquad[]=$d;
     722                }
    552723                $cache->store($clients_dualquad,$cache_key);
    553724            }else{
     
    555726            }
    556727        }
    557         //$sql_more = "select compact.year,compact.month,compact.rel,ifnull(total,0) as total from (select year,month,rel from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu > 4 group by year,month,rel) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel";
    558         //$sql_more = "select compact.year,compact.month,compact.rel,compact.fla,ifnull(total,0) as total from (select year,month,rel,fla from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other')flavours) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, Flavours_name as fla,count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu > 4 group by year,month,rel,fla) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel and compact.fla = ct.fla order by year desc,month desc,rel asc,fla asc";
    559         $sql_more = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where ncpu  > 4 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc";
     728        $sql_cpu_other="select compat_rf.year,compat_rf.month,compat_rf.rel,compat_rf.fla,ifnull(target_cpu_more.total,0) as total from compat_rf left join target_cpu_more using(year,month,rel,fla) order by year desc,month desc,compat_rf.rel asc,compat_rf.fla asc";
    560729        $cache_key='extended_memory_cpu_other';
    561730        $data = $cache->get($cache_key);
     
    564733            $clients_more=$data;
    565734        }else{
    566             $result=$this->dbconn->query($sql_more);
     735            $this->execute_sql_array($sql_targets,'cpu_more');
     736            $result=$this->dbconn->query($sql_cpu_other);
    567737            if ($result){
    568738                $this->times+=microtime(true)-$stime;
    569739                $clients_more=[];
    570                 $tmp=[];
    571                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    572                     $date=$row['year'].'_'.$row['month'];
     740                $tmp=[];
     741                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     742                    $date=$row['year']+'_'+$row['month'];
    573743                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    574744                }
    575                 foreach ($tmp as $date){
    576                     $clients_more[]=$date;
    577                 }
     745                foreach($tmp as $d){
     746                        $clients_more[]=$d;
     747                }
    578748                $cache->store($clients_more,$cache_key);
    579749            }else{
     
    581751            }
    582752        }
    583          // CLIENT UPDATES
    584          $sql="select year,month,count(*) as nclients,sum(cnt)-count(*) as nclients_updated,Releases_name as rel,Flavours_name as fla from (select Client_uid,count(Client_uid) as cnt,year(date) as year,month(date) as month,Releases_name,Flavours_name from Client_Versions where date >= date_sub(now(),interval 1 year) GROUP by Client_uid,year,month,Releases_name,Flavours_name having count(Client_uid) >= 1 ) t group by year,month,Releases_name,Flavours_name order by year desc,month desc";
    585 
    586             $cache_key='extended_2';
    587             $data = $cache->get($cache_key);
    588             $stime=microtime(true);
    589             if ($data != false){
    590                 $num_updates_month=$data;
    591             }else{
    592                 $result=$this->dbconn->query($sql);
    593 
    594              if ($result){
    595                  $this->times+=microtime(true)-$stime;
    596                  $i=0;
    597              $tmp=[];
    598                  while($row=$result->fetch_array(MYSQLI_ASSOC)){
    599                      $date=$row['year'].'_'.$row['month'];
    600                  $tmp[$date][$row['rel']][$row['fla']]=intval($row['nclients_updated']);
    601                  }
    602              foreach($tmp as $date){
    603                  $num_updates_month[]=$date;
    604              }
    605                     $cache->store($num_updates_month,$cache_key);
    606              }else{
    607                  $num_updates_month=$this->dbconn->error;
    608              }
    609             }
    610 
    611 
    612          // CLIENT CHANGE RELEASE
    613          $sql="select year,month,count(*) as upgrades_en_mes from (select year,month,Client_uid as cliente_upgradeado from (select Client_uid,year(date) as year,month(date) as month from Client_Versions where date >= date_sub(now(),interval 1 year) GROUP by Client_uid,Releases_name,year,month)t group by month,year,Client_uid having(count(*))>1)t group by year,month order by year desc,month desc limit 12";
    614 
    615 
    616             $cache_key='extended_3';
    617             $data = $cache->get($cache_key);
    618             $stime=microtime(true);
    619             if ($data != false){
    620                 $change_releases=$data;
    621             }else{
    622                 $result=$this->dbconn->query($sql);
    623 
    624                 if ($result){
    625                  $this->times+=microtime(true)-$stime;
    626                  $change_releases=[0,0,0,0,0,0,0,0,0,0,0,0];
    627                  $i=0;
    628                  while($row=$result->fetch_array(MYSQLI_ASSOC)){
    629                      $change_releases[$i++]=intval($row['upgrades_en_mes']);
    630                  }
    631                     $cache->store($change_releases,$cache_key);
    632              }else{
    633                  $change_releases=$this->dbconn->error;
    634              }
    635             }
    636 
    637          // CLIENT CHANGE FLAVOUR
    638          $sql="select year,month,count(*) as cambio_sabor_en_mes from (select year,month,Client_uid as cliente_upgradeado from (select Client_uid,year(date) as year,month(date) as month from Client_Versions where date >= date_sub(now(),interval 1 year) GROUP by Client_uid,Flavours_name,year,month)t group by month,year,Client_uid having(count(*))>1)t group by year,month order by year desc,month desc limit 12";
    639 
    640             $cache_key='extended_4';
    641             $data = $cache->get($cache_key);
    642             $stime=microtime(true);
    643             if ($data != false){
    644                 $change_flavour=$data;
    645             }else{
    646                 $result=$this->dbconn->query($sql);
    647 
    648              if ($result){
    649                  $this->times+=microtime(true)-$stime;
    650                  $i=0;
    651                  $change_flavour=[0,0,0,0,0,0,0,0,0,0,0,0];
    652                  while($row=$result->fetch_array(MYSQLI_ASSOC)){
    653                      $change_flavour[$i++]=intval($row['cambio_sabor_en_mes']);
    654                  }
    655                     $cache->store($change_flavour,$cache_key);
    656              }else{
    657                  $change_flavour=$this->dbconn->error;
    658              }
    659             }
    660 
    661 
    662          //$sql="select compact.year as year,compact.month as month,if(compact.type='NONE',null,compact.type) as type,ifnull(results.total,0) as total from (select * from ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as type union all select 0 union all select 1) types) compact left join (select month(date) as month,year(date) as year,ifnull(ltsp,'NONE') as type,count(ifnull(ltsp,1)) as total from Client_Versions where Flavours_name = 'client' group by year(date),month(date),ltsp order by year(date) desc ,month(date) desc, ltsp desc ) results on compact.month = results.month and compact.year = results.year and compact.type = results.type";
    663          $sql = "select compact.year as year,compact.month as month,if(compact.type='NONE',null,compact.type) as type,ifnull(results.total,0) as total from (select * from
    664 ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as type union all select 0 union all select 1) types) compact left join (select month,year,ifnull(ltsp,'NONE') as type,count(ifnull(ltsp,1)) as total from (select DISTINCT Client_uid,year(date) as year, month(date) as month,ltsp from Client_Versions where Flavours_name = 'client')clients group by year,month,ltsp order by year desc ,month desc, ltsp desc ) results on compact.month = results.month and compact.year = results.year and compact.type = results.type";
    665          $count_ltsp=array();
    666          $cache_key='extended_5';
    667          $data=$cache->get($cache_key);
    668          $stime=microtime(true);
    669          if ($data != false){
     753
     754        //ltsp
     755        $sql_ltsp_types="select compat_t.year,compat_t.month,compat_t.type,ifnull(target_type.total,0) as total from compat_t left join target_type using(year,month,type) order by year desc,month desc,compat_t.type asc";
     756        $count_ltsp=array();
     757        $cache_key='ltsp_types';
     758        $data=$cache->get($cache_key);
     759        $stime=microtime(true);
     760        if ($data != false){
    670761            $count_ltsp=$data;
    671          }else{
    672             $result=$this->dbconn->query($sql);
     762        }else{
     763            $this->execute_sql_array($sql_targets,'ltsp_type');
     764            $result=$this->dbconn->query($sql_ltsp_types);
    673765            if ($result){
    674766                $this->times+=microtime(true)-$stime;
    675767                while($row=$result->fetch_array(MYSQLI_ASSOC)){
    676768                    if (isset($row['type']) and $row['type'] != NULL){
    677                         $count_ltsp[]=array($row['type'],$row['total']);
     769                        $count_ltsp[]=array(strtolower($row['type']),$row['total']);
    678770                    }
    679771                }
     
    682774                $count_ltsp=$this->dbconn->error;
    683775            }
    684          }
    685          $cache_key='extended_6';
    686          //$sql= "select compact.year as year,compact.month as month,if(compact.mode='NONE',null,compact.mode) as mode,ifnull(results.total,0) as total from (select * from ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as mode union all select 'THIN' union all select 'SEMI' union all select 'FAT') types) compact left join (select month(date) as month,year(date) as year,ifnull(mode,'NONE') as mode,count(ifnull(mode,1)) as total from Client_Versions where Flavours_name = 'client' group by year(date),month(date),mode order by year(date) desc ,month(date) desc, mode desc ) results on compact.month = results.month and compact.year = results.year and compact.mode = results.mode";
    687          $sql="select compact.year as year,compact.month as month,if(compact.mode='NONE',null,compact.mode) as mode,ifnull(results.total,0) as total from (select * from ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as mode union all select 'THIN' union all select 'SEMI' union all select 'FAT') types) compact left join (select month,year,ifnull(mode,'NONE') as mode,count(ifnull(mode,1)) as total from (select DISTINCT Client_uid, year(date) as year,month(date) as month,mode from Client_Versions where Flavours_name = 'client') clients group by year,month,mode order by year desc ,month desc, mode desc ) results on compact.month = results.month and compact.year = results.year and compact.mode = results.mode";
    688          $data= $cache->get($cache_key);
    689          $stime=microtime(true);
    690          $count_mode=array();
    691          if ($data != false){
     776        }
     777        $cache_key='ltsp_modes';
     778        $sql_ltsp_modes="select compat_m.year,compat_m.month,compat_m.mode,ifnull(target_mode.total,0) as total from compat_m left join target_mode using(year,month,mode) order by year desc,month desc,compat_m.mode asc";
     779        $data= $cache->get($cache_key);
     780        $stime=microtime(true);
     781        $count_mode=array();
     782        if ($data != false){
    692783            $count_mode=$data;
    693          }else{
    694             $result=$this->dbconn->query($sql);
     784        }else{
     785            $this->execute_sql_array($sql_targets,'ltsp_mode');
     786            $result=$this->dbconn->query($sql_ltsp_modes);
    695787            if ($result){
    696788                $this->times+=microtime(true)-$stime;
     
    704796                $count_mode=$this->dbconn->error;
    705797            }
    706          }
     798        }
    707799
    708800         //sanitize input
    709          if ($app != NULL){
     801        if ($app != NULL){
    710802             $app=preg_grep('/^[a-zA-Z0-9\-_]+$/',array($app));
    711803             if ($app != NULL and isset($app[0])){
    712804                 $app=$this->dbconn->real_escape_string($app[0]);
    713805                 $stats['apps']=[];
    714                  $stats['apps']['app']=$app;
    715                  $sql="select year(date) as year,month(date) as month,string,Releases_name as rel,Flavours_name as fla,sum(count) as count from RecvPackages where string='$app' and date >= date_sub(now(),interval 1 year) group by year,month,Releases_name,Flavours_name order by year desc,month desc,sum(count) desc";
     806                 $sql="select year,month,rel,fla,string,ifnull(count,0) as count from compat_rf join (select distinct string from RecvPackages where string like '$app%')compat_rfapp left join (select year(date) as year,month(date) as month,string,Releases_name as rel,Flavours_name as fla,sum(count) as count from RecvPackages where string like '$app%' and date >= date_sub(now(),interval 1 year) group by year,month,string,Releases_name,Flavours_name)a using(year,month,rel,fla,string) order by compat_rfapp.string,year desc,month desc";
    716807                    $cache_key="extended_app_$app";
    717808                    $data = $cache->get($cache_key);
    718809                    $stime=microtime(true);
    719810                    if ($data != false){
    720                         $app_use=$data;
    721                         $stats['apps']['app_use']=$app_use;
     811                        $stats['apps']=$data;
    722812                    }else{
    723813                        $result=$this->dbconn->query($sql);
     
    727817                         while($row=$result->fetch_array(MYSQLI_ASSOC)){
    728818                             $date=$row['year'].'_'.$row['month'];
    729                          $tmp[$date][$row['rel']][$row['fla']]=intval($row['count']);
     819                             $tmp[$row['string']][$date][$row['rel']][$row['fla']]=intval($row['count']);
    730820                         }
    731                      foreach($tmp as $date){
    732                          $app_use[]=$date;
    733                      }
    734                             $cache->store($app_use,$cache_key);
    735                          $stats['apps']['app_use']=$app_use;
     821                    foreach ($tmp as $app_string => $values){
     822                   
     823                        $app_use=[];
     824                        foreach($values as $date => $reldata){
     825                            $app_use[]=$reldata;
     826                        }
     827                        $stats['apps'][]=array('app'=>$app_string, 'app_use'=> $app_use);
     828                    }
     829                       
     830                        //    $cache->store($tmp2,$cache_key);
     831                         
    736832                     }else{
    737833                         $app_use=$this->dbconn->error;
    738834                     }
    739                     }
    740 
     835                 }
    741836             }
    742837         }
     
    751846             $stats['clients']['freq_updates_per_month']=$num_updates_month;
    752847         }
    753         if (isset($change_releases)){
     848        if (isset($change_releases)){
    754849             $stats['clients']['change_releases']=$change_releases;
    755850         }
    756851         if (isset($change_flavour)){
    757852             $stats['clients']['change_flavours']=$change_flavour;
    758         }
     853        }
    759854         if (isset($clients_arch)){
    760855             $stats['clients']['architectures']=$clients_arch;
    761856         }
     857        if (isset($clients_memnull)){
     858             $stats['clients']['mem']['unkn']=$clients_memnull;
     859         }
    762860         if (isset($clients_2G)){
    763861             $stats['clients']['mem']['2G']=$clients_2G;
     
    768866         if (isset($clients_8G)){
    769867             $stats['clients']['mem']['8G']=$clients_8G;
     868         }
     869         if (isset($clients_cpunull)){
     870             $stats['clients']['cpu']['unkn']=$clients_cpunull;
    770871         }
    771872         if (isset($clients_mono)){
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/functions.php

    r7280 r7577  
    174174    <link href="ui/jquery-ui.css" rel="stylesheet">
    175175    <link href="graph.css" rel="stylesheet">
     176    <link rel="shortcut icon" href="favicon.ico">
    176177    <script type="text/javascript" src="ui/jquery-ui.js"></script>
    177178  </head>
     
    233234    <link href="ui/jquery-ui.css" rel="stylesheet">
    234235    <link href="graph.css" rel="stylesheet">
     236    <link rel="shortcut icon" href="favicon.ico">
    235237    <script type="text/javascript" src="ui/jquery-ui.js"></script>
    236238  </head>
     
    262264    <link href="ui/jquery-ui.css" rel="stylesheet">
    263265    <link href="graph.css" rel="stylesheet">
     266    <link rel="shortcut icon" href="favicon.ico">
    264267    <script type="text/javascript" src="ui/jquery-ui.js"></script>
    265268    <script type="text/javascript">$(document).ready(function(){function send_query(){window.location.href=window.location.pathname+"?app="+$("#query_box>input").val()};$("#query_box>input").on("keyup",function(e){if (e.keyCode == 13){send_query()}});$("#query_box>button").click(send_query)});</script>
     
    285288    <script type='text/javascript' src='jquery.min.js'></script>
    286289    <link href='whitelist.css' rel='stylesheet'>
     290    <link rel='shortcut icon' href='favicon.ico'>
    287291    <script type='text/javascript' src='whitelist_min.js'></script>
    288292    <script type='text/javascript'>$(document).ready(start)</script>
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph.css

    r6889 r7577  
    66    height: 90%;
    77    margin: auto;
    8     background:url(load.gif) center center no-repeat;
     8    background:url(load.png) center center no-repeat;
    99}
    1010#stats_box{
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph.js

    r7280 r7577  
    3838    var custom_width=$('#'+id).parent().width()*0.95;
    3939    var custom_height=$(window).height()*0.72/2;
    40     custom_width='auto';
     40    //custom_width='auto';
    4141    custom_height='auto';
    4242    switch(id){
     
    105105                    colors:['blue','red','grey'],
    106106                    lineWidth: 5,
     107                    tooltip: { textStyle: { fontSize: 10 } },
    107108                    };
    108109    return {data:data_table,options:options}
     
    156157                    colors: ['purple','teal','gold','olive','grey'],
    157158                    lineWidth: 5,
     159                    tooltip: { textStyle: { fontSize: 10 } },
    158160                    };
    159161    return {data:data_table,options:options}
     
    162164    var total=[];
    163165    for (var i=0 ; i < 12; i++){
    164         total[i]={'i386':0,'x86_64':0};
     166        total[i]={'i686':0,'x86_64':0,'unkn':0};
    165167        if (! data[i]){
    166168            continue;
     
    183185    data_table.addColumn('number','Total x86_64');
    184186    data_table.addColumn({type:'string',role:'style'},'Style x86_64');
    185 
    186     date_values=[];
    187     for (i=1;i <= 12;i++){
    188         month=d.getMonth();
    189         year=d.getFullYear();
    190         date_to_add=new Date(year,month)
    191         dates_axis.push(date_to_add);
    192         date_values.push([date_to_add,total[i-1]['i386'],'color:purple',total[i-1]['x86_64'],'color:gold'])
     187    data_table.addColumn('number','Total unknown');
     188    data_table.addColumn({type:'string',role:'style'},'Style unknown');
     189
     190    date_values=[];
     191    for (i=1;i <= 12;i++){
     192        month=d.getMonth();
     193        year=d.getFullYear();
     194        date_to_add=new Date(year,month)
     195        dates_axis.push(date_to_add);
     196        date_values.push([date_to_add,total[i-1]['i686'],'color:purple',total[i-1]['x86_64'],'color:gold',total[i-1]['unkn'],'color:grey'])
    193197        d.setMonth(month-1);
    194198    }
     
    202206                    chartArea:{left:'5%',right:'10%'},
    203207                    focusTarget: 'category',
    204                     colors: ['purple','gold'],
    205                     lineWidth: 5,
     208                    colors: ['purple','gold','grey'],
     209                    lineWidth: 5,
     210                    tooltip: { textStyle: { fontSize: 10 } },
    206211                    };
    207212    return {data:data_table,options:options}
     
    210215    var total=[];
    211216    for (var i=0 ; i < 12; i++){
    212         total[i]={'15_i386':0,'15_x86_64':0,'16_i386':0,'16_x86_64':0};
     217        total[i]={'15_i686':0,'15_x86_64':0,'15_unkn':0,'16_i686':0,'16_x86_64':0,'16_unkn':0};
    213218        if (! data[i]){
    214219            continue;
     
    231236    data_table.addColumn('number','Total 15 x86_64');
    232237    data_table.addColumn({type:'string',role:'style'},'Style 15 x86_64');
     238    data_table.addColumn('number','Total 15 unknown');
     239    data_table.addColumn({type:'string',role:'style'},'Style 15 unknown');
    233240    data_table.addColumn('number','Total 16 x86');
    234241    data_table.addColumn({type:'string',role:'style'},'Style 16 x86');
    235242    data_table.addColumn('number','Total 16 x86_64');
    236243    data_table.addColumn({type:'string',role:'style'},'Style 16 x86_64');
    237 
    238 
    239     date_values=[];
    240     for (i=1;i <= 12;i++){
    241         month=d.getMonth();
    242         year=d.getFullYear();
    243         date_to_add=new Date(year,month)
    244         dates_axis.push(date_to_add);
    245         date_values.push([date_to_add,total[i-1]['15_i386'],'color:purple',total[i-1]['15_x86_64'],'color:gold',total[i-1]['16_i386'],'color:teal',total[i-1]['16_x86_64'],'color:olive'])
     244    data_table.addColumn('number','Total 16 unkown');
     245    data_table.addColumn({type:'string',role:'style'},'Style 16 unknown');
     246
     247    date_values=[];
     248    for (i=1;i <= 12;i++){
     249        month=d.getMonth();
     250        year=d.getFullYear();
     251        date_to_add=new Date(year,month)
     252        dates_axis.push(date_to_add);
     253        date_values.push([date_to_add,total[i-1]['15_i686'],'color:purple',total[i-1]['15_x86_64'],'color:gold',total[i-1]['15_unkn'],'color:grey',total[i-1]['16_i686'],'color:teal',total[i-1]['16_x86_64'],'color:olive',total[i-1]['16_unkn'],'color:darkgrey'])
    246254        d.setMonth(month-1);
    247255    }
     
    257265                    colors: ['purple','gold','teal','olive'],
    258266                    lineWidth: 5,
     267                    tooltip: { textStyle: { fontSize: 10 } },
    259268                    };
    260269    return {data:data_table,options:options}
     
    264273    var total=[];
    265274    for (var i=0 ; i < 12; i++){
    266         total[i]={'client_i386':0,'client_x86_64':0,'server_i386':0,'server_x86_64':0,'desktop_i386':0,'desktop_x86_64':0,'other_i386':0,'other_x86_64':0};
     275        total[i]={'client_i686':0,'client_x86_64':0,'client_unkn':0,'server_i686':0,'server_x86_64':0,'server_unkn':0,'desktop_i686':0,'desktop_x86_64':0,'desktop_unkn':0,'other_i686':0,'other_x86_64':0,'other_unkn':0};
    267276        if (! data[i]){
    268277            continue;
     
    285294    data_table.addColumn('number','Total client x86_64');
    286295    data_table.addColumn({type:'string',role:'style'},'Style client x86_64');
     296    data_table.addColumn('number','Total client unknown');
     297    data_table.addColumn({type:'string',role:'style'},'Style client unknown');
    287298    data_table.addColumn('number','Total server x86');
    288299    data_table.addColumn({type:'string',role:'style'},'Style server x86');
    289300    data_table.addColumn('number','Total server x86_64');
    290301    data_table.addColumn({type:'string',role:'style'},'Style server x86_64');
     302    data_table.addColumn('number','Total server unknown');
     303    data_table.addColumn({type:'string',role:'style'},'Style server unknown');
    291304    data_table.addColumn('number','Total desktop x86');
    292305    data_table.addColumn({type:'string',role:'style'},'Style desktop x86');
    293306    data_table.addColumn('number','Total desktop x86_64');
    294307    data_table.addColumn({type:'string',role:'style'},'Style desktop x86_64');
     308    data_table.addColumn('number','Total desktop unknown');
     309    data_table.addColumn({type:'string',role:'style'},'Style desktop unknown');
    295310    data_table.addColumn('number','Total other x86');
    296311    data_table.addColumn({type:'string',role:'style'},'Style other x86');
    297312    data_table.addColumn('number','Total other x86_64');
    298313    data_table.addColumn({type:'string',role:'style'},'Style other x86_64');
    299 
    300 
    301     date_values=[];
    302     for (i=1;i <= 12;i++){
    303         month=d.getMonth();
    304         year=d.getFullYear();
    305         date_to_add=new Date(year,month)
    306         dates_axis.push(date_to_add);
    307         date_values.push([date_to_add,total[i-1]['client_i386'],'color:goldenrod',total[i-1]['client_x86_64'],'color:gold',total[i-1]['server_i386'],'color:darkviolet',total[i-1]['server_x86_64'],'color:deeppink',total[i-1]['desktop_i386'],'color:slateblue',total[i-1]['desktop_x86_64'],'color:skyblue',total[i-1]['other_i386'],'color:plum',total[i-1]['other_x86_64'],'color:pink'])
     314    data_table.addColumn('number','Total other unknown');
     315    data_table.addColumn({type:'string',role:'style'},'Style other unknown');
     316
     317
     318    date_values=[];
     319    for (i=1;i <= 12;i++){
     320        month=d.getMonth();
     321        year=d.getFullYear();
     322        date_to_add=new Date(year,month)
     323        dates_axis.push(date_to_add);
     324        date_values.push([date_to_add,total[i-1]['client_i686'],'color:goldenrod',total[i-1]['client_x86_64'],'color:gold',total[i-1]['client_unkn'],'color:lightgrey',total[i-1]['server_i686'],'color:darkviolet',total[i-1]['server_x86_64'],'color:deeppink',total[i-1]['server_unkn'],'color:grey',total[i-1]['desktop_i686'],'color:slateblue',total[i-1]['desktop_x86_64'],'color:skyblue',total[i-1]['desktop_unkn'],'color:darkgrey',total[i-1]['other_i686'],'color:plum',total[i-1]['other_x86_64'],'color:pink',total[i-1]['other_unkn'],'color:black'])
    308325        d.setMonth(month-1);
    309326    }
     
    317334                    chartArea:{left:'5%',right:'10%'},
    318335                    focusTarget: 'category',
    319                     colors: ['goldenrod','gold','darkviolet','deeppink','slateblue','skyblue','plum','pink',],
    320                     lineWidth: 5,
     336                    colors: ['goldenrod','gold','lightgrey','darkviolet','deeppink','grey','slateblue','skyblue','darkgrey','plum','pink','black'],
     337                    lineWidth: 5,
     338                    tooltip: { textStyle: { fontSize: 9 } },
    321339                    };
    322340    return {data:data_table,options:options}
     
    324342function build_data_per_month_releases_mem(data,title){
    325343    var total=[];
    326     var sizes=['2G','4G','8G']
     344    var sizes=['unkn','2G','4G','8G']
    327345    for (var i=0 ; i < 12; i++){
    328         total[i]={'15_2G':0,'15_4G':0,'15_8G':0,'16_2G':0,'16_4G':0,'16_8G':0};
     346        total[i]={'15_2G':0,'15_4G':0,'15_8G':0,'15_unkn':0,'16_2G':0,'16_4G':0,'16_8G':0,'16_unkn':0};
    329347        for (var size in sizes){
    330348            if (! data[sizes[size]][i]){
     
    348366    data_table.addColumn('number','Total 15 > 4G');
    349367    data_table.addColumn({type:'string',role:'style'},'Style 15 > 4G');
     368    data_table.addColumn('number','Total 15 unknown');
     369    data_table.addColumn({type:'string',role:'style'},'Style 15 unknown');
    350370    data_table.addColumn('number','Total 16 < 2G');
    351371    data_table.addColumn({type:'string',role:'style'},'Style 16 < 2G');
     
    354374    data_table.addColumn('number','Total 16 > 4G');
    355375    data_table.addColumn({type:'string',role:'style'},'Style 16 > 4G');
    356 
    357     date_values=[];
    358     for (i=1;i <= 12;i++){
    359         month=d.getMonth();
    360         year=d.getFullYear();
    361         date_to_add=new Date(year,month)
    362         dates_axis.push(date_to_add);
    363         date_values.push([date_to_add,total[i-1]['15_2G'],'color:darkgoldenrod',total[i-1]['15_4G'],'color:goldenrod',total[i-1]['15_8G'],'color:gold',total[i-1]['16_2G'],'color:darkviolet',total[i-1]['16_4G'],'color:deeppink',total[i-1]['16_8G'],'color:pink'])
     376    data_table.addColumn('number','Total 16 unknown');
     377    data_table.addColumn({type:'string',role:'style'},'Style 16 unknown');
     378    date_values=[];
     379    for (i=1;i <= 12;i++){
     380        month=d.getMonth();
     381        year=d.getFullYear();
     382        date_to_add=new Date(year,month)
     383        dates_axis.push(date_to_add);
     384        date_values.push([date_to_add,total[i-1]['15_2G'],'color:darkgoldenrod',total[i-1]['15_4G'],'color:goldenrod',total[i-1]['15_8G'],'color:gold',total[i-1]['15_unkn'],'color:lightgrey',total[i-1]['16_2G'],'color:darkviolet',total[i-1]['16_4G'],'color:deeppink',total[i-1]['16_8G'],'color:pink',total[i-1]['16_unkn'],'color:darkgrey'])
    364385        d.setMonth(month-1);
    365386    }
     
    373394                    chartArea:{left:'5%',right:'10%'},
    374395                    focusTarget: 'category',
    375                     colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink'],
    376                     lineWidth: 5,
     396                    colors: ['darkgoldenrod','goldenrod','gold','lightgrey','darkviolet','deeppink','pink','darkgrey'],
     397                    lineWidth: 5,
     398                    tooltip: { textStyle: { fontSize: 10 } },
    377399                    };
    378400    return {data:data_table,options:options}
     
    380402function build_data_per_month_mem(data,title){
    381403    var total=[];
    382     var sizes=['2G','4G','8G']
     404    var sizes=['unkn','2G','4G','8G']
    383405    for (var i=0 ; i < 12; i++){
    384         total[i]={'2G':0,'4G':0,'8G':0};
     406        total[i]={'unkn':0,'2G':0,'4G':0,'8G':0};
    385407        for (var size in sizes){
    386408            if (! data[sizes[size]][i]){
     
    404426    data_table.addColumn('number','Total > 4G');
    405427    data_table.addColumn({type:'string',role:'style'},'Style > 4G');
    406 
    407     date_values=[];
    408     for (i=1;i <= 12;i++){
    409         month=d.getMonth();
    410         year=d.getFullYear();
    411         date_to_add=new Date(year,month)
    412         dates_axis.push(date_to_add);
    413         date_values.push([date_to_add,total[i-1]['2G'],'color:gold',total[i-1]['4G'],'color:red',total[i-1]['8G'],'color:blue'])
     428    data_table.addColumn('number','Total unknown');
     429    data_table.addColumn({type:'string',role:'style'},'Style unknown');
     430
     431    date_values=[];
     432    for (i=1;i <= 12;i++){
     433        month=d.getMonth();
     434        year=d.getFullYear();
     435        date_to_add=new Date(year,month)
     436        dates_axis.push(date_to_add);
     437        date_values.push([date_to_add,total[i-1]['2G'],'color:gold',total[i-1]['4G'],'color:red',total[i-1]['8G'],'color:blue',total[i-1]['unkn'],'color:grey'])
    414438        d.setMonth(month-1);
    415439    }
     
    423447                    chartArea:{left:'5%',right:'10%'},
    424448                    focusTarget: 'category',
    425                     colors: ['gold','red','blue'],
    426                     lineWidth: 5,
     449                    colors: ['gold','red','blue','grey'],
     450                    lineWidth: 5,
     451                    tooltip: { textStyle: { fontSize: 10 } },
    427452                    };
    428453    return {data:data_table,options:options}
     
    430455function build_data_per_month_flavours_mem(data,title){
    431456    var total=[];
    432     var sizes=['2G','4G','8G']
     457    var sizes=['unkn','2G','4G','8G']
    433458    for (var i=0 ; i < 12; i++){
    434         total[i]={'client_2G':0,'client_4G':0,'client_8G':0,'server_2G':0,'server_4G':0,'server_8G':0,'desktop_2G':0,'desktop_4G':0,'desktop_8G':0,'other_2G':0,'other_4G':0,'other_8G':0};
     459        total[i]={'client_2G':0,'client_4G':0,'client_8G':0,'client_unkn':0,'server_2G':0,'server_4G':0,'server_8G':0,'server_unkn':0,'desktop_2G':0,'desktop_4G':0,'desktop_8G':0,'desktop_unkn':0,'other_2G':0,'other_4G':0,'other_8G':0,'other_unkn':0};
    435460        for (var size in sizes){
    436461            if (! data[sizes[size]][i]){
     
    454479    data_table.addColumn('number','Total client > 4G');
    455480    data_table.addColumn({type:'string',role:'style'},'Style client > 4G');
     481    data_table.addColumn('number','Total client > unknown');
     482    data_table.addColumn({type:'string',role:'style'},'Style client unknown');
    456483    data_table.addColumn('number','Total server < 2G');
    457484    data_table.addColumn({type:'string',role:'style'},'Style server < 2G');
     
    460487    data_table.addColumn('number','Total server > 4G');
    461488    data_table.addColumn({type:'string',role:'style'},'Style server > 4G');
     489    data_table.addColumn('number','Total server unknown');
     490    data_table.addColumn({type:'string',role:'style'},'Style server unknown');
    462491    data_table.addColumn('number','Total desktop < 2G');
    463492    data_table.addColumn({type:'string',role:'style'},'Style desktop < 2G');
     
    466495    data_table.addColumn('number','Total desktop > 4G');
    467496    data_table.addColumn({type:'string',role:'style'},'Style desktop > 4G');
     497    data_table.addColumn('number','Total desktop unknown');
     498    data_table.addColumn({type:'string',role:'style'},'Style desktop unknown');
    468499    data_table.addColumn('number','Total other < 2G');
    469500    data_table.addColumn({type:'string',role:'style'},'Style other < 2G');
     
    472503    data_table.addColumn('number','Total other > 4G');
    473504    data_table.addColumn({type:'string',role:'style'},'Style other > 4G');
    474 
    475     date_values=[];
    476     for (i=1;i <= 12;i++){
    477         month=d.getMonth();
    478         year=d.getFullYear();
    479         date_to_add=new Date(year,month)
    480         dates_axis.push(date_to_add);
    481         date_values.push([date_to_add,total[i-1]['client_2G'],'color:darkgoldenrod',total[i-1]['client_4G'],'color:goldenrod',total[i-1]['client_8G'],'color:gold',total[i-1]['server_2G'],'color:darkviolet',total[i-1]['server_4G'],'color:deeppink',total[i-1]['server_8G'],'color:pink',total[i-1]['desktop_2G'],'color:slateblue',total[i-1]['desktop_4G'],'color:skyblue',total[i-1]['desktop_8G'],'color:blue',total[i-1]['other_2G'],'color:teal',total[i-1]['other_4G'],'color:darkkhaki',total[i-1]['other_8G'],'color:green'])
     505    data_table.addColumn('number','Total other unknown');
     506    data_table.addColumn({type:'string',role:'style'},'Style other unknown');
     507
     508    date_values=[];
     509    for (i=1;i <= 12;i++){
     510        month=d.getMonth();
     511        year=d.getFullYear();
     512        date_to_add=new Date(year,month)
     513        dates_axis.push(date_to_add);
     514        date_values.push([date_to_add,total[i-1]['client_2G'],'color:darkgoldenrod',total[i-1]['client_4G'],'color:goldenrod',total[i-1]['client_8G'],'color:gold',total[i-1]['client_unkn'],'color:lightgrey',total[i-1]['server_2G'],'color:darkviolet',total[i-1]['server_4G'],'color:deeppink',total[i-1]['server_8G'],'color:pink',total[i-1]['server_unkn'],'color:grey',total[i-1]['desktop_2G'],'color:slateblue',total[i-1]['desktop_4G'],'color:skyblue',total[i-1]['desktop_8G'],'color:blue',total[i-1]['desktop_unkn'],'color:darkgrey',total[i-1]['other_2G'],'color:teal',total[i-1]['other_4G'],'color:darkkhaki',total[i-1]['other_8G'],'color:green',total[i-1]['other_unkn'],'color:black'])
    482515        d.setMonth(month-1);
    483516    }
     
    491524                    chartArea:{left:'5%',right:'10%'},
    492525                    focusTarget: 'category',
    493                     colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink','slateblue','skyblue','blue','teal','darkkhaki','green'],
    494                     lineWidth: 5,
     526                    colors: ['darkgoldenrod','goldenrod','gold','lightgrey','darkviolet','deeppink','pink','grey','slateblue','skyblue','blue','darkgrey','teal','darkkhaki','green','black'],
     527                    lineWidth: 5,
     528                    tooltip: { textStyle: { fontSize: 9 } },
    495529                    };
    496530    return {data:data_table,options:options}
     
    499533function build_data_per_month_ltsp_usage(data,title){
    500534    var total=[];
    501     var group_items=2
     535    var group_items=3
    502536    for (var i=0 ; i < 12*group_items; i++){
    503537        var item_no=Math.floor(i/group_items)
     
    506540        }
    507541        if (! total[item_no]){
    508             total[item_no]={0:0,1:0}
    509         }
    510         total[item_no][parseInt(data[i][0])]=parseInt(data[i][1])
     542            total[item_no]={0:0,1:0,'unkn':0}
     543        }
     544        total[item_no][data[i][0]]=parseInt(data[i][1])
    511545    }
    512546    var dates_axis=[];
     
    518552    data_table.addColumn('number','Total ltsp clients');
    519553    data_table.addColumn({type:'string',role:'style'},'Total ltsp clients style');
    520 
    521     date_values=[];
    522     for (i=1;i <= 12;i++){
    523         month=d.getMonth();
    524         year=d.getFullYear();
    525         date_to_add=new Date(year,month)
    526         dates_axis.push(date_to_add);
    527         date_values.push([date_to_add,total[i-1][0],'color:purple',total[i-1][1],'color:gold'])
     554    data_table.addColumn('number','Total unknown clients');
     555    data_table.addColumn({type:'string',role:'style'},'Total unknown clients style');
     556
     557    date_values=[];
     558    for (i=1;i <= 12;i++){
     559        month=d.getMonth();
     560        year=d.getFullYear();
     561        date_to_add=new Date(year,month)
     562        dates_axis.push(date_to_add);
     563        date_values.push([date_to_add,total[i-1][0],'color:purple',total[i-1][1],'color:gold',total[i-1]['unkn'],'color:grey'])
    528564        d.setMonth(month-1);
    529565    }
     
    537573                    chartArea:{left:'5%',right:'10%'},
    538574                    focusTarget: 'category',
    539                     colors: ['purple','gold'],
    540                     lineWidth: 5,
     575                    colors: ['purple','gold','grey'],
     576                    lineWidth: 5,
     577                    tooltip: { textStyle: { fontSize: 10 } },
    541578                    };
    542579    return {data:data_table,options:options}
     
    545582function build_data_per_month_ltsp_modes(data,title){
    546583    var total=[];
    547     var group_items=3
     584    var group_items=4
    548585    for (var i=0 ; i < 12*group_items; i++){
    549586        var item_no=Math.floor(i/group_items)
     
    552589        }
    553590        if (! total[item_no]){
    554             total[item_no]={'thin':0,'semi':0, 'fat':0}
     591            total[item_no]={'thin':0,'semi':0, 'fat':0, 'unkn':0}
    555592        }
    556593        total[item_no][data[i][0]]=parseInt(data[i][1])
     
    566603    data_table.addColumn('number','Total fat clients');
    567604    data_table.addColumn({type:'string',role:'style'},'Total fat clients style');
    568 
    569     date_values=[];
    570     for (i=1;i <= 12;i++){
    571         month=d.getMonth();
    572         year=d.getFullYear();
    573         date_to_add=new Date(year,month)
    574         dates_axis.push(date_to_add);
    575         date_values.push([date_to_add,total[i-1]['thin'],'color:purple',total[i-1]['semi'],'color:gold',total[i-1]['fat'],'color:olive'])
     605    data_table.addColumn('number','Total unknown clients');
     606    data_table.addColumn({type:'string',role:'style'},'Total unknown clients style');
     607
     608    date_values=[];
     609    for (i=1;i <= 12;i++){
     610        month=d.getMonth();
     611        year=d.getFullYear();
     612        date_to_add=new Date(year,month)
     613        dates_axis.push(date_to_add);
     614        date_values.push([date_to_add,total[i-1]['thin'],'color:purple',total[i-1]['semi'],'color:gold',total[i-1]['fat'],'color:olive',total[i-1]['unkn'],'color:grey'])
    576615        d.setMonth(month-1);
    577616    }
     
    585624                    chartArea:{left:'5%',right:'10%'},
    586625                    focusTarget: 'category',
    587                     colors: ['purple','gold','olive'],
    588                     lineWidth: 5,
     626                    colors: ['purple','gold','olive', 'grey'],
     627                    lineWidth: 5,
     628                    tooltip: { textStyle: { fontSize: 10 } },
    589629                    };
    590630    return {data:data_table,options:options}
     
    593633function build_data_per_month_releases_cpu(data,title){
    594634    var total=[];
    595     var sizes=['mono','dualquad','more']
     635    var sizes=['unkn','mono','dualquad','more']
    596636    for (var i=0 ; i < 12; i++){
    597         total[i]={'15_mono':0,'15_dualquad':0,'15_more':0,'16_mono':0,'16_dualquad':0,'16_more':0};
     637        total[i]={'15_mono':0,'15_dualquad':0,'15_more':0,'15_unkn':0,'16_mono':0,'16_dualquad':0,'16_more':0,'16_unkn':0};
    598638        for (var size in sizes){
    599639            if (! data[sizes[size]][i]){
     
    617657    data_table.addColumn('number','Total 15 more than quad processor');
    618658    data_table.addColumn({type:'string',role:'style'},'Style 15 more than quad processor');
     659    data_table.addColumn('number','Total 15 unknown');
     660    data_table.addColumn({type:'string',role:'style'},'Style 15 unknown');
    619661    data_table.addColumn('number','Total 16 mono processor');
    620662    data_table.addColumn({type:'string',role:'style'},'Style 16 mono processor');
     
    623665    data_table.addColumn('number','Total 16 more than quad processor');
    624666    data_table.addColumn({type:'string',role:'style'},'Style 16 more than quad processor');
    625 
    626     date_values=[];
    627     for (i=1;i <= 12;i++){
    628         month=d.getMonth();
    629         year=d.getFullYear();
    630         date_to_add=new Date(year,month)
    631         dates_axis.push(date_to_add);
    632         date_values.push([date_to_add,total[i-1]['15_mono'],'color:darkgoldenrod',total[i-1]['15_dualquad'],'color:goldenrod',total[i-1]['15_more'],'color:gold',total[i-1]['16_mono'],'color:darkviolet',total[i-1]['16_dualquad'],'color:deeppink',total[i-1]['16_more'],'color:pink'])
     667    data_table.addColumn('number','Total 16 unknown');
     668    data_table.addColumn({type:'string',role:'style'},'Style 16 unknown');
     669
     670    date_values=[];
     671    for (i=1;i <= 12;i++){
     672        month=d.getMonth();
     673        year=d.getFullYear();
     674        date_to_add=new Date(year,month)
     675        dates_axis.push(date_to_add);
     676        date_values.push([date_to_add,total[i-1]['15_mono'],'color:darkgoldenrod',total[i-1]['15_dualquad'],'color:goldenrod',total[i-1]['15_more'],'color:gold',total[i-1]['15_unkn'],'color:lightgrey',total[i-1]['16_mono'],'color:darkviolet',total[i-1]['16_dualquad'],'color:deeppink',total[i-1]['16_more'],'color:pink',total[i-1]['16_unkn'],'color:darkgrey'])
    633677        d.setMonth(month-1);
    634678    }
     
    642686                    chartArea:{left:'5%',right:'10%'},
    643687                    focusTarget: 'category',
    644                     colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink'],
    645                     lineWidth: 5,
     688                    colors: ['darkgoldenrod','goldenrod','gold','lightgrey','darkviolet','deeppink','pink','darkgrey'],
     689                    lineWidth: 5,
     690                    tooltip: { textStyle: { fontSize: 10 } },
    646691                    };
    647692    return {data:data_table,options:options}
     
    649694function build_data_per_month_cpu(data,title){
    650695    var total=[];
    651     var sizes=['mono','dualquad','more']
     696    var sizes=['unkn','mono','dualquad','more']
    652697    for (var i=0 ; i < 12; i++){
    653         total[i]={'mono':0,'dualquad':0,'more':0};
     698        total[i]={'unkn':0,'mono':0,'dualquad':0,'more':0};
    654699        for (var size in sizes){
    655700            if (! data[sizes[size]][i]){
     
    673718    data_table.addColumn('number','Total more than quad processor');
    674719    data_table.addColumn({type:'string',role:'style'},'Style more than quad processor');
    675 
    676     date_values=[];
    677     for (i=1;i <= 12;i++){
    678         month=d.getMonth();
    679         year=d.getFullYear();
    680         date_to_add=new Date(year,month)
    681         dates_axis.push(date_to_add);
    682         date_values.push([date_to_add,total[i-1]['mono'],'color:gold',total[i-1]['dualquad'],'color:red',total[i-1]['more'],'color:blue'])
     720    data_table.addColumn('number','Total unknown');
     721    data_table.addColumn({type:'string',role:'style'},'Style unknown');
     722
     723    date_values=[];
     724    for (i=1;i <= 12;i++){
     725        month=d.getMonth();
     726        year=d.getFullYear();
     727        date_to_add=new Date(year,month)
     728        dates_axis.push(date_to_add);
     729        date_values.push([date_to_add,total[i-1]['mono'],'color:gold',total[i-1]['dualquad'],'color:red',total[i-1]['more'],'color:blue',total[i-1]['unkn'],'color:grey'])
    683730        d.setMonth(month-1);
    684731    }
     
    692739                    chartArea:{left:'5%',right:'10%'},
    693740                    focusTarget: 'category',
    694                     colors: ['gold','red','blue'],
    695                     lineWidth: 5,
     741                    colors: ['gold','red','blue','grey'],
     742                    lineWidth: 5,
     743                    tooltip: { textStyle: { fontSize: 10 } },
    696744                    };
    697745    return {data:data_table,options:options}
     
    699747function build_data_per_month_flavours_cpu(data,title){
    700748    var total=[];
    701     var sizes=['mono','dualquad','more']
     749    var sizes=['unkn','mono','dualquad','more']
    702750    for (var i=0 ; i < 12; i++){
    703         total[i]={'client_mono':0,'client_dualquad':0,'client_more':0,'server_mono':0,'server_dualquad':0,'server_more':0,'desktop_mono':0,'desktop_dualquad':0,'desktop_more':0,'other_mono':0,'other_dualquad':0,'other_more':0};
     751        total[i]={'client_mono':0,'client_dualquad':0,'client_more':0,'client_unkn':0,'server_mono':0,'server_dualquad':0,'server_more':0,'server_unkn':0,'desktop_mono':0,'desktop_dualquad':0,'desktop_more':0,'desktop_unkn':0,'other_mono':0,'other_dualquad':0,'other_more':0,'other_unkn':0};
    704752        for (var size in sizes){
    705753            if (! data[sizes[size]][i]){
     
    723771    data_table.addColumn('number','Total client more than quad processor');
    724772    data_table.addColumn({type:'string',role:'style'},'Style client more than quad processor');
     773    data_table.addColumn('number','Total client unknown processor');
     774    data_table.addColumn({type:'string',role:'style'},'Style client unknown processor');
    725775    data_table.addColumn('number','Total server mono processor');
    726776    data_table.addColumn({type:'string',role:'style'},'Style server mono processor');
     
    729779    data_table.addColumn('number','Total server more than quad processor');
    730780    data_table.addColumn({type:'string',role:'style'},'Style server more than quad processor');
     781    data_table.addColumn('number','Total server unknown processor');
     782    data_table.addColumn({type:'string',role:'style'},'Style server unknown processor');
    731783    data_table.addColumn('number','Total desktop mono processor');
    732784    data_table.addColumn({type:'string',role:'style'},'Style desktop mono processor');
     
    735787    data_table.addColumn('number','Total desktop more than quad processor');
    736788    data_table.addColumn({type:'string',role:'style'},'Style desktop more than quad processor');
     789    data_table.addColumn('number','Total desktop unknown processor');
     790    data_table.addColumn({type:'string',role:'style'},'Style desktop unknown processor');
    737791    data_table.addColumn('number','Total other mono processor');
    738792    data_table.addColumn({type:'string',role:'style'},'Style other mono processor');
     
    741795    data_table.addColumn('number','Total other more than quad processor');
    742796    data_table.addColumn({type:'string',role:'style'},'Style other more than quad processor');
    743 
    744     date_values=[];
    745     for (i=1;i <= 12;i++){
    746         month=d.getMonth();
    747         year=d.getFullYear();
    748         date_to_add=new Date(year,month)
    749         dates_axis.push(date_to_add);
    750         date_values.push([date_to_add,total[i-1]['client_mono'],'color:darkgoldenrod',total[i-1]['client_dualquad'],'color:goldenrod',total[i-1]['client_more'],'color:gold',total[i-1]['server_mono'],'color:darkviolet',total[i-1]['server_dualquad'],'color:deeppink',total[i-1]['server_more'],'color:pink',total[i-1]['desktop_mono'],'color:slateblue',total[i-1]['desktop_dualquad'],'color:skyblue',total[i-1]['desktop_more'],'color:blue',total[i-1]['other_mono'],'color:teal',total[i-1]['other_dualquad'],'color:darkkhaki',total[i-1]['other_more'],'color:green'])
     797    data_table.addColumn('number','Total other unknown processor');
     798    data_table.addColumn({type:'string',role:'style'},'Style other unknown processor');
     799
     800    date_values=[];
     801    for (i=1;i <= 12;i++){
     802        month=d.getMonth();
     803        year=d.getFullYear();
     804        date_to_add=new Date(year,month)
     805        dates_axis.push(date_to_add);
     806        date_values.push([date_to_add,total[i-1]['client_mono'],'color:darkgoldenrod',total[i-1]['client_dualquad'],'color:goldenrod',total[i-1]['client_more'],'color:gold',total[i-1]['client_unkn'],'color:lightgrey',total[i-1]['server_mono'],'color:darkviolet',total[i-1]['server_dualquad'],'color:deeppink',total[i-1]['server_more'],'color:pink',total[i-1]['server_unkn'],'color:grey',total[i-1]['desktop_mono'],'color:slateblue',total[i-1]['desktop_dualquad'],'color:skyblue',total[i-1]['desktop_more'],'color:blue',total[i-1]['desktop_unkn'],'color:darkgrey',total[i-1]['other_mono'],'color:teal',total[i-1]['other_dualquad'],'color:darkkhaki',total[i-1]['other_more'],'color:green',total[i-1]['other_unkn'],'color:black'])
    751807        d.setMonth(month-1);
    752808    }
     
    760816                    chartArea:{left:'5%',right:'10%'},
    761817                    focusTarget: 'category',
    762                     colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink','slateblue','skyblue','blue','teal','darkkhaki','green'],
    763                     lineWidth: 5,
     818                    colors: ['darkgoldenrod','goldenrod','gold','lightgrey','darkviolet','deeppink','pink','grey','slateblue','skyblue','blue','darkgrey','teal','darkkhaki','green','black'],
     819                    lineWidth: 5,
     820                    tooltip: { textStyle: { fontSize: 9 } },
    764821                    };
    765822    return {data:data_table,options:options}
     
    790847                    focusTarget: 'category',
    791848                    lineWidth: 5,
     849                    tooltip: { textStyle: { fontSize: 10 } },
    792850                    };
    793851    return {data:data_table,options:options}
     
    802860    start_get_time=get_time();
    803861    $('#accordion').append('<div id="loading"></div>');
    804     $.getJSON( "./GetExtendedStats"+parameter, function( json ) {
    805     end_get_time=get_time();
    806     start_graph_time=end_get_time;
    807     var app=null;
    808     var order = {'machines_per_month':{},'clients_per_month':{},'freq_updates_per_month':{},'change_releases':{},'change_flavours':{},'count_ltsp':{},'count_mode':{},'architectures':{},'mem':{},'cpu':{}}
    809     for (key in json){
    810         if (key == 'clients'){
    811             for (type in order){
    812                 if (! json[key][type]){
    813                     continue;
    814                 }
    815                 switch(type){
    816                     case 'machines_per_month':
    817                         if (! chart_data['clients_per_month']){
    818                             chart_data['clients_per_month']={};
    819                         }
    820                         if (! chart_data['clients_per_month']['hosts']){
    821                             chart_data['clients_per_month']['hosts']={};
    822                         }
    823                         chart_data['clients_per_month']['title']='Machines';
    824                         chart_data['clients_per_month']['hosts']['graph']=build_data_from_array(json[key][type],'Number of unique machines used')
    825                         chart_data['clients_per_month']['hosts']['title']='Number of unique machines used';
    826                         break;
    827                     case 'clients_per_month':
    828                         if (! chart_data['clients_per_month']){
    829                             chart_data['clients_per_month']={};
    830                         }
    831                         if (! chart_data['clients_per_month']['releases']){
    832                             chart_data['clients_per_month']['releases']={};
    833                         }
    834                         if (! chart_data['clients_per_month']['flavours']){
    835                             chart_data['clients_per_month']['flavours']={};
    836                         }
    837                         chart_data[type]['title']='Machines';
    838                         chart_data[type]['releases']['graph']=build_data_per_month_releases(json[key][type],'Number instances by release per month')
    839                         chart_data[type]['releases']['title']='Number instances by release per month';
    840                         chart_data[type]['flavours']['graph']=build_data_per_month_flavours(json[key][type],'Number instances by flavour per month')
    841                         chart_data[type]['flavours']['title']='Number instances by flavour per month';
    842                         break;
    843                     case 'freq_updates_per_month':
    844                         chart_data[type]={};
    845                         chart_data[type]['title']='Updates';
    846                         chart_data[type]['releases']={};
    847                         chart_data[type]['releases']['graph']=build_data_per_month_releases(json[key][type],'Number updates by release per month')
    848                         chart_data[type]['releases']['title']='Number updates by release per month';
    849                         chart_data[type]['flavours']={};
    850                         chart_data[type]['flavours']['graph']=build_data_per_month_flavours(json[key][type],'Number updates by flavour per month')
    851                         chart_data[type]['flavours']['title']='Number updates by flavour per month';
    852                         break;
    853                     case 'change_releases':
    854                         if (! chart_data['changes']){
    855                             chart_data['changes']={};
    856                             chart_data['changes']['title']='Upgrades';
    857                         }
    858                         if (! chart_data['changes']['releases'])
    859                             chart_data['changes']['releases']={};
    860                         chart_data['changes']['releases']['graph']=build_data_from_array(json[key][type],'Change releases per month')
    861                         chart_data['changes']['releases']['title']='Change releases per month';
    862                         break;
    863                     case 'change_flavours':
    864                         if (! chart_data['changes']){
    865                             chart_data['changes']={};
    866                             chart_data['changes']['title']='Changes';
    867                         }
    868                         if (! chart_data['changes']['flavours'])
    869                             chart_data['changes']['flavours']={};
    870                         chart_data['changes']['flavours']['graph']=build_data_from_array(json[key][type],'Change flavours per month')
    871                         chart_data['changes']['flavours']['title']='Change flavours per month';
    872                         break;
    873                     case 'architectures':
    874                         if (! chart_data[type]){
    875                             chart_data[type]={'global':{},'releases':{},'flavours':{}}
    876                             chart_data[type]['title']='Architectures';
    877                         }
    878                         chart_data[type]['global']['graph']=build_data_per_month_arch(json[key][type],'Architectures per month');
    879                         chart_data[type]['global']['title']='Architectures distribution per month'
    880                         chart_data[type]['releases']['graph']=build_data_per_month_release_arch(json[key][type],'Architectures by release per month');
    881                         chart_data[type]['releases']['title']='Architectures distribution by release per month'
    882                         chart_data[type]['flavours']['graph']=build_data_per_month_flavour_arch(json[key][type],'Architectures by flavour per month');
    883                         chart_data[type]['flavours']['title']='Architectures distribution by flavour per month'
    884                         break;
    885                     case 'mem':
    886                         if (! chart_data[type]){
    887                             chart_data[type]={'global':{},'releases':{},'flavours':{}};
    888                             chart_data[type]['title']='Memory';
    889                         }
    890                         chart_data[type]['global']['graph']=build_data_per_month_mem(json[key][type],'Memory per month');
    891                         chart_data[type]['global']['title']='Memory distribution per month'
    892                         chart_data[type]['releases']['graph']=build_data_per_month_releases_mem(json[key][type],'Memory by release per month');
    893                         chart_data[type]['releases']['title']='Memory distribution by release per month'
    894                         chart_data[type]['flavours']['graph']=build_data_per_month_flavours_mem(json[key][type],'Memory by flavour per month');
    895                         chart_data[type]['flavours']['title']='Memory distribution by flavour per month'
    896                         break;
    897                     case 'cpu':
    898                         if (! chart_data['cpu']){
    899                             chart_data['cpu']={'global':{},'releases':{},'flavours':{}};
    900                             chart_data['cpu']['title']='CpuS';
    901                         }
    902                         chart_data['cpu']['global']['graph']=build_data_per_month_cpu(json[key][type],'Number CpuS per month');
    903                         chart_data['cpu']['global']['title']='Number CpuS distribution per month'
    904                         chart_data['cpu']['releases']['graph']=build_data_per_month_releases_cpu(json[key][type],'Number CpuS by release per month');
    905                         chart_data['cpu']['releases']['title']='Number CpuS distribution by release per month'
    906                         chart_data['cpu']['flavours']['graph']=build_data_per_month_flavours_cpu(json[key][type],'Number CpuS by release per month');
    907                         chart_data['cpu']['flavours']['title']='Number CpuS distribution by flavour per month'
    908                         break;
    909                     case 'count_ltsp':
    910                     case 'count_mode':
    911                         if (! chart_data['ltsp']){
    912                             chart_data['ltsp']={}
    913                             chart_data['ltsp']['title']='LTSP Usage'
    914                         }
    915                         if (type == 'count_ltsp'){
    916                             if (! chart_data['ltsp']['usage']){
    917                                 chart_data['ltsp']['usage']={}
    918                                 chart_data['ltsp']['usage']['graph']=build_data_per_month_ltsp_usage(json[key][type],'LTSP usage per month')
    919                                 chart_data['ltsp']['usage']['title']='LTSP Use'
    920                             }
    921                         }
    922                         if (type == 'count_mode'){
    923                             if (! chart_data['ltsp']['modes']){
    924                                 chart_data['ltsp']['modes']={}
    925                                 chart_data['ltsp']['modes']['graph']=build_data_per_month_ltsp_modes(json[key][type],'LTSP type by type per month')
    926                                 chart_data['ltsp']['modes']['title']='Clients LTSP Mode'
    927                             }
    928                         }
    929                         break;
    930                 }
    931             }
    932         }
    933         if (key == 'apps'){
    934             for (type in json['apps']){
    935                 switch(type){
    936                     case 'app':
    937                         app=json['apps'][type];
    938                         break;
    939                     case 'app_use':
    940                         if (json[key][type]){
    941                             chart_data[type]={};
    942                             chart_data[type]['title']='Application usage';
    943                             chart_data[type]['releases']={};
    944                             chart_data[type]['releases']['graph']=build_data_per_month_releases(json[key][type],'Application use by release per month ('+app+')');
    945                             chart_data[type]['releases']['title']='Use per month for application '+app;
    946                             chart_data[type]['flavours']={};
    947                             chart_data[type]['flavours']['graph']=build_data_per_month_flavours(json[key][type],'Application use by flavour per month ('+app+')');
    948                             chart_data[type]['flavours']['title']='Use per month for application '+app;
    949                         }
    950                         break;
    951                 }
    952             }
    953         }
    954         if (key.startsWith('debug')){
    955             if (key == 'debug_query_time'){
    956                 query_time=json[key];
    957             }
    958             if (key == 'debug_keep_alive'){
    959                 keep_alive=json[key];
    960             }
    961         }
    962     }
    963 
    964     for (var chart_type in chart_data){
    965         if (! chart_data[chart_type]['title']){
    966             continue;
    967         }else{
    968             $('#accordion').append('<h3 class="'+chart_type+'">'+chart_data[chart_type]['title']+'</h3><div id="'+chart_type+'"></div>');
    969         }
    970         for (var chart_variant in chart_data[chart_type]){
    971             if (chart_variant == 'title'){
    972                 continue;
    973             }
    974             if (chart_data[chart_type][chart_variant]['graph']){
    975                 $('#'+chart_type).append('<div id='+chart_type+'_'+chart_variant+'></div>');
    976                 var sizes=get_sizes(chart_type);
    977                 chart_data[chart_type][chart_variant]['graph']['options']['width']=sizes['width'];
    978                 chart_data[chart_type][chart_variant]['graph']['options']['height']=sizes['height'];
    979                 var chart = new google.visualization.LineChart(document.getElementById(chart_type+'_'+chart_variant));
    980                 chart.draw(chart_data[chart_type][chart_variant]['graph']['data'], chart_data[chart_type][chart_variant]['graph']['options']);
    981             }
    982         }
    983     }
    984 
    985     $('#loading').remove();
    986     $('#accordion').accordion({active:false,collapsible:true,heightStyle: "content",autoHeight:false});
    987     if (app != null){
    988         $('.app_use').click();
    989     }
    990     end_graph_time=get_time();
    991     print_stats(end_graph_time,query_time);
    992 
    993     });
     862    end_get_time=0;
     863    start_graph_time=0;
     864    function success ( json ) {
     865            json = JSON.parse(json);
     866            end_get_time=get_time();
     867            start_graph_time=end_get_time;
     868            var app=null;
     869            var order = {'machines_per_month':{},'clients_per_month':{},'freq_updates_per_month':{},'change_releases':{},'change_flavours':{},'count_ltsp':{},'count_mode':{},'architectures':{},'mem':{},'cpu':{}}
     870            for (var key in json){
     871                if (key == 'clients'){
     872                    for (var type in order){
     873                        if (! json[key][type]){
     874                            continue;
     875                        }
     876                        switch(type){
     877                            case 'machines_per_month':
     878                                if (! chart_data['clients_per_month']){
     879                                    chart_data['clients_per_month']={};
     880                                }
     881                                if (! chart_data['clients_per_month']['hosts']){
     882                                    chart_data['clients_per_month']['hosts']={};
     883                                }
     884                                chart_data['clients_per_month']['title']='Machines';
     885                                chart_data['clients_per_month']['hosts']['graph']=build_data_from_array(json[key][type],'Number of unique machines used')
     886                                chart_data['clients_per_month']['hosts']['title']='Number of unique machines used';
     887                                break;
     888                            case 'clients_per_month':
     889                                if (! chart_data['clients_per_month']){
     890                                    chart_data['clients_per_month']={};
     891                                }
     892                                if (! chart_data['clients_per_month']['releases']){
     893                                    chart_data['clients_per_month']['releases']={};
     894                                }
     895                                if (! chart_data['clients_per_month']['flavours']){
     896                                    chart_data['clients_per_month']['flavours']={};
     897                                }
     898                                chart_data[type]['title']='Machines';
     899                                chart_data[type]['releases']['graph']=build_data_per_month_releases(json[key][type],'Number instances by release per month')
     900                                chart_data[type]['releases']['title']='Number instances by release per month';
     901                                chart_data[type]['flavours']['graph']=build_data_per_month_flavours(json[key][type],'Number instances by flavour per month')
     902                                chart_data[type]['flavours']['title']='Number instances by flavour per month';
     903                                break;
     904                            case 'freq_updates_per_month':
     905                                if (! chart_data['changes']){
     906                                    chart_data['changes']={};
     907                                    chart_data['changes']['title']='Upgrades';
     908                                }
     909                                if (! chart_data['changes']['updates']){
     910                                    chart_data['changes']['updates']={};
     911                                }
     912                                chart_data['changes']['updates']['graph']=build_data_from_array(json[key][type],'Number updates per month')
     913                                chart_data['changes']['updates']['title']='Number updates per month';
     914                                break;
     915                            case 'change_releases':
     916                                if (! chart_data['changes']){
     917                                    chart_data['changes']={};
     918                                    chart_data['changes']['title']='Upgrades';
     919                                }
     920                                if (! chart_data['changes']['releases'])
     921                                    chart_data['changes']['releases']={};
     922                                chart_data['changes']['releases']['graph']=build_data_from_array(json[key][type],'Change releases per month')
     923                                chart_data['changes']['releases']['title']='Change releases per month';
     924                                break;
     925                            case 'change_flavours':
     926                                if (! chart_data['changes']){
     927                                    chart_data['changes']={};
     928                                    chart_data['changes']['title']='Changes';
     929                                }
     930                                if (! chart_data['changes']['flavours'])
     931                                    chart_data['changes']['flavours']={};
     932                                chart_data['changes']['flavours']['graph']=build_data_from_array(json[key][type],'Change flavours per month')
     933                                chart_data['changes']['flavours']['title']='Change flavours per month';
     934                                break;
     935                            case 'architectures':
     936                                if (! chart_data[type]){
     937                                    chart_data[type]={'global':{},'releases':{},'flavours':{}}
     938                                    chart_data[type]['title']='Architectures';
     939                                }
     940                                chart_data[type]['global']['graph']=build_data_per_month_arch(json[key][type],'Architectures per month');
     941                                chart_data[type]['global']['title']='Architectures distribution per month'
     942                                chart_data[type]['releases']['graph']=build_data_per_month_release_arch(json[key][type],'Architectures by release per month');
     943                                chart_data[type]['releases']['title']='Architectures distribution by release per month'
     944                                chart_data[type]['flavours']['graph']=build_data_per_month_flavour_arch(json[key][type],'Architectures by flavour per month');
     945                                chart_data[type]['flavours']['title']='Architectures distribution by flavour per month'
     946                                break;
     947                            case 'mem':
     948                                if (! chart_data[type]){
     949                                    chart_data[type]={'global':{},'releases':{},'flavours':{}};
     950                                    chart_data[type]['title']='Memory';
     951                                }
     952                                chart_data[type]['global']['graph']=build_data_per_month_mem(json[key][type],'Memory per month');
     953                                chart_data[type]['global']['title']='Memory distribution per month'
     954                                chart_data[type]['releases']['graph']=build_data_per_month_releases_mem(json[key][type],'Memory by release per month');
     955                                chart_data[type]['releases']['title']='Memory distribution by release per month'
     956                                chart_data[type]['flavours']['graph']=build_data_per_month_flavours_mem(json[key][type],'Memory by flavour per month');
     957                                chart_data[type]['flavours']['title']='Memory distribution by flavour per month'
     958                                break;
     959                            case 'cpu':
     960                                if (! chart_data['cpu']){
     961                                    chart_data['cpu']={'global':{},'releases':{},'flavours':{}};
     962                                    chart_data['cpu']['title']='CpuS';
     963                                }
     964                                chart_data['cpu']['global']['graph']=build_data_per_month_cpu(json[key][type],'Number CpuS per month');
     965                                chart_data['cpu']['global']['title']='Number CpuS distribution per month'
     966                                chart_data['cpu']['releases']['graph']=build_data_per_month_releases_cpu(json[key][type],'Number CpuS by release per month');
     967                                chart_data['cpu']['releases']['title']='Number CpuS distribution by release per month'
     968                                chart_data['cpu']['flavours']['graph']=build_data_per_month_flavours_cpu(json[key][type],'Number CpuS by release per month');
     969                                chart_data['cpu']['flavours']['title']='Number CpuS distribution by flavour per month'
     970                                break;
     971                            case 'count_ltsp':
     972                            case 'count_mode':
     973                                if (! chart_data['ltsp']){
     974                                    chart_data['ltsp']={}
     975                                    chart_data['ltsp']['title']='LTSP Usage'
     976                                }
     977                                if (type == 'count_ltsp'){
     978                                    if (! chart_data['ltsp']['usage']){
     979                                        chart_data['ltsp']['usage']={}
     980                                        chart_data['ltsp']['usage']['graph']=build_data_per_month_ltsp_usage(json[key][type],'LTSP usage per month')
     981                                        chart_data['ltsp']['usage']['title']='LTSP Use'
     982                                    }
     983                                }
     984                                if (type == 'count_mode'){
     985                                    if (! chart_data['ltsp']['modes']){
     986                                        chart_data['ltsp']['modes']={}
     987                                        chart_data['ltsp']['modes']['graph']=build_data_per_month_ltsp_modes(json[key][type],'LTSP type by type per month')
     988                                        chart_data['ltsp']['modes']['title']='Clients LTSP Mode'
     989                                    }
     990                                }
     991                                break;
     992                        }
     993                    }
     994                }
     995                if (key == 'apps'){
     996                    for (var app_num in json['apps']){
     997                            if (json['apps'][app_num]['app']){
     998                                if (json['apps'][app_num]['app_use']){
     999                                        var app=json['apps'][app_num]['app'];
     1000                                        var tapp='usage_'+app_num;
     1001                                        chart_data[tapp]={};
     1002                                        chart_data[tapp]['title']='Application usage '+app;
     1003                                        chart_data[tapp]['releases']={};
     1004                                        chart_data[tapp]['releases']['graph']=build_data_per_month_releases(json[key][app_num]['app_use'],'Application use by release per month ('+app+')');
     1005                                        chart_data[tapp]['releases']['title']='Use per month for application '+app;
     1006                                        chart_data[tapp]['flavours']={};
     1007                                        chart_data[tapp]['flavours']['graph']=build_data_per_month_flavours(json[key][app_num]['app_use'],'Application use by flavour per month ('+app+')');
     1008                                        chart_data[tapp]['flavours']['title']='Use per month for application '+app;
     1009                                }
     1010                               
     1011                            }
     1012                    }
     1013                }
     1014                if (key.startsWith('debug')){
     1015                    if (key == 'debug_query_time'){
     1016                        query_time=json[key];
     1017                    }
     1018                    if (key == 'debug_keep_alive'){
     1019                        keep_alive=json[key];
     1020                    }
     1021                }
     1022            }
     1023
     1024            for (var chart_type in chart_data){
     1025                if (! chart_data[chart_type]['title']){
     1026                    continue;
     1027                }else{
     1028                    $('#accordion').append('<h3 class="'+chart_type+'">'+chart_data[chart_type]['title']+'</h3><div id="'+chart_type+'"></div>');
     1029                }
     1030                for (var chart_variant in chart_data[chart_type]){
     1031                    if (chart_variant == 'title'){
     1032                        continue;
     1033                    }
     1034                    if (chart_data[chart_type][chart_variant]['graph']){
     1035                        $('#'+chart_type).append('<div id='+chart_type+'_'+chart_variant+'></div>');
     1036                        var sizes=get_sizes(chart_type);
     1037                        chart_data[chart_type][chart_variant]['graph']['options']['width']=sizes['width'];
     1038                        chart_data[chart_type][chart_variant]['graph']['options']['height']=sizes['height'];
     1039                        var chart = new google.visualization.LineChart(document.getElementById(chart_type+'_'+chart_variant));
     1040                        chart.draw(chart_data[chart_type][chart_variant]['graph']['data'], chart_data[chart_type][chart_variant]['graph']['options']);
     1041                    }
     1042                }
     1043            }
     1044
     1045            $('#loading').remove();
     1046            $('#accordion').accordion({active:false,collapsible:true,heightStyle: "content",autoHeight:false});
     1047            if (app != null){
     1048                $('.app_use').click();
     1049            }
     1050            end_graph_time=get_time();
     1051            print_stats(end_graph_time,query_time);
     1052    }
     1053   
     1054    $.ajax({    datatype: 'json',
     1055                url: "./GetExtendedStats"+parameter,
     1056                success: success,
     1057                async: true,
     1058        });
    9941059    return;
    9951060}
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph_min.js

    r7280 r7577  
    1 function drawChart(g,e,b,d){var c=.95*$("#"+b).parent().width();e={title:e,width:c,height:20*d,fontSize:10,legend:"none",hAxis:{viewWindow:{min:0}},chartArea:{left:"10%",right:"5%",top:"50",width:"100%",height:"100%"}};g=new google.visualization.DataView(g);g.setColumns([0,1,{calc:"stringify",sourceColumn:1,type:"string",role:"annotation"}]);b=new google.visualization.BarChart(document.getElementById(b));google.visualization.events.addListener(b,"ready",ready_charts);b.draw(g,e)}
    2 function get_sizes(g){$("#"+g).parent().width();$(window).height();return{width:"auto",height:"auto"}}
    3 function build_data_per_month_releases(g,e){var b=[];for(i=0;12>i;i++)if(b[i]={15:0,16:0,all:0},g[i]){for(rel in g[i]){if("15"==rel)for(fla in g[i][rel])b[i][rel]+=g[i][rel][fla];if("16"==rel)for(fla in g[i][rel])b[i][rel]+=g[i][rel][fla]}b[i].all=b[i]["15"]+b[i]["16"]}var d=[],c=new Date,f=new google.visualization.DataTable;f.addColumn({type:"date",role:"domain"},"Release");f.addColumn("number","Total Release 15");f.addColumn({type:"string",role:"style"},"Style Release 15");f.addColumn("number",
    4 "Total Release 16");f.addColumn({type:"string",role:"style"},"Style Release 16");f.addColumn("number","Total ALL Releases");f.addColumn({type:"string",role:"style"},"Style ALL Releases");date_values=[];for(i=1;12>=i;i++)month=c.getMonth(),year=c.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[i-1]["15"],"color:blue",b[i-1]["16"],"color:red",b[i-1].all,"color:grey"]),c.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:e,curveType:"function",
    5 isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["blue","red","grey"],lineWidth:5}}}
    6 function build_data_per_month_flavours(g,e){var b=[];for(i=0;12>i;i++)if(b[i]={server:0,client:0,desktop:0,other:0,all:0},g[i])for(rel in g[i])for(fla in g[i][rel])b[i][fla]+=g[i][rel][fla],b[i].all+=g[i][rel][fla];var d=[],c=new Date,f=new google.visualization.DataTable;f.addColumn({type:"date",role:"domain"},"Flavour");f.addColumn("number","Total Server");f.addColumn({type:"string",role:"style"},"Style Server");f.addColumn("number","Total Client");f.addColumn({type:"string",role:"style"},"Style Client");
    7 f.addColumn("number","Total Desktop");f.addColumn({type:"string",role:"style"},"Style Desktop");f.addColumn("number","Total Other");f.addColumn({type:"string",role:"style"},"Style Other");f.addColumn("number","Total ALL Flavours");f.addColumn({type:"string",role:"style"},"Style Total ALL Flavours");date_values=[];for(i=1;12>=i;i++)month=c.getMonth(),year=c.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[i-1].server,"color:purple",b[i-1].client,"color:teal",
    8 b[i-1].desktop,"color:gold",b[i-1].other,"color:olive",b[i-1].all,"color:grey"]),c.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","teal","gold","olive","grey"],lineWidth:5}}}
    9 function build_data_per_month_arch(g,e){for(var b=[],d=0;12>d;d++)if(b[d]={i386:0,x86_64:0},g[d])for(var c in g[d])for(var f in g[d][c])for(var a in g[d][c][f])b[d][a]+=g[d][c][f][a];c=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total x86");a.addColumn({type:"string",role:"style"},"Style x86");a.addColumn("number","Total x86_64");a.addColumn({type:"string",role:"style"},"Style x86_64");date_values=[];for(d=1;12>=d;d++)month=
    10 f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1].i386,"color:purple",b[d-1].x86_64,"color:gold"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold"],lineWidth:5}}}
    11 function build_data_per_month_release_arch(g,e){for(var b=[],d=0;12>d;d++)if(b[d]={"15_i386":0,"15_x86_64":0,"16_i386":0,"16_x86_64":0},g[d])for(var c in g[d])for(var f in g[d][c])for(var a in g[d][c][f])b[d][c+"_"+a]+=g[d][c][f][a];c=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 x86");a.addColumn({type:"string",role:"style"},"Style 15 x86");a.addColumn("number","Total 15 x86_64");a.addColumn({type:"string",role:"style"},
    12 "Style 15 x86_64");a.addColumn("number","Total 16 x86");a.addColumn({type:"string",role:"style"},"Style 16 x86");a.addColumn("number","Total 16 x86_64");a.addColumn({type:"string",role:"style"},"Style 16 x86_64");date_values=[];for(d=1;12>=d;d++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1]["15_i386"],"color:purple",b[d-1]["15_x86_64"],"color:gold",b[d-1]["16_i386"],"color:teal",b[d-1]["16_x86_64"],"color:olive"]),
    13 f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","teal","olive"],lineWidth:5}}}
    14 function build_data_per_month_flavour_arch(g,e){for(var b=[],d=0;12>d;d++)if(b[d]={client_i386:0,client_x86_64:0,server_i386:0,server_x86_64:0,desktop_i386:0,desktop_x86_64:0,other_i386:0,other_x86_64:0},g[d])for(var c in g[d])for(var f in g[d][c])for(var a in g[d][c][f])b[d][f+"_"+a]+=g[d][c][f][a];c=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total client x86");a.addColumn({type:"string",role:"style"},"Style client x86");
    15 a.addColumn("number","Total client x86_64");a.addColumn({type:"string",role:"style"},"Style client x86_64");a.addColumn("number","Total server x86");a.addColumn({type:"string",role:"style"},"Style server x86");a.addColumn("number","Total server x86_64");a.addColumn({type:"string",role:"style"},"Style server x86_64");a.addColumn("number","Total desktop x86");a.addColumn({type:"string",role:"style"},"Style desktop x86");a.addColumn("number","Total desktop x86_64");a.addColumn({type:"string",role:"style"},
    16 "Style desktop x86_64");a.addColumn("number","Total other x86");a.addColumn({type:"string",role:"style"},"Style other x86");a.addColumn("number","Total other x86_64");a.addColumn({type:"string",role:"style"},"Style other x86_64");date_values=[];for(d=1;12>=d;d++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1].client_i386,"color:goldenrod",b[d-1].client_x86_64,"color:gold",b[d-1].server_i386,"color:darkviolet",b[d-1].server_x86_64,
    17 "color:deeppink",b[d-1].desktop_i386,"color:slateblue",b[d-1].desktop_x86_64,"color:skyblue",b[d-1].other_i386,"color:plum",b[d-1].other_x86_64,"color:pink"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"goldenrod gold darkviolet deeppink slateblue skyblue plum pink".split(" "),
    18 lineWidth:5}}}
    19 function build_data_per_month_releases_mem(g,e){for(var b=[],d=["2G","4G","8G"],c=0;12>c;c++){b[c]={"15_2G":0,"15_4G":0,"15_8G":0,"16_2G":0,"16_4G":0,"16_8G":0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][a+"_"+d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 < 2G");a.addColumn({type:"string",role:"style"},"Style 15 < 2G");a.addColumn("number","Total 15 < 4G");
    20 a.addColumn({type:"string",role:"style"},"Style 15 < 4G");a.addColumn("number","Total 15 > 4G");a.addColumn({type:"string",role:"style"},"Style 15 > 4G");a.addColumn("number","Total 16 < 2G");a.addColumn({type:"string",role:"style"},"Style 16 < 2G");a.addColumn("number","Total 16 < 4G");a.addColumn({type:"string",role:"style"},"Style 16 < 4G");a.addColumn("number","Total 16 > 4G");a.addColumn({type:"string",role:"style"},"Style 16 > 4G");date_values=[];for(c=1;12>=c;c++)month=f.getMonth(),year=f.getFullYear(),
    21 date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1]["15_2G"],"color:darkgoldenrod",b[c-1]["15_4G"],"color:goldenrod",b[c-1]["15_8G"],"color:gold",b[c-1]["16_2G"],"color:darkviolet",b[c-1]["16_4G"],"color:deeppink",b[c-1]["16_8G"],"color:pink"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},
    22 chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink".split(" "),lineWidth:5}}}
    23 function build_data_per_month_mem(g,e){for(var b=[],d=["2G","4G","8G"],c=0;12>c;c++){b[c]={"2G":0,"4G":0,"8G":0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total < 2G");a.addColumn({type:"string",role:"style"},"Style < 2G");a.addColumn("number","Total < 4G");a.addColumn({type:"string",role:"style"},"Style < 4G");
    24 a.addColumn("number","Total > 4G");a.addColumn({type:"string",role:"style"},"Style > 4G");date_values=[];for(c=1;12>=c;c++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1]["2G"],"color:gold",b[c-1]["4G"],"color:red",b[c-1]["8G"],"color:blue"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",
    25 viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["gold","red","blue"],lineWidth:5}}}
    26 function build_data_per_month_flavours_mem(g,e){for(var b=[],d=["2G","4G","8G"],c=0;12>c;c++){b[c]={client_2G:0,client_4G:0,client_8G:0,server_2G:0,server_4G:0,server_8G:0,desktop_2G:0,desktop_4G:0,desktop_8G:0,other_2G:0,other_4G:0,other_8G:0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][h+"_"+d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total client < 2G");
    27 a.addColumn({type:"string",role:"style"},"Style client < 2G");a.addColumn("number","Total client < 4G");a.addColumn({type:"string",role:"style"},"Style client < 4G");a.addColumn("number","Total client > 4G");a.addColumn({type:"string",role:"style"},"Style client > 4G");a.addColumn("number","Total server < 2G");a.addColumn({type:"string",role:"style"},"Style server < 2G");a.addColumn("number","Total server < 4G");a.addColumn({type:"string",role:"style"},"Style server < 4G");a.addColumn("number","Total server > 4G");
    28 a.addColumn({type:"string",role:"style"},"Style server > 4G");a.addColumn("number","Total desktop < 2G");a.addColumn({type:"string",role:"style"},"Style desktop < 2G");a.addColumn("number","Total desktop < 4G");a.addColumn({type:"string",role:"style"},"Style desktop < 4G");a.addColumn("number","Total desktop > 4G");a.addColumn({type:"string",role:"style"},"Style desktop > 4G");a.addColumn("number","Total other < 2G");a.addColumn({type:"string",role:"style"},"Style other < 2G");a.addColumn("number",
    29 "Total other < 4G");a.addColumn({type:"string",role:"style"},"Style other < 4G");a.addColumn("number","Total other > 4G");a.addColumn({type:"string",role:"style"},"Style other > 4G");date_values=[];for(c=1;12>=c;c++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1].client_2G,"color:darkgoldenrod",b[c-1].client_4G,"color:goldenrod",b[c-1].client_8G,"color:gold",b[c-1].server_2G,"color:darkviolet",b[c-1].server_4G,"color:deeppink",
    30 b[c-1].server_8G,"color:pink",b[c-1].desktop_2G,"color:slateblue",b[c-1].desktop_4G,"color:skyblue",b[c-1].desktop_8G,"color:blue",b[c-1].other_2G,"color:teal",b[c-1].other_4G,"color:darkkhaki",b[c-1].other_8G,"color:green"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},
    31 focusTarget:"category",colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink slateblue skyblue blue teal darkkhaki green".split(" "),lineWidth:5}}}
    32 function build_data_per_month_ltsp_usage(g,e){for(var b=[],d=0;24>d;d++){var c=Math.floor(d/2);g[d]&&(b[c]||(b[c]={0:0,1:0}),b[c][parseInt(g[d][0])]=parseInt(g[d][1]))}c=[];var f=new Date,a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total normal clients");a.addColumn({type:"string",role:"style"},"Total normal clients style");a.addColumn("number","Total ltsp clients");a.addColumn({type:"string",role:"style"},"Total ltsp clients style");
    33 date_values=[];for(d=1;12>=d;d++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1][0],"color:purple",b[d-1][1],"color:gold"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",
    34 colors:["purple","gold"],lineWidth:5}}}
    35 function build_data_per_month_ltsp_modes(g,e){for(var b=[],d=0;36>d;d++){var c=Math.floor(d/3);g[d]&&(b[c]||(b[c]={thin:0,semi:0,fat:0}),b[c][g[d][0]]=parseInt(g[d][1]))}c=[];var f=new Date,a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total thin clients");a.addColumn({type:"string",role:"style"},"Total thin clients style");a.addColumn("number","Total semi clients");a.addColumn({type:"string",role:"style"},"Total semi clients style");a.addColumn("number",
    36 "Total fat clients");a.addColumn({type:"string",role:"style"},"Total fat clients style");date_values=[];for(d=1;12>=d;d++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1].thin,"color:purple",b[d-1].semi,"color:gold",b[d-1].fat,"color:olive"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",
    37 viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","olive"],lineWidth:5}}}
    38 function build_data_per_month_releases_cpu(g,e){for(var b=[],d=["mono","dualquad","more"],c=0;12>c;c++){b[c]={"15_mono":0,"15_dualquad":0,"15_more":0,"16_mono":0,"16_dualquad":0,"16_more":0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][a+"_"+d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 mono processor");a.addColumn({type:"string",role:"style"},"Style 15 mono processor");
    39 a.addColumn("number","Total 15 dual or quad processor");a.addColumn({type:"string",role:"style"},"Style 15 dual or quad processor");a.addColumn("number","Total 15 more than quad processor");a.addColumn({type:"string",role:"style"},"Style 15 more than quad processor");a.addColumn("number","Total 16 mono processor");a.addColumn({type:"string",role:"style"},"Style 16 mono processor");a.addColumn("number","Total 16 dual or quad processor");a.addColumn({type:"string",role:"style"},"Style 16 dual or quad processor");
    40 a.addColumn("number","Total 16 more than quad processor");a.addColumn({type:"string",role:"style"},"Style 16 more than quad processor");date_values=[];for(c=1;12>=c;c++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1]["15_mono"],"color:darkgoldenrod",b[c-1]["15_dualquad"],"color:goldenrod",b[c-1]["15_more"],"color:gold",b[c-1]["16_mono"],"color:darkviolet",b[c-1]["16_dualquad"],"color:deeppink",b[c-1]["16_more"],"color:pink"]),
    41 f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink".split(" "),lineWidth:5}}}
    42 function build_data_per_month_cpu(g,e){for(var b=[],d=["mono","dualquad","more"],c=0;12>c;c++){b[c]={mono:0,dualquad:0,more:0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total mono processor");a.addColumn({type:"string",role:"style"},"Style mono processor");a.addColumn("number","Total dual or quad processor");a.addColumn({type:"string",
    43 role:"style"},"Style dual or quad processor");a.addColumn("number","Total more than quad processor");a.addColumn({type:"string",role:"style"},"Style more than quad processor");date_values=[];for(c=1;12>=c;c++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1].mono,"color:gold",b[c-1].dualquad,"color:red",b[c-1].more,"color:blue"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",
    44 isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["gold","red","blue"],lineWidth:5}}}
    45 function build_data_per_month_flavours_cpu(g,e){for(var b=[],d=["mono","dualquad","more"],c=0;12>c;c++){b[c]={client_mono:0,client_dualquad:0,client_more:0,server_mono:0,server_dualquad:0,server_more:0,desktop_mono:0,desktop_dualquad:0,desktop_more:0,other_mono:0,other_dualquad:0,other_more:0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][h+"_"+d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},
    46 "Date");a.addColumn("number","Total client mono processor");a.addColumn({type:"string",role:"style"},"Style client mono processor");a.addColumn("number","Total client dual or quad processor");a.addColumn({type:"string",role:"style"},"Style client dual or quad processor");a.addColumn("number","Total client more than quad processor");a.addColumn({type:"string",role:"style"},"Style client more than quad processor");a.addColumn("number","Total server mono processor");a.addColumn({type:"string",role:"style"},
    47 "Style server mono processor");a.addColumn("number","Total server dual or quad processor");a.addColumn({type:"string",role:"style"},"Style server dual or quad processor");a.addColumn("number","Total server more than quad processor");a.addColumn({type:"string",role:"style"},"Style server more than quad processor");a.addColumn("number","Total desktop mono processor");a.addColumn({type:"string",role:"style"},"Style desktop mono processor");a.addColumn("number","Total desktop dual or quad processor");
    48 a.addColumn({type:"string",role:"style"},"Style desktop dual or quad processor");a.addColumn("number","Total desktop more than quad processor");a.addColumn({type:"string",role:"style"},"Style desktop more than quad processor");a.addColumn("number","Total other mono processor");a.addColumn({type:"string",role:"style"},"Style other mono processor");a.addColumn("number","Total other dual or quad processor");a.addColumn({type:"string",role:"style"},"Style other dual or quad processor");a.addColumn("number",
    49 "Total other more than quad processor");a.addColumn({type:"string",role:"style"},"Style other more than quad processor");date_values=[];for(c=1;12>=c;c++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1].client_mono,"color:darkgoldenrod",b[c-1].client_dualquad,"color:goldenrod",b[c-1].client_more,"color:gold",b[c-1].server_mono,"color:darkviolet",b[c-1].server_dualquad,"color:deeppink",b[c-1].server_more,"color:pink",
    50 b[c-1].desktop_mono,"color:slateblue",b[c-1].desktop_dualquad,"color:skyblue",b[c-1].desktop_more,"color:blue",b[c-1].other_mono,"color:teal",b[c-1].other_dualquad,"color:darkkhaki",b[c-1].other_more,"color:green"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",
    51 colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink slateblue skyblue blue teal darkkhaki green".split(" "),lineWidth:5}}}
    52 function build_data_from_array(g,e){var b=[],d=new Date,c=new google.visualization.DataTable;c.addColumn({type:"date",role:"domain"},"Nhosts");c.addColumn("number",e);date_values=[];for(i=1;12>=i;i++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),b.push(date_to_add),date_values.push([date_to_add,g[i-1]]),d.setMonth(month-1);c.addRows(date_values);return{data:c,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:b,format:"MMM"},vAxis:{title:"Num hosts",
    53 minValue:0,maxValue:"automatic",viewWindowMode:"pretty",viewWindow:{min:0,max:"auto"},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",lineWidth:5}}}
    54 function doExtendedChart(){end_load_time=get_time();var g=window.location.search.substr(1);""!=g&&(g="?"+g);var e={};start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');$.getJSON("./GetExtendedStats"+g,function(b){start_graph_time=end_get_time=get_time();var d=null,c={machines_per_month:{},clients_per_month:{},freq_updates_per_month:{},change_releases:{},change_flavours:{},count_ltsp:{},count_mode:{},architectures:{},mem:{},cpu:{}};for(key in b){if("clients"==key)for(type in c)if(b[key][type])switch(type){case "machines_per_month":e.clients_per_month||
    55 (e.clients_per_month={});e.clients_per_month.hosts||(e.clients_per_month.hosts={});e.clients_per_month.title="Machines";e.clients_per_month.hosts.graph=build_data_from_array(b[key][type],"Number of unique machines used");e.clients_per_month.hosts.title="Number of unique machines used";break;case "clients_per_month":e.clients_per_month||(e.clients_per_month={});e.clients_per_month.releases||(e.clients_per_month.releases={});e.clients_per_month.flavours||(e.clients_per_month.flavours={});e[type].title=
    56 "Machines";e[type].releases.graph=build_data_per_month_releases(b[key][type],"Number instances by release per month");e[type].releases.title="Number instances by release per month";e[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Number instances by flavour per month");e[type].flavours.title="Number instances by flavour per month";break;case "freq_updates_per_month":e[type]={};e[type].title="Updates";e[type].releases={};e[type].releases.graph=build_data_per_month_releases(b[key][type],
    57 "Number updates by release per month");e[type].releases.title="Number updates by release per month";e[type].flavours={};e[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Number updates by flavour per month");e[type].flavours.title="Number updates by flavour per month";break;case "change_releases":e.changes||(e.changes={},e.changes.title="Upgrades");e.changes.releases||(e.changes.releases={});e.changes.releases.graph=build_data_from_array(b[key][type],"Change releases per month");
    58 e.changes.releases.title="Change releases per month";break;case "change_flavours":e.changes||(e.changes={},e.changes.title="Changes");e.changes.flavours||(e.changes.flavours={});e.changes.flavours.graph=build_data_from_array(b[key][type],"Change flavours per month");e.changes.flavours.title="Change flavours per month";break;case "architectures":e[type]||(e[type]={global:{},releases:{},flavours:{}},e[type].title="Architectures");e[type].global.graph=build_data_per_month_arch(b[key][type],"Architectures per month");
    59 e[type].global.title="Architectures distribution per month";e[type].releases.graph=build_data_per_month_release_arch(b[key][type],"Architectures by release per month");e[type].releases.title="Architectures distribution by release per month";e[type].flavours.graph=build_data_per_month_flavour_arch(b[key][type],"Architectures by flavour per month");e[type].flavours.title="Architectures distribution by flavour per month";break;case "mem":e[type]||(e[type]={global:{},releases:{},flavours:{}},e[type].title=
    60 "Memory");e[type].global.graph=build_data_per_month_mem(b[key][type],"Memory per month");e[type].global.title="Memory distribution per month";e[type].releases.graph=build_data_per_month_releases_mem(b[key][type],"Memory by release per month");e[type].releases.title="Memory distribution by release per month";e[type].flavours.graph=build_data_per_month_flavours_mem(b[key][type],"Memory by flavour per month");e[type].flavours.title="Memory distribution by flavour per month";break;case "cpu":e.cpu||(e.cpu=
    61 {global:{},releases:{},flavours:{}},e.cpu.title="CpuS");e.cpu.global.graph=build_data_per_month_cpu(b[key][type],"Number CpuS per month");e.cpu.global.title="Number CpuS distribution per month";e.cpu.releases.graph=build_data_per_month_releases_cpu(b[key][type],"Number CpuS by release per month");e.cpu.releases.title="Number CpuS distribution by release per month";e.cpu.flavours.graph=build_data_per_month_flavours_cpu(b[key][type],"Number CpuS by release per month");e.cpu.flavours.title="Number CpuS distribution by flavour per month";
    62 break;case "count_ltsp":case "count_mode":e.ltsp||(e.ltsp={},e.ltsp.title="LTSP Usage"),"count_ltsp"!=type||e.ltsp.usage||(e.ltsp.usage={},e.ltsp.usage.graph=build_data_per_month_ltsp_usage(b[key][type],"LTSP usage per month"),e.ltsp.usage.title="LTSP Use"),"count_mode"!=type||e.ltsp.modes||(e.ltsp.modes={},e.ltsp.modes.graph=build_data_per_month_ltsp_modes(b[key][type],"LTSP type by type per month"),e.ltsp.modes.title="Clients LTSP Mode")}if("apps"==key)for(type in b.apps)switch(type){case "app":d=
    63 b.apps[type];break;case "app_use":b[key][type]&&(e[type]={},e[type].title="Application usage",e[type].releases={},e[type].releases.graph=build_data_per_month_releases(b[key][type],"Application use by release per month ("+d+")"),e[type].releases.title="Use per month for application "+d,e[type].flavours={},e[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Application use by flavour per month ("+d+")"),e[type].flavours.title="Use per month for application "+d)}key.startsWith("debug")&&
    64 ("debug_query_time"==key&&(query_time=b[key]),"debug_keep_alive"==key&&(keep_alive=b[key]))}for(var f in e)if(e[f].title){$("#accordion").append('<h3 class="'+f+'">'+e[f].title+'</h3><div id="'+f+'"></div>');for(var a in e[f])"title"!=a&&e[f][a].graph&&($("#"+f).append("<div id="+f+"_"+a+"></div>"),b=get_sizes(f),e[f][a].graph.options.width=b.width,e[f][a].graph.options.height=b.height,(new google.visualization.LineChart(document.getElementById(f+"_"+a))).draw(e[f][a].graph.data,e[f][a].graph.options))}$("#loading").remove();
    65 $("#accordion").accordion({active:!1,collapsible:!0,heightStyle:"content",autoHeight:!1});null!=d&&$(".app_use").click();end_graph_time=get_time();print_stats(end_graph_time,query_time)})}
    66 function doChart(g){g=void 0===g?"":g;end_load_time=get_time();var e=new google.visualization.DataTable;e.addColumn("string","App");e.addColumn("number","Count");e=new google.visualization.DataTable;e.addColumn("string","App");e.addColumn("number","Count");e=new google.visualization.DataTable;e.addColumn("string","App");e.addColumn("number","Count");start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');console.log(g);""==g?(url="./GetStats",limit=10):(url="./GetLliurexStats",
     1function drawChart(g,f,b,d){var c=.95*$("#"+b).parent().width();f={title:f,width:c,height:20*d,fontSize:10,legend:"none",hAxis:{viewWindow:{min:0}},chartArea:{left:"10%",right:"5%",top:"50",width:"100%",height:"100%"}};g=new google.visualization.DataView(g);g.setColumns([0,1,{calc:"stringify",sourceColumn:1,type:"string",role:"annotation"}]);b=new google.visualization.BarChart(document.getElementById(b));google.visualization.events.addListener(b,"ready",ready_charts);b.draw(g,f)}
     2function get_sizes(g){g=.95*$("#"+g).parent().width();$(window).height();return{width:g,height:"auto"}}
     3function build_data_per_month_releases(g,f){var b=[];for(i=0;12>i;i++)if(b[i]={15:0,16:0,all:0},g[i]){for(rel in g[i]){if("15"==rel)for(fla in g[i][rel])b[i][rel]+=g[i][rel][fla];if("16"==rel)for(fla in g[i][rel])b[i][rel]+=g[i][rel][fla]}b[i].all=b[i]["15"]+b[i]["16"]}var d=[],c=new Date,e=new google.visualization.DataTable;e.addColumn({type:"date",role:"domain"},"Release");e.addColumn("number","Total Release 15");e.addColumn({type:"string",role:"style"},"Style Release 15");e.addColumn("number",
     4"Total Release 16");e.addColumn({type:"string",role:"style"},"Style Release 16");e.addColumn("number","Total ALL Releases");e.addColumn({type:"string",role:"style"},"Style ALL Releases");date_values=[];for(i=1;12>=i;i++)month=c.getMonth(),year=c.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[i-1]["15"],"color:blue",b[i-1]["16"],"color:red",b[i-1].all,"color:grey"]),c.setMonth(month-1);e.addRows(date_values);return{data:e,options:{title:f,curveType:"function",
     5isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["blue","red","grey"],lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     6function build_data_per_month_flavours(g,f){var b=[];for(i=0;12>i;i++)if(b[i]={server:0,client:0,desktop:0,other:0,all:0},g[i])for(rel in g[i])for(fla in g[i][rel])b[i][fla]+=g[i][rel][fla],b[i].all+=g[i][rel][fla];var d=[],c=new Date,e=new google.visualization.DataTable;e.addColumn({type:"date",role:"domain"},"Flavour");e.addColumn("number","Total Server");e.addColumn({type:"string",role:"style"},"Style Server");e.addColumn("number","Total Client");e.addColumn({type:"string",role:"style"},"Style Client");
     7e.addColumn("number","Total Desktop");e.addColumn({type:"string",role:"style"},"Style Desktop");e.addColumn("number","Total Other");e.addColumn({type:"string",role:"style"},"Style Other");e.addColumn("number","Total ALL Flavours");e.addColumn({type:"string",role:"style"},"Style Total ALL Flavours");date_values=[];for(i=1;12>=i;i++)month=c.getMonth(),year=c.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[i-1].server,"color:purple",b[i-1].client,"color:teal",
     8b[i-1].desktop,"color:gold",b[i-1].other,"color:olive",b[i-1].all,"color:grey"]),c.setMonth(month-1);e.addRows(date_values);return{data:e,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","teal","gold","olive","grey"],lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     9function build_data_per_month_arch(g,f){for(var b=[],d=0;12>d;d++)if(b[d]={i686:0,x86_64:0,unkn:0},g[d])for(var c in g[d])for(var e in g[d][c])for(var a in g[d][c][e])b[d][a]+=g[d][c][e][a];c=[];e=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total x86");a.addColumn({type:"string",role:"style"},"Style x86");a.addColumn("number","Total x86_64");a.addColumn({type:"string",role:"style"},"Style x86_64");a.addColumn("number","Total unknown");
     10a.addColumn({type:"string",role:"style"},"Style unknown");date_values=[];for(d=1;12>=d;d++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1].i686,"color:purple",b[d-1].x86_64,"color:gold",b[d-1].unkn,"color:grey"]),e.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},
     11legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","grey"],lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     12function build_data_per_month_release_arch(g,f){for(var b=[],d=0;12>d;d++)if(b[d]={"15_i686":0,"15_x86_64":0,"15_unkn":0,"16_i686":0,"16_x86_64":0,"16_unkn":0},g[d])for(var c in g[d])for(var e in g[d][c])for(var a in g[d][c][e])b[d][c+"_"+a]+=g[d][c][e][a];c=[];e=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 x86");a.addColumn({type:"string",role:"style"},"Style 15 x86");a.addColumn("number","Total 15 x86_64");a.addColumn({type:"string",
     13role:"style"},"Style 15 x86_64");a.addColumn("number","Total 15 unknown");a.addColumn({type:"string",role:"style"},"Style 15 unknown");a.addColumn("number","Total 16 x86");a.addColumn({type:"string",role:"style"},"Style 16 x86");a.addColumn("number","Total 16 x86_64");a.addColumn({type:"string",role:"style"},"Style 16 x86_64");a.addColumn("number","Total 16 unkown");a.addColumn({type:"string",role:"style"},"Style 16 unknown");date_values=[];for(d=1;12>=d;d++)month=e.getMonth(),year=e.getFullYear(),
     14date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1]["15_i686"],"color:purple",b[d-1]["15_x86_64"],"color:gold",b[d-1]["15_unkn"],"color:grey",b[d-1]["16_i686"],"color:teal",b[d-1]["16_x86_64"],"color:olive",b[d-1]["16_unkn"],"color:darkgrey"]),e.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},
     15chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","teal","olive"],lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     16function build_data_per_month_flavour_arch(g,f){for(var b=[],d=0;12>d;d++)if(b[d]={client_i686:0,client_x86_64:0,client_unkn:0,server_i686:0,server_x86_64:0,server_unkn:0,desktop_i686:0,desktop_x86_64:0,desktop_unkn:0,other_i686:0,other_x86_64:0,other_unkn:0},g[d])for(var c in g[d])for(var e in g[d][c])for(var a in g[d][c][e])b[d][e+"_"+a]+=g[d][c][e][a];c=[];e=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total client x86");a.addColumn({type:"string",
     17role:"style"},"Style client x86");a.addColumn("number","Total client x86_64");a.addColumn({type:"string",role:"style"},"Style client x86_64");a.addColumn("number","Total client unknown");a.addColumn({type:"string",role:"style"},"Style client unknown");a.addColumn("number","Total server x86");a.addColumn({type:"string",role:"style"},"Style server x86");a.addColumn("number","Total server x86_64");a.addColumn({type:"string",role:"style"},"Style server x86_64");a.addColumn("number","Total server unknown");
     18a.addColumn({type:"string",role:"style"},"Style server unknown");a.addColumn("number","Total desktop x86");a.addColumn({type:"string",role:"style"},"Style desktop x86");a.addColumn("number","Total desktop x86_64");a.addColumn({type:"string",role:"style"},"Style desktop x86_64");a.addColumn("number","Total desktop unknown");a.addColumn({type:"string",role:"style"},"Style desktop unknown");a.addColumn("number","Total other x86");a.addColumn({type:"string",role:"style"},"Style other x86");a.addColumn("number",
     19"Total other x86_64");a.addColumn({type:"string",role:"style"},"Style other x86_64");a.addColumn("number","Total other unknown");a.addColumn({type:"string",role:"style"},"Style other unknown");date_values=[];for(d=1;12>=d;d++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1].client_i686,"color:goldenrod",b[d-1].client_x86_64,"color:gold",b[d-1].client_unkn,"color:lightgrey",b[d-1].server_i686,"color:darkviolet",b[d-1].server_x86_64,
     20"color:deeppink",b[d-1].server_unkn,"color:grey",b[d-1].desktop_i686,"color:slateblue",b[d-1].desktop_x86_64,"color:skyblue",b[d-1].desktop_unkn,"color:darkgrey",b[d-1].other_i686,"color:plum",b[d-1].other_x86_64,"color:pink",b[d-1].other_unkn,"color:black"]),e.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},
     21chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"goldenrod gold lightgrey darkviolet deeppink grey slateblue skyblue darkgrey plum pink black".split(" "),lineWidth:5,tooltip:{textStyle:{fontSize:9}}}}}
     22function build_data_per_month_releases_mem(g,f){for(var b=[],d=["unkn","2G","4G","8G"],c=0;12>c;c++){b[c]={"15_2G":0,"15_4G":0,"15_8G":0,"15_unkn":0,"16_2G":0,"16_4G":0,"16_8G":0,"16_unkn":0};for(var e in d)if(g[d[e]][c])for(var a in g[d[e]][c])for(var h in g[d[e]][c][a])b[c][a+"_"+d[e]]+=g[d[e]][c][a][h]}d=[];e=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 < 2G");a.addColumn({type:"string",role:"style"},"Style 15 < 2G");
     23a.addColumn("number","Total 15 < 4G");a.addColumn({type:"string",role:"style"},"Style 15 < 4G");a.addColumn("number","Total 15 > 4G");a.addColumn({type:"string",role:"style"},"Style 15 > 4G");a.addColumn("number","Total 15 unknown");a.addColumn({type:"string",role:"style"},"Style 15 unknown");a.addColumn("number","Total 16 < 2G");a.addColumn({type:"string",role:"style"},"Style 16 < 2G");a.addColumn("number","Total 16 < 4G");a.addColumn({type:"string",role:"style"},"Style 16 < 4G");a.addColumn("number",
     24"Total 16 > 4G");a.addColumn({type:"string",role:"style"},"Style 16 > 4G");a.addColumn("number","Total 16 unknown");a.addColumn({type:"string",role:"style"},"Style 16 unknown");date_values=[];for(c=1;12>=c;c++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1]["15_2G"],"color:darkgoldenrod",b[c-1]["15_4G"],"color:goldenrod",b[c-1]["15_8G"],"color:gold",b[c-1]["15_unkn"],"color:lightgrey",b[c-1]["16_2G"],"color:darkviolet",
     25b[c-1]["16_4G"],"color:deeppink",b[c-1]["16_8G"],"color:pink",b[c-1]["16_unkn"],"color:darkgrey"]),e.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold lightgrey darkviolet deeppink pink darkgrey".split(" "),lineWidth:5,
     26tooltip:{textStyle:{fontSize:10}}}}}
     27function build_data_per_month_mem(g,f){for(var b=[],d=["unkn","2G","4G","8G"],c=0;12>c;c++){b[c]={unkn:0,"2G":0,"4G":0,"8G":0};for(var e in d)if(g[d[e]][c])for(var a in g[d[e]][c])for(var h in g[d[e]][c][a])b[c][d[e]]+=g[d[e]][c][a][h]}d=[];e=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total < 2G");a.addColumn({type:"string",role:"style"},"Style < 2G");a.addColumn("number","Total < 4G");a.addColumn({type:"string",role:"style"},
     28"Style < 4G");a.addColumn("number","Total > 4G");a.addColumn({type:"string",role:"style"},"Style > 4G");a.addColumn("number","Total unknown");a.addColumn({type:"string",role:"style"},"Style unknown");date_values=[];for(c=1;12>=c;c++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1]["2G"],"color:gold",b[c-1]["4G"],"color:red",b[c-1]["8G"],"color:blue",b[c-1].unkn,"color:grey"]),e.setMonth(month-1);a.addRows(date_values);
     29return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["gold","red","blue","grey"],lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     30function build_data_per_month_flavours_mem(g,f){for(var b=[],d=["unkn","2G","4G","8G"],c=0;12>c;c++){b[c]={client_2G:0,client_4G:0,client_8G:0,client_unkn:0,server_2G:0,server_4G:0,server_8G:0,server_unkn:0,desktop_2G:0,desktop_4G:0,desktop_8G:0,desktop_unkn:0,other_2G:0,other_4G:0,other_8G:0,other_unkn:0};for(var e in d)if(g[d[e]][c])for(var a in g[d[e]][c])for(var h in g[d[e]][c][a])b[c][h+"_"+d[e]]+=g[d[e]][c][a][h]}d=[];e=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",
     31role:"domain"},"Date");a.addColumn("number","Total client < 2G");a.addColumn({type:"string",role:"style"},"Style client < 2G");a.addColumn("number","Total client < 4G");a.addColumn({type:"string",role:"style"},"Style client < 4G");a.addColumn("number","Total client > 4G");a.addColumn({type:"string",role:"style"},"Style client > 4G");a.addColumn("number","Total client > unknown");a.addColumn({type:"string",role:"style"},"Style client unknown");a.addColumn("number","Total server < 2G");a.addColumn({type:"string",
     32role:"style"},"Style server < 2G");a.addColumn("number","Total server < 4G");a.addColumn({type:"string",role:"style"},"Style server < 4G");a.addColumn("number","Total server > 4G");a.addColumn({type:"string",role:"style"},"Style server > 4G");a.addColumn("number","Total server unknown");a.addColumn({type:"string",role:"style"},"Style server unknown");a.addColumn("number","Total desktop < 2G");a.addColumn({type:"string",role:"style"},"Style desktop < 2G");a.addColumn("number","Total desktop < 4G");
     33a.addColumn({type:"string",role:"style"},"Style desktop < 4G");a.addColumn("number","Total desktop > 4G");a.addColumn({type:"string",role:"style"},"Style desktop > 4G");a.addColumn("number","Total desktop unknown");a.addColumn({type:"string",role:"style"},"Style desktop unknown");a.addColumn("number","Total other < 2G");a.addColumn({type:"string",role:"style"},"Style other < 2G");a.addColumn("number","Total other < 4G");a.addColumn({type:"string",role:"style"},"Style other < 4G");a.addColumn("number",
     34"Total other > 4G");a.addColumn({type:"string",role:"style"},"Style other > 4G");a.addColumn("number","Total other unknown");a.addColumn({type:"string",role:"style"},"Style other unknown");date_values=[];for(c=1;12>=c;c++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1].client_2G,"color:darkgoldenrod",b[c-1].client_4G,"color:goldenrod",b[c-1].client_8G,"color:gold",b[c-1].client_unkn,"color:lightgrey",b[c-1].server_2G,
     35"color:darkviolet",b[c-1].server_4G,"color:deeppink",b[c-1].server_8G,"color:pink",b[c-1].server_unkn,"color:grey",b[c-1].desktop_2G,"color:slateblue",b[c-1].desktop_4G,"color:skyblue",b[c-1].desktop_8G,"color:blue",b[c-1].desktop_unkn,"color:darkgrey",b[c-1].other_2G,"color:teal",b[c-1].other_4G,"color:darkkhaki",b[c-1].other_8G,"color:green",b[c-1].other_unkn,"color:black"]),e.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",
     36ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold lightgrey darkviolet deeppink pink grey slateblue skyblue blue darkgrey teal darkkhaki green black".split(" "),lineWidth:5,tooltip:{textStyle:{fontSize:9}}}}}
     37function build_data_per_month_ltsp_usage(g,f){for(var b=[],d=0;36>d;d++){var c=Math.floor(d/3);g[d]&&(b[c]||(b[c]={0:0,1:0,unkn:0}),b[c][g[d][0]]=parseInt(g[d][1]))}c=[];var e=new Date,a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total normal clients");a.addColumn({type:"string",role:"style"},"Total normal clients style");a.addColumn("number","Total ltsp clients");a.addColumn({type:"string",role:"style"},"Total ltsp clients style");a.addColumn("number",
     38"Total unknown clients");a.addColumn({type:"string",role:"style"},"Total unknown clients style");date_values=[];for(d=1;12>=d;d++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1][0],"color:purple",b[d-1][1],"color:gold",b[d-1].unkn,"color:grey"]),e.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",
     39viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","grey"],lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     40function build_data_per_month_ltsp_modes(g,f){for(var b=[],d=0;48>d;d++){var c=Math.floor(d/4);g[d]&&(b[c]||(b[c]={thin:0,semi:0,fat:0,unkn:0}),b[c][g[d][0]]=parseInt(g[d][1]))}c=[];var e=new Date,a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total thin clients");a.addColumn({type:"string",role:"style"},"Total thin clients style");a.addColumn("number","Total semi clients");a.addColumn({type:"string",role:"style"},"Total semi clients style");
     41a.addColumn("number","Total fat clients");a.addColumn({type:"string",role:"style"},"Total fat clients style");a.addColumn("number","Total unknown clients");a.addColumn({type:"string",role:"style"},"Total unknown clients style");date_values=[];for(d=1;12>=d;d++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1].thin,"color:purple",b[d-1].semi,"color:gold",b[d-1].fat,"color:olive",b[d-1].unkn,"color:grey"]),e.setMonth(month-
     421);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","olive","grey"],lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     43function build_data_per_month_releases_cpu(g,f){for(var b=[],d=["unkn","mono","dualquad","more"],c=0;12>c;c++){b[c]={"15_mono":0,"15_dualquad":0,"15_more":0,"15_unkn":0,"16_mono":0,"16_dualquad":0,"16_more":0,"16_unkn":0};for(var e in d)if(g[d[e]][c])for(var a in g[d[e]][c])for(var h in g[d[e]][c][a])b[c][a+"_"+d[e]]+=g[d[e]][c][a][h]}d=[];e=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 mono processor");a.addColumn({type:"string",
     44role:"style"},"Style 15 mono processor");a.addColumn("number","Total 15 dual or quad processor");a.addColumn({type:"string",role:"style"},"Style 15 dual or quad processor");a.addColumn("number","Total 15 more than quad processor");a.addColumn({type:"string",role:"style"},"Style 15 more than quad processor");a.addColumn("number","Total 15 unknown");a.addColumn({type:"string",role:"style"},"Style 15 unknown");a.addColumn("number","Total 16 mono processor");a.addColumn({type:"string",role:"style"},"Style 16 mono processor");
     45a.addColumn("number","Total 16 dual or quad processor");a.addColumn({type:"string",role:"style"},"Style 16 dual or quad processor");a.addColumn("number","Total 16 more than quad processor");a.addColumn({type:"string",role:"style"},"Style 16 more than quad processor");a.addColumn("number","Total 16 unknown");a.addColumn({type:"string",role:"style"},"Style 16 unknown");date_values=[];for(c=1;12>=c;c++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,
     46b[c-1]["15_mono"],"color:darkgoldenrod",b[c-1]["15_dualquad"],"color:goldenrod",b[c-1]["15_more"],"color:gold",b[c-1]["15_unkn"],"color:lightgrey",b[c-1]["16_mono"],"color:darkviolet",b[c-1]["16_dualquad"],"color:deeppink",b[c-1]["16_more"],"color:pink",b[c-1]["16_unkn"],"color:darkgrey"]),e.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},
     47legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold lightgrey darkviolet deeppink pink darkgrey".split(" "),lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     48function build_data_per_month_cpu(g,f){for(var b=[],d=["unkn","mono","dualquad","more"],c=0;12>c;c++){b[c]={unkn:0,mono:0,dualquad:0,more:0};for(var e in d)if(g[d[e]][c])for(var a in g[d[e]][c])for(var h in g[d[e]][c][a])b[c][d[e]]+=g[d[e]][c][a][h]}d=[];e=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total mono processor");a.addColumn({type:"string",role:"style"},"Style mono processor");a.addColumn("number","Total dual or quad processor");
     49a.addColumn({type:"string",role:"style"},"Style dual or quad processor");a.addColumn("number","Total more than quad processor");a.addColumn({type:"string",role:"style"},"Style more than quad processor");a.addColumn("number","Total unknown");a.addColumn({type:"string",role:"style"},"Style unknown");date_values=[];for(c=1;12>=c;c++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1].mono,"color:gold",b[c-1].dualquad,"color:red",
     50b[c-1].more,"color:blue",b[c-1].unkn,"color:grey"]),e.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["gold","red","blue","grey"],lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     51function build_data_per_month_flavours_cpu(g,f){for(var b=[],d=["unkn","mono","dualquad","more"],c=0;12>c;c++){b[c]={client_mono:0,client_dualquad:0,client_more:0,client_unkn:0,server_mono:0,server_dualquad:0,server_more:0,server_unkn:0,desktop_mono:0,desktop_dualquad:0,desktop_more:0,desktop_unkn:0,other_mono:0,other_dualquad:0,other_more:0,other_unkn:0};for(var e in d)if(g[d[e]][c])for(var a in g[d[e]][c])for(var h in g[d[e]][c][a])b[c][h+"_"+d[e]]+=g[d[e]][c][a][h]}d=[];e=new Date;a=new google.visualization.DataTable;
     52a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total client mono processor");a.addColumn({type:"string",role:"style"},"Style client mono processor");a.addColumn("number","Total client dual or quad processor");a.addColumn({type:"string",role:"style"},"Style client dual or quad processor");a.addColumn("number","Total client more than quad processor");a.addColumn({type:"string",role:"style"},"Style client more than quad processor");a.addColumn("number","Total client unknown processor");
     53a.addColumn({type:"string",role:"style"},"Style client unknown processor");a.addColumn("number","Total server mono processor");a.addColumn({type:"string",role:"style"},"Style server mono processor");a.addColumn("number","Total server dual or quad processor");a.addColumn({type:"string",role:"style"},"Style server dual or quad processor");a.addColumn("number","Total server more than quad processor");a.addColumn({type:"string",role:"style"},"Style server more than quad processor");a.addColumn("number",
     54"Total server unknown processor");a.addColumn({type:"string",role:"style"},"Style server unknown processor");a.addColumn("number","Total desktop mono processor");a.addColumn({type:"string",role:"style"},"Style desktop mono processor");a.addColumn("number","Total desktop dual or quad processor");a.addColumn({type:"string",role:"style"},"Style desktop dual or quad processor");a.addColumn("number","Total desktop more than quad processor");a.addColumn({type:"string",role:"style"},"Style desktop more than quad processor");
     55a.addColumn("number","Total desktop unknown processor");a.addColumn({type:"string",role:"style"},"Style desktop unknown processor");a.addColumn("number","Total other mono processor");a.addColumn({type:"string",role:"style"},"Style other mono processor");a.addColumn("number","Total other dual or quad processor");a.addColumn({type:"string",role:"style"},"Style other dual or quad processor");a.addColumn("number","Total other more than quad processor");a.addColumn({type:"string",role:"style"},"Style other more than quad processor");
     56a.addColumn("number","Total other unknown processor");a.addColumn({type:"string",role:"style"},"Style other unknown processor");date_values=[];for(c=1;12>=c;c++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1].client_mono,"color:darkgoldenrod",b[c-1].client_dualquad,"color:goldenrod",b[c-1].client_more,"color:gold",b[c-1].client_unkn,"color:lightgrey",b[c-1].server_mono,"color:darkviolet",b[c-1].server_dualquad,"color:deeppink",
     57b[c-1].server_more,"color:pink",b[c-1].server_unkn,"color:grey",b[c-1].desktop_mono,"color:slateblue",b[c-1].desktop_dualquad,"color:skyblue",b[c-1].desktop_more,"color:blue",b[c-1].desktop_unkn,"color:darkgrey",b[c-1].other_mono,"color:teal",b[c-1].other_dualquad,"color:darkkhaki",b[c-1].other_more,"color:green",b[c-1].other_unkn,"color:black"]),e.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},
     58vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold lightgrey darkviolet deeppink pink grey slateblue skyblue blue darkgrey teal darkkhaki green black".split(" "),lineWidth:5,tooltip:{textStyle:{fontSize:9}}}}}
     59function build_data_from_array(g,f){var b=[],d=new Date,c=new google.visualization.DataTable;c.addColumn({type:"date",role:"domain"},"Nhosts");c.addColumn("number",f);date_values=[];for(i=1;12>=i;i++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),b.push(date_to_add),date_values.push([date_to_add,g[i-1]]),d.setMonth(month-1);c.addRows(date_values);return{data:c,options:{title:f,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:b,format:"MMM"},vAxis:{title:"Num hosts",
     60minValue:0,maxValue:"automatic",viewWindowMode:"pretty",viewWindow:{min:0,max:"auto"},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",lineWidth:5,tooltip:{textStyle:{fontSize:10}}}}}
     61function doExtendedChart(){end_load_time=get_time();var g=window.location.search.substr(1);""!=g&&(g="?"+g);var f={};start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');start_graph_time=end_get_time=0;$.ajax({datatype:"json",url:"./GetExtendedStats"+g,success:function(b){b=JSON.parse(b);start_graph_time=end_get_time=get_time();var d=null,c={machines_per_month:{},clients_per_month:{},freq_updates_per_month:{},change_releases:{},change_flavours:{},count_ltsp:{},count_mode:{},
     62architectures:{},mem:{},cpu:{}},e;for(e in b){if("clients"==e)for(var a in c)if(b[e][a])switch(a){case "machines_per_month":f.clients_per_month||(f.clients_per_month={});f.clients_per_month.hosts||(f.clients_per_month.hosts={});f.clients_per_month.title="Machines";f.clients_per_month.hosts.graph=build_data_from_array(b[e][a],"Number of unique machines used");f.clients_per_month.hosts.title="Number of unique machines used";break;case "clients_per_month":f.clients_per_month||(f.clients_per_month={});
     63f.clients_per_month.releases||(f.clients_per_month.releases={});f.clients_per_month.flavours||(f.clients_per_month.flavours={});f[a].title="Machines";f[a].releases.graph=build_data_per_month_releases(b[e][a],"Number instances by release per month");f[a].releases.title="Number instances by release per month";f[a].flavours.graph=build_data_per_month_flavours(b[e][a],"Number instances by flavour per month");f[a].flavours.title="Number instances by flavour per month";break;case "freq_updates_per_month":f.changes||
     64(f.changes={},f.changes.title="Upgrades");f.changes.updates||(f.changes.updates={});f.changes.updates.graph=build_data_from_array(b[e][a],"Number updates per month");f.changes.updates.title="Number updates per month";break;case "change_releases":f.changes||(f.changes={},f.changes.title="Upgrades");f.changes.releases||(f.changes.releases={});f.changes.releases.graph=build_data_from_array(b[e][a],"Change releases per month");f.changes.releases.title="Change releases per month";break;case "change_flavours":f.changes||
     65(f.changes={},f.changes.title="Changes");f.changes.flavours||(f.changes.flavours={});f.changes.flavours.graph=build_data_from_array(b[e][a],"Change flavours per month");f.changes.flavours.title="Change flavours per month";break;case "architectures":f[a]||(f[a]={global:{},releases:{},flavours:{}},f[a].title="Architectures");f[a].global.graph=build_data_per_month_arch(b[e][a],"Architectures per month");f[a].global.title="Architectures distribution per month";f[a].releases.graph=build_data_per_month_release_arch(b[e][a],
     66"Architectures by release per month");f[a].releases.title="Architectures distribution by release per month";f[a].flavours.graph=build_data_per_month_flavour_arch(b[e][a],"Architectures by flavour per month");f[a].flavours.title="Architectures distribution by flavour per month";break;case "mem":f[a]||(f[a]={global:{},releases:{},flavours:{}},f[a].title="Memory");f[a].global.graph=build_data_per_month_mem(b[e][a],"Memory per month");f[a].global.title="Memory distribution per month";f[a].releases.graph=
     67build_data_per_month_releases_mem(b[e][a],"Memory by release per month");f[a].releases.title="Memory distribution by release per month";f[a].flavours.graph=build_data_per_month_flavours_mem(b[e][a],"Memory by flavour per month");f[a].flavours.title="Memory distribution by flavour per month";break;case "cpu":f.cpu||(f.cpu={global:{},releases:{},flavours:{}},f.cpu.title="CpuS");f.cpu.global.graph=build_data_per_month_cpu(b[e][a],"Number CpuS per month");f.cpu.global.title="Number CpuS distribution per month";
     68f.cpu.releases.graph=build_data_per_month_releases_cpu(b[e][a],"Number CpuS by release per month");f.cpu.releases.title="Number CpuS distribution by release per month";f.cpu.flavours.graph=build_data_per_month_flavours_cpu(b[e][a],"Number CpuS by release per month");f.cpu.flavours.title="Number CpuS distribution by flavour per month";break;case "count_ltsp":case "count_mode":f.ltsp||(f.ltsp={},f.ltsp.title="LTSP Usage"),"count_ltsp"!=a||f.ltsp.usage||(f.ltsp.usage={},f.ltsp.usage.graph=build_data_per_month_ltsp_usage(b[e][a],
     69"LTSP usage per month"),f.ltsp.usage.title="LTSP Use"),"count_mode"!=a||f.ltsp.modes||(f.ltsp.modes={},f.ltsp.modes.graph=build_data_per_month_ltsp_modes(b[e][a],"LTSP type by type per month"),f.ltsp.modes.title="Clients LTSP Mode")}if("apps"==e)for(var g in b.apps)if(b.apps[g].app&&b.apps[g].app_use){d=b.apps[g].app;var m="usage_"+g;f[m]={};f[m].title="Application usage "+d;f[m].releases={};f[m].releases.graph=build_data_per_month_releases(b[e][g].app_use,"Application use by release per month ("+
     70d+")");f[m].releases.title="Use per month for application "+d;f[m].flavours={};f[m].flavours.graph=build_data_per_month_flavours(b[e][g].app_use,"Application use by flavour per month ("+d+")");f[m].flavours.title="Use per month for application "+d}e.startsWith("debug")&&("debug_query_time"==e&&(query_time=b[e]),"debug_keep_alive"==e&&(keep_alive=b[e]))}for(var l in f)if(f[l].title){$("#accordion").append('<h3 class="'+l+'">'+f[l].title+'</h3><div id="'+l+'"></div>');for(var n in f[l])"title"!=n&&
     71f[l][n].graph&&($("#"+l).append("<div id="+l+"_"+n+"></div>"),b=get_sizes(l),f[l][n].graph.options.width=b.width,f[l][n].graph.options.height=b.height,(new google.visualization.LineChart(document.getElementById(l+"_"+n))).draw(f[l][n].graph.data,f[l][n].graph.options))}$("#loading").remove();$("#accordion").accordion({active:!1,collapsible:!0,heightStyle:"content",autoHeight:!1});null!=d&&$(".app_use").click();end_graph_time=get_time();print_stats(end_graph_time,query_time)},async:!0})}
     72function doChart(g){g=void 0===g?"":g;end_load_time=get_time();var f=new google.visualization.DataTable;f.addColumn("string","App");f.addColumn("number","Count");f=new google.visualization.DataTable;f.addColumn("string","App");f.addColumn("number","Count");f=new google.visualization.DataTable;f.addColumn("string","App");f.addColumn("number","Count");start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');console.log(g);""==g?(url="./GetStats",limit=10):(url="./GetLliurexStats",
    6773limit=1E3);$.getJSON(url,function(b){start_graph_time=end_get_time=get_time();count=0;for(key in b)if(!key.startsWith("debug"))for(key2 in b[key])count++;max_graph=3*count;obj=[];for(distro in b)if(distro.startsWith("debug"))"debug_query_time"==distro&&(query_time=b[distro]),"debug_keep_alive"==distro&&(keep_alive=b[distro]);else for(sabor in b[distro])for(titles=["Top apps este mes","Top apps ultimo mes","Top apps penultimo mes"],divname="chart_"+distro+"_"+sabor,$("#accordion").append("<h3>Distro "+
    6874distro+"("+sabor+")</h3>"),$("#accordion").append('<div class="'+divname+'"></h3>'),i=0;3>i;i++){$("div."+divname).append('<div id="'+divname+i+'"></div>');k=0;var d=new google.visualization.DataTable;d.addColumn("string","App");d.addColumn("number","Count");for($.each(b[distro][sabor][i][0],function(b,e){d.addRow([b,parseInt(e)]);k++});10>k;)d.addRow(["",0]),k++;obj.push(d);titles[i]=titles[i]+" (Total clients: "+b[distro][sabor][i][1].nclients+")";drawChart(obj[obj.length-1],titles[i],divname+i,
    6975k)}end_graph_time=get_time();print_stats(end_graph_time,query_time)})}num_ready=0;function ready_charts(){num_ready++;num_ready==max_graph&&($("#accordion>#loading").remove(),$("#accordion").accordion({active:!1,collapsible:!0,heightStyle:"content",autoHeight:!1}))}
    70 function print_stats(g,e){g=void 0===g?0:g;e=void 0===e?0:e;$("#stats_box").append('<span class="stats">Load time: '+((end_load_time-start_load_time)/1E3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Get time: '+parseFloat((end_get_time-start_get_time)/1E3-e).toFixed(3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Graph time: '+((g-start_graph_time)/1E3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Query time: '+parseFloat(e).toFixed(3).toString()+
     76function print_stats(g,f){g=void 0===g?0:g;f=void 0===f?0:f;$("#stats_box").append('<span class="stats">Load time: '+((end_load_time-start_load_time)/1E3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Get time: '+parseFloat((end_get_time-start_get_time)/1E3-f).toFixed(3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Graph time: '+((g-start_graph_time)/1E3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Query time: '+parseFloat(f).toFixed(3).toString()+
    7177" sec</span>");$("#stats_box").append('<span class="stats">Updated: '+keep_alive.toString()+"</span>")}function get_time(){return Date.now?Date.now():(new Date).getTime()}var start_graph_time=0,end_graph_time=0,start_load_time=get_time(),end_load_time=0,start_get_time=0,end_get_time=0,query_time="",keep_alive="";
Note: See TracChangeset for help on using the changeset viewer.