Changeset 7180


Ignore:
Timestamp:
Apr 26, 2018, 9:54:19 AM (18 months ago)
Author:
mabarracus
Message:

Optimize queries
Add mem,cpu,arch graphs
Fix mem graph bug

Location:
lliurex-analytics-server/trunk/fuentes
Files:
4 edited

Legend:

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

    r7168 r7180  
     1lliurex-analytics-server (0.2.6.3) xenial; urgency=medium
     2
     3  * Optimize queries
     4  * Add mem,cpu,arch graphs
     5  * Fix mem graph bug
     6
     7 -- M.Angel Juan <m.angel.juan@gmail.com>  Thu, 26 Apr 2018 09:52:37 +0200
     8
    19lliurex-analytics-server (0.2.6.2) xenial; urgency=medium
    210
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/db.php

    r7157 r7180  
    342342        }
    343343     function get_extended_data($app){
    344          $today=date("Y-m-d");
    345          $min_date=date("Y-m",strtotime($today." -1 year")).'-01';
     344         //$today=date("Y-m-d");
     345         //$min_date=date("Y-m",strtotime($today." -1 year")).'-01';
    346346         $this->times=0;
    347347         // 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 
     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";
    350350            $cache = new Cache;
    351351            $cache_key='extended_1';
     
    362362                 while($row=$result->fetch_array(MYSQLI_ASSOC)){
    363363                     $date=$row['year'].'_'.$row['month'];
    364                      $tmp[$date][$row['Releases_name']][$row['Flavours_name']]=intval($row['num_hosts']);
     364                     $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    365365                 }
    366366                 foreach ($tmp as $date){
     
    373373            }
    374374        // architecture
    375         $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;";
     375        //$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;";
     376        $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";
    376377        $cache_key='extended_arch';
    377378        $data = $cache->get($cache_key);
     
    387388                while($row=$result->fetch_array(MYSQLI_ASSOC)){
    388389                    $date=$row['year'].'_'.$row['month'];
    389                     $tmp[$date][$row['Releases_name']][$row['arch']]=intval($row['count']);
     390                    $tmp[$date][$row['rel']][$row['fla']][$row['arch']]=intval($row['total']);
    390391                }
    391392                foreach ($tmp as $date){
     
    398399        }
    399400        // memory
    400         $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";
     401        //$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";
     402        $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";
    401403        $cache_key='extended_memory_2G';
    402404        $data = $cache->get($cache_key);
     
    412414                while($row=$result->fetch_array(MYSQLI_ASSOC)){
    413415                    $date=$row['year'].'_'.$row['month'];
    414                     $tmp[$date][$row['rel']]=intval($row['count']);
     416                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    415417                }
    416418                foreach ($tmp as $date){
     
    422424            }
    423425        }
    424         $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";
     426        //$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";
     427        $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";
    425428        $cache_key='extended_memory_4G';
    426429        $data = $cache->get($cache_key);
     
    436439                while($row=$result->fetch_array(MYSQLI_ASSOC)){
    437440                    $date=$row['year'].'_'.$row['month'];
    438                     $tmp[$date][$row['rel']]=intval($row['count']);
     441                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    439442                }
    440443                foreach ($tmp as $date){
     
    446449            }
    447450        }
    448         $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";
     451        //$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";
     452        $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";
    449453        $cache_key='extended_memory_8G';
    450454        $data = $cache->get($cache_key);
     
    460464                while($row=$result->fetch_array(MYSQLI_ASSOC)){
    461465                    $date=$row['year'].'_'.$row['month'];
    462                     $tmp[$date][$row['rel']]=intval($row['count']);
     466                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    463467                }
    464468                foreach ($tmp as $date){
     
    471475        }
    472476        // cpu
    473         $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";
     477        //$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";
     478        $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";
    474479        $cache_key='extended_memory_cpu_mono';
    475480        $data = $cache->get($cache_key);
     
    485490                while($row=$result->fetch_array(MYSQLI_ASSOC)){
    486491                    $date=$row['year'].'_'.$row['month'];
    487                     $tmp[$date][$row['rel']]=intval($row['total']);
     492                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    488493                }
    489494                foreach ($tmp as $date){
     
    495500            }
    496501        }
    497         $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";
     502        //$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";
     503        $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";
    498504        $cache_key='extended_memory_cpu_dualquad';
    499505        $data = $cache->get($cache_key);
     
    509515                while($row=$result->fetch_array(MYSQLI_ASSOC)){
    510516                    $date=$row['year'].'_'.$row['month'];
    511                     $tmp[$date][$row['rel']]=intval($row['total']);
     517                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    512518                }
    513519                foreach ($tmp as $date){
     
    519525            }
    520526        }
    521         $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";
     527        //$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";
     528        $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";
    522529        $cache_key='extended_memory_cpu_other';
    523530        $data = $cache->get($cache_key);
     
    533540                while($row=$result->fetch_array(MYSQLI_ASSOC)){
    534541                    $date=$row['year'].'_'.$row['month'];
    535                     $tmp[$date][$row['rel']]=intval($row['total']);
     542                    $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']);
    536543                }
    537544                foreach ($tmp as $date){
     
    544551        }
    545552         // CLIENT UPDATES
    546          $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 >= '$min_date' 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";
     553         $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";
    547554
    548555            $cache_key='extended_2';
     
    573580
    574581         // CLIENT CHANGE RELEASE
    575          $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 >= '$min_date' 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";
     582         $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";
    576583
    577584
     
    598605
    599606         // CLIENT CHANGE FLAVOUR
    600          $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 >= '$min_date' 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";
     607         $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";
    601608
    602609            $cache_key='extended_4';
     
    673680                 $stats['apps']=[];
    674681                 $stats['apps']['app']=$app;
    675                  $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 >= '$min_date' group by year,month,Releases_name,Flavours_name order by year desc,month desc,sum(count) desc";
    676 
     682                 $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";
    677683                    $cache_key="extended_app_$app";
    678684                    $data = $cache->get($cache_key);
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph.js

    r7150 r7180  
    156156    return {data:data_table,options:options}
    157157}
    158 function build_data_per_month_arch(data,title){
     158function build_data_per_month_release_arch(data,title){
    159159    var total=[];
    160     for (i=0 ; i < 12; i++){
     160    for (var i=0 ; i < 12; i++){
    161161        total[i]={'15_i386':0,'15_x86_64':0,'16_i386':0,'16_x86_64':0};
    162162        if (! data[i]){
    163163            continue;
    164164        }
    165         for (rel in data[i]){
    166             for (arch in data[i][rel]){
    167                 total[i][rel+'_'+arch]+=data[i][rel][arch];
     165        for (var rel in data[i]){
     166            for (var fla in data[i][rel]){
     167                for (var arch in data[i][rel][fla]){
     168                    total[i][rel+'_'+arch]+=data[i][rel][fla][arch];
     169                }
    168170            }
    169171        }
     
    208210}
    209211
    210 function build_data_per_month_mem(data,title){
     212function build_data_per_month_flavour_arch(data,title){
     213    var total=[];
     214    for (var i=0 ; i < 12; i++){
     215        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};
     216        if (! data[i]){
     217            continue;
     218        }
     219        for (var rel in data[i]){
     220            for (var fla in data[i][rel]){
     221                for (var arch in data[i][rel][fla]){
     222                    total[i][fla+'_'+arch]+=data[i][rel][fla][arch];
     223                }
     224            }
     225        }
     226
     227    }
     228    var dates_axis=[];
     229    var d= new Date();
     230    var data_table = new google.visualization.DataTable();
     231    data_table.addColumn({type:'date',role:'domain'},'Date');
     232    data_table.addColumn('number','Total client x86');
     233    data_table.addColumn({type:'string',role:'style'},'Style client x86');
     234    data_table.addColumn('number','Total client x86_64');
     235    data_table.addColumn({type:'string',role:'style'},'Style client x86_64');
     236    data_table.addColumn('number','Total server x86');
     237    data_table.addColumn({type:'string',role:'style'},'Style server x86');
     238    data_table.addColumn('number','Total server x86_64');
     239    data_table.addColumn({type:'string',role:'style'},'Style server x86_64');
     240    data_table.addColumn('number','Total desktop x86');
     241    data_table.addColumn({type:'string',role:'style'},'Style desktop x86');
     242    data_table.addColumn('number','Total desktop x86_64');
     243    data_table.addColumn({type:'string',role:'style'},'Style desktop x86_64');
     244    data_table.addColumn('number','Total other x86');
     245    data_table.addColumn({type:'string',role:'style'},'Style other x86');
     246    data_table.addColumn('number','Total other x86_64');
     247    data_table.addColumn({type:'string',role:'style'},'Style other x86_64');
     248
     249
     250    date_values=[];
     251    for (i=1;i <= 12;i++){
     252        month=d.getMonth();
     253        year=d.getFullYear();
     254        date_to_add=new Date(year,month)
     255        dates_axis.push(date_to_add);
     256        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'])
     257        d.setMonth(month-1);
     258    }
     259    data_table.addRows(date_values);
     260    var options= {  title: title,
     261                    curveType: 'function',
     262                    isStacked: false,
     263                    hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
     264                    vAxis:{title:'Num hosts',viewWindow : {min:0},format:'#'},
     265                    legend:{textStyle:{fontSize: 10}},
     266                    chartArea:{left:'5%',right:'10%'},
     267                    focusTarget: 'category',
     268                    colors: ['goldenrod','gold','darkviolet','deeppink','slateblue','skyblue','plum','pink',],
     269                    lineWidth: 5,
     270                    };
     271    return {data:data_table,options:options}
     272}
     273function build_data_per_month_releases_mem(data,title){
    211274    var total=[];
    212275    var sizes=['2G','4G','8G']
     
    218281            }
    219282            for (var rel in data[sizes[size]][i]){
    220                 total[i][rel+'_'+sizes[size]]+=data[sizes[size]][i][rel];
     283                for (var fla in data[sizes[size]][i][rel]){
     284                    total[i][rel+'_'+sizes[size]]+=data[sizes[size]][i][rel][fla];
     285                }
    221286            }
    222287        }
     
    245310        date_to_add=new Date(year,month)
    246311        dates_axis.push(date_to_add);
    247         date_values.push([date_to_add,total[i-1]['15_2G'],'color:purple',total[i-1]['15_4G'],'color:gold',total[i-1]['15_8G'],'color:teal',total[i-1]['16_2G'],'color:olive',total[i-1]['16_4G'],'color:red',total[i-1]['16_8G'],'color:pink'])
    248         d.setMonth(month-1);
    249     }
    250     data_table.addRows(date_values);
    251     var options= {  title: title,
    252                     curveType: 'function',
    253                     isStacked: false,
    254                     hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
    255                     vAxis:{title:'Num hosts',viewWindow : {min:0},format:'#'},
     312        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'])
     313        d.setMonth(month-1);
     314    }
     315    data_table.addRows(date_values);
     316    var options= {  title: title,
     317                    curveType: 'function',
     318                    isStacked: false,
     319                    hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
     320                    vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'},
    256321                    legend:{textStyle:{fontSize: 10}},
    257322                    chartArea:{left:'5%',right:'10%'},
    258323                    focusTarget: 'category',
    259                     colors: ['purple','gold','teal','olive','red','pink'],
    260                     lineWidth: 5,
    261                     };
    262     return {data:data_table,options:options}
    263 }
     324                    colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink'],
     325                    lineWidth: 5,
     326                    };
     327    return {data:data_table,options:options}
     328}
     329function build_data_per_month_flavours_mem(data,title){
     330    var total=[];
     331    var sizes=['2G','4G','8G']
     332    for (var i=0 ; i < 12; i++){
     333        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};
     334        for (var size in sizes){
     335            if (! data[sizes[size]][i]){
     336                continue;
     337            }
     338            for (var rel in data[sizes[size]][i]){
     339                for (var fla in data[sizes[size]][i][rel]){
     340                    total[i][fla+'_'+sizes[size]]+=data[sizes[size]][i][rel][fla];
     341                }
     342            }
     343        }
     344    }
     345    var dates_axis=[];
     346    var d= new Date();
     347    var data_table = new google.visualization.DataTable();
     348    data_table.addColumn({type:'date',role:'domain'},'Date');
     349    data_table.addColumn('number','Total client < 2G');
     350    data_table.addColumn({type:'string',role:'style'},'Style client < 2G');
     351    data_table.addColumn('number','Total client < 4G');
     352    data_table.addColumn({type:'string',role:'style'},'Style client < 4G');
     353    data_table.addColumn('number','Total client > 4G');
     354    data_table.addColumn({type:'string',role:'style'},'Style client > 4G');
     355    data_table.addColumn('number','Total server < 2G');
     356    data_table.addColumn({type:'string',role:'style'},'Style server < 2G');
     357    data_table.addColumn('number','Total server < 4G');
     358    data_table.addColumn({type:'string',role:'style'},'Style server < 4G');
     359    data_table.addColumn('number','Total server > 4G');
     360    data_table.addColumn({type:'string',role:'style'},'Style server > 4G');
     361    data_table.addColumn('number','Total desktop < 2G');
     362    data_table.addColumn({type:'string',role:'style'},'Style desktop < 2G');
     363    data_table.addColumn('number','Total desktop < 4G');
     364    data_table.addColumn({type:'string',role:'style'},'Style desktop < 4G');
     365    data_table.addColumn('number','Total desktop > 4G');
     366    data_table.addColumn({type:'string',role:'style'},'Style desktop > 4G');
     367    data_table.addColumn('number','Total other < 2G');
     368    data_table.addColumn({type:'string',role:'style'},'Style other < 2G');
     369    data_table.addColumn('number','Total other < 4G');
     370    data_table.addColumn({type:'string',role:'style'},'Style other < 4G');
     371    data_table.addColumn('number','Total other > 4G');
     372    data_table.addColumn({type:'string',role:'style'},'Style other > 4G');
     373
     374    date_values=[];
     375    for (i=1;i <= 12;i++){
     376        month=d.getMonth();
     377        year=d.getFullYear();
     378        date_to_add=new Date(year,month)
     379        dates_axis.push(date_to_add);
     380        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'])
     381        d.setMonth(month-1);
     382    }
     383    data_table.addRows(date_values);
     384    var options= {  title: title,
     385                    curveType: 'function',
     386                    isStacked: false,
     387                    hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
     388                    vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'},
     389                    legend:{textStyle:{fontSize: 10}},
     390                    chartArea:{left:'5%',right:'10%'},
     391                    focusTarget: 'category',
     392                    colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink','slateblue','skyblue','blue','teal','darkkhaki','green'],
     393                    lineWidth: 5,
     394                    };
     395    return {data:data_table,options:options}
     396}
     397
    264398function build_data_per_month_ltsp_usage(data,title){
    265399    var total=[];
     
    356490
    357491}
    358 function build_data_per_month_cpu(data,title){
     492function build_data_per_month_releases_cpu(data,title){
    359493    var total=[];
    360494    var sizes=['mono','dualquad','more']
     
    366500            }
    367501            for (var rel in data[sizes[size]][i]){
    368                 total[i][rel+'_'+sizes[size]]+=data[sizes[size]][i][rel];
     502                for (var fla in data[sizes[size]][i][rel]){
     503                    total[i][rel+'_'+sizes[size]]+=data[sizes[size]][i][rel][fla];
     504                }
    369505            }
    370506        }
     
    393529        date_to_add=new Date(year,month)
    394530        dates_axis.push(date_to_add);
    395         date_values.push([date_to_add,total[i-1]['15_mono'],'color:purple',total[i-1]['15_dualquad'],'color:gold',total[i-1]['15_more'],'color:teal',total[i-1]['16_mono'],'color:olive',total[i-1]['16_dualquad'],'color:red',total[i-1]['16_more'],'color:pink'])
    396         d.setMonth(month-1);
    397     }
    398     data_table.addRows(date_values);
    399     var options= {  title: title,
    400                     curveType: 'function',
    401                     isStacked: false,
    402                     hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
    403                     vAxis:{title:'Num hosts',viewWindow : {min:0},format:'#'},
     531        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'])
     532        d.setMonth(month-1);
     533    }
     534    data_table.addRows(date_values);
     535    var options= {  title: title,
     536                    curveType: 'function',
     537                    isStacked: false,
     538                    hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
     539                    vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'},
    404540                    legend:{textStyle:{fontSize: 10}},
    405541                    chartArea:{left:'5%',right:'10%'},
    406542                    focusTarget: 'category',
    407                     colors: ['purple','gold','teal','olive','red','pink'],
     543                    colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink'],
     544                    lineWidth: 5,
     545                    };
     546    return {data:data_table,options:options}
     547}
     548function build_data_per_month_flavours_cpu(data,title){
     549    var total=[];
     550    var sizes=['mono','dualquad','more']
     551    for (var i=0 ; i < 12; i++){
     552        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};
     553        for (var size in sizes){
     554            if (! data[sizes[size]][i]){
     555                continue;
     556            }
     557            for (var rel in data[sizes[size]][i]){
     558                for (var fla in data[sizes[size]][i][rel]){
     559                    total[i][fla+'_'+sizes[size]]+=data[sizes[size]][i][rel][fla];
     560                }
     561            }
     562        }
     563    }
     564    var dates_axis=[];
     565    var d= new Date();
     566    var data_table = new google.visualization.DataTable();
     567    data_table.addColumn({type:'date',role:'domain'},'Date');
     568    data_table.addColumn('number','Total client mono processor');
     569    data_table.addColumn({type:'string',role:'style'},'Style client mono processor');
     570    data_table.addColumn('number','Total client dual or quad processor');
     571    data_table.addColumn({type:'string',role:'style'},'Style client dual or quad processor');
     572    data_table.addColumn('number','Total client more than quad processor');
     573    data_table.addColumn({type:'string',role:'style'},'Style client more than quad processor');
     574    data_table.addColumn('number','Total server mono processor');
     575    data_table.addColumn({type:'string',role:'style'},'Style server mono processor');
     576    data_table.addColumn('number','Total server dual or quad processor');
     577    data_table.addColumn({type:'string',role:'style'},'Style server dual or quad processor');
     578    data_table.addColumn('number','Total server more than quad processor');
     579    data_table.addColumn({type:'string',role:'style'},'Style server more than quad processor');
     580    data_table.addColumn('number','Total desktop mono processor');
     581    data_table.addColumn({type:'string',role:'style'},'Style desktop mono processor');
     582    data_table.addColumn('number','Total desktop dual or quad processor');
     583    data_table.addColumn({type:'string',role:'style'},'Style desktop dual or quad processor');
     584    data_table.addColumn('number','Total desktop more than quad processor');
     585    data_table.addColumn({type:'string',role:'style'},'Style desktop more than quad processor');
     586    data_table.addColumn('number','Total other mono processor');
     587    data_table.addColumn({type:'string',role:'style'},'Style other mono processor');
     588    data_table.addColumn('number','Total other dual or quad processor');
     589    data_table.addColumn({type:'string',role:'style'},'Style other dual or quad processor');
     590    data_table.addColumn('number','Total other more than quad processor');
     591    data_table.addColumn({type:'string',role:'style'},'Style other more than quad processor');
     592
     593    date_values=[];
     594    for (i=1;i <= 12;i++){
     595        month=d.getMonth();
     596        year=d.getFullYear();
     597        date_to_add=new Date(year,month)
     598        dates_axis.push(date_to_add);
     599        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'])
     600        d.setMonth(month-1);
     601    }
     602    data_table.addRows(date_values);
     603    var options= {  title: title,
     604                    curveType: 'function',
     605                    isStacked: false,
     606                    hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
     607                    vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'},
     608                    legend:{textStyle:{fontSize: 10}},
     609                    chartArea:{left:'5%',right:'10%'},
     610                    focusTarget: 'category',
     611                    colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink','slateblue','skyblue','blue','teal','darkkhaki','green'],
    408612                    lineWidth: 5,
    409613                    };
     
    496700                        break;
    497701                    case 'architectures':
    498                         if (! chart_data['architectures']){
    499                             chart_data['architectures']={};
    500                             chart_data['architectures']['title']='Architectures';
     702                        if (! chart_data[type]){
     703                            chart_data[type]={'releases':{},'flavours':{}}
     704                            chart_data[type]['title']='Architectures';
    501705                        }
    502                         if (! chart_data['architectures']['releases'])
    503                             chart_data['architectures']['releases']={}
    504                         chart_data['architectures']['releases']['graph']=build_data_per_month_arch(json[key][type],'Architectures by release per month');
    505                         chart_data['architectures']['releases']['title']='Architectures distribution'
     706                        chart_data[type]['releases']['graph']=build_data_per_month_release_arch(json[key][type],'Architectures by release per month');
     707                        chart_data[type]['releases']['title']='Architectures distribution by release per month'
     708                        chart_data[type]['flavours']['graph']=build_data_per_month_flavour_arch(json[key][type],'Architectures by flavour per month');
     709                        chart_data[type]['flavours']['title']='Architectures distribution by flavour per month'
    506710                        break;
    507711                    case 'mem':
    508                         if (! chart_data['mem']){
    509                             chart_data['mem']={};
    510                             chart_data['mem']['title']='Memory';
     712                        if (! chart_data[type]){
     713                            chart_data[type]={'releases':{},'flavours':{}};
     714                            chart_data[type]['title']='Memory';
    511715                        }
    512                         if (! chart_data['mem']['releases'])
    513                             chart_data['mem']['releases']={}
    514                         chart_data['mem']['releases']['graph']=build_data_per_month_mem(json[key][type],'Memory by release per month');
    515                         chart_data['mem']['releases']['title']='Memory distribution'
     716                        chart_data[type]['releases']['graph']=build_data_per_month_releases_mem(json[key][type],'Memory by release per month');
     717                        chart_data[type]['releases']['title']='Memory distribution by release per month'
     718                        chart_data[type]['flavours']['graph']=build_data_per_month_flavours_mem(json[key][type],'Memory by flavour per month');
     719                        chart_data[type]['flavours']['title']='Memory distribution by flavour per month'
    516720                        break;
    517721                    case 'cpu':
    518722                        if (! chart_data['cpu']){
    519                             chart_data['cpu']={};
     723                            chart_data['cpu']={'releases':{},'flavours':{}};
    520724                            chart_data['cpu']['title']='CpuS';
    521725                        }
    522                         if (! chart_data['cpu']['releases'])
    523                             chart_data['cpu']['releases']={}
    524                         chart_data['cpu']['releases']['graph']=build_data_per_month_cpu(json[key][type],'Number CpuS by release per month');
    525                         chart_data['cpu']['releases']['title']='Number CpuS distribution'
     726                        chart_data['cpu']['releases']['graph']=build_data_per_month_releases_cpu(json[key][type],'Number CpuS by release per month');
     727                        chart_data['cpu']['releases']['title']='Number CpuS distribution by release per month'
     728                        chart_data['cpu']['flavours']['graph']=build_data_per_month_flavours_cpu(json[key][type],'Number CpuS by release per month');
     729                        chart_data['cpu']['flavours']['title']='Number CpuS distribution by flavour per month'
    526730                        break;
    527731                    case 'count_ltsp':
     
    583787        if (! chart_data[chart_type]['title']){
    584788            continue;
     789        }else{
     790            $('#accordion').append('<h3 class="'+chart_type+'">'+chart_data[chart_type]['title']+'</h3><div id="'+chart_type+'"></div>');
    585791        }
    586792        for (var chart_variant in chart_data[chart_type]){
    587793            if (chart_variant == 'title'){
    588                 $('#accordion').append('<h3 class="'+chart_type+'">'+chart_data[chart_type]['title']+'</h3><div id="'+chart_type+'"></div>');
    589794                continue;
    590795            }
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph_min.js

    r7150 r7180  
    1 function drawChart(f,a,b,e){var c=.95*$("#"+b).parent().width();e=10>e?$(window).height()/3*.75:20*e;a={title:a,width:c,height:e,fontSize:10,legend:"none",hAxis:{viewWindow:{min:0}},chartArea:{left:"10%",right:"5%"}};f=new google.visualization.DataView(f);f.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(f,a)}
    2 function get_sizes(f){f=.95*$("#"+f).parent().width();var a=.72*$(window).height()/2;return{width:f,height:a}}
    3 function build_data_per_month_releases(f,a){var b=[];for(i=0;12>i;i++)if(b[i]={15:0,16:0,all:0},f[i]){for(rel in f[i]){if("15"==rel)for(fla in f[i][rel])b[i][rel]+=f[i][rel][fla];if("16"==rel)for(fla in f[i][rel])b[i][rel]+=f[i][rel][fla]}b[i].all=b[i]["15"]+b[i]["16"]}var e=[],c=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Release");d.addColumn("number","Total Release 15");d.addColumn({type:"string",role:"style"},"Style Release 15");d.addColumn("number",
    4 "Total Release 16");d.addColumn({type:"string",role:"style"},"Style Release 16");d.addColumn("number","Total ALL Releases");d.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),e.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);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",
    5 isStacked:!1,hAxis:{title:"Months",ticks:e,format:"MMM"},vAxis:{title:"Num hosts",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(f,a){var b=[];for(i=0;12>i;i++)if(b[i]={server:0,client:0,desktop:0,other:0,all:0},f[i])for(rel in f[i])for(fla in f[i][rel])b[i][fla]+=f[i][rel][fla],b[i].all+=f[i][rel][fla];var e=[],c=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Flavour");d.addColumn("number","Total Server");d.addColumn({type:"string",role:"style"},"Style Server");d.addColumn("number","Total Client");d.addColumn({type:"string",role:"style"},"Style Client");
    7 d.addColumn("number","Total Desktop");d.addColumn({type:"string",role:"style"},"Style Desktop");d.addColumn("number","Total Other");d.addColumn({type:"string",role:"style"},"Style Other");d.addColumn("number","Total ALL Flavours");d.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),e.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);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:e,format:"MMM"},vAxis:{title:"Num hosts",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(f,a){var b=[];for(i=0;12>i;i++)if(b[i]={"15_i386":0,"15_x86_64":0,"16_i386":0,"16_x86_64":0},f[i])for(rel in f[i])for(arch in f[i][rel])b[i][rel+"_"+arch]+=f[i][rel][arch];var e=[],c=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Date");d.addColumn("number","Total 15 x86");d.addColumn({type:"string",role:"style"},"Style 15 x86");d.addColumn("number","Total 15 x86_64");d.addColumn({type:"string",role:"style"},"Style 15 x86_64");
    10 d.addColumn("number","Total 16 x86");d.addColumn({type:"string",role:"style"},"Style 16 x86");d.addColumn("number","Total 16 x86_64");d.addColumn({type:"string",role:"style"},"Style 16 x86_64");date_values=[];for(i=1;12>=i;i++)month=c.getMonth(),year=c.getFullYear(),date_to_add=new Date(year,month),e.push(date_to_add),date_values.push([date_to_add,b[i-1]["15_i386"],"color:purple",b[i-1]["15_x86_64"],"color:gold",b[i-1]["16_i386"],"color:teal",b[i-1]["16_x86_64"],"color:olive"]),c.setMonth(month-1);
    11 d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:e,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","teal","olive"],lineWidth:5}}}
    12 function build_data_per_month_mem(f,a){for(var b=[],e=["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 d in e)if(f[e[d]][c])for(var g in f[e[d]][c])b[c][g+"_"+e[d]]+=f[e[d]][c][g]}e=[];d=new Date;g=new google.visualization.DataTable;g.addColumn({type:"date",role:"domain"},"Date");g.addColumn("number","Total 15 < 2G");g.addColumn({type:"string",role:"style"},"Style 15 < 2G");g.addColumn("number","Total 15 < 4G");g.addColumn({type:"string",role:"style"},
    13 "Style 15 < 4G");g.addColumn("number","Total 15 > 4G");g.addColumn({type:"string",role:"style"},"Style 15 > 4G");g.addColumn("number","Total 16 < 2G");g.addColumn({type:"string",role:"style"},"Style 16 < 2G");g.addColumn("number","Total 16 < 4G");g.addColumn({type:"string",role:"style"},"Style 16 < 4G");g.addColumn("number","Total 16 > 4G");g.addColumn({type:"string",role:"style"},"Style 16 > 4G");date_values=[];for(c=1;12>=c;c++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),
    14 e.push(date_to_add),date_values.push([date_to_add,b[c-1]["15_2G"],"color:purple",b[c-1]["15_4G"],"color:gold",b[c-1]["15_8G"],"color:teal",b[c-1]["16_2G"],"color:olive",b[c-1]["16_4G"],"color:red",b[c-1]["16_8G"],"color:pink"]),d.setMonth(month-1);g.addRows(date_values);return{data:g,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:e,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},
    15 focusTarget:"category",colors:"purple gold teal olive red pink".split(" "),lineWidth:5}}}
    16 function build_data_per_month_ltsp_usage(f,a){for(var b=[],e=0;24>e;e++){var c=Math.floor(e/2);f[e]&&(b[c]||(b[c]={0:0,1:0}),b[c][parseInt(f[e][0])]=parseInt(f[e][1]))}c=[];var d=new Date,g=new google.visualization.DataTable;g.addColumn({type:"date",role:"domain"},"Date");g.addColumn("number","Total normal clients");g.addColumn({type:"string",role:"style"},"Total normal clients style");g.addColumn("number","Total ltsp clients");g.addColumn({type:"string",role:"style"},"Total ltsp clients style");
    17 date_values=[];for(e=1;12>=e;e++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[e-1][0],"color:purple",b[e-1][1],"color:gold"]),d.setMonth(month-1);g.addRows(date_values);return{data:g,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",
     1function drawChart(g,e,b,d){var c=.95*$("#"+b).parent().width();d=10>d?$(window).height()/3*.75:20*d;e={title:e,width:c,height:d,fontSize:10,legend:"none",hAxis:{viewWindow:{min:0}},chartArea:{left:"10%",right:"5%"}};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)}
     2function get_sizes(g){g=.95*$("#"+g).parent().width();var e=.72*$(window).height()/2;return{width:g,height:e}}
     3function 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",
     5isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["blue","red","grey"],lineWidth:5}}}
     6function 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");
     7f.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",
     8b[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 hosts",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","teal","gold","olive","grey"],lineWidth:5}}}
     9function 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"},
     10"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"]),
     11f.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 hosts",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","teal","olive"],lineWidth:5}}}
     12function 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");
     13a.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"},
     14"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,
     15"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 hosts",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(" "),
     16lineWidth:5}}}
     17function 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");
     18a.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(),
     19date_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}},
     20chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink".split(" "),lineWidth:5}}}
     21function 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");
     22a.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");
     23a.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",
     24"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",
     25b[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%"},
     26focusTarget:"category",colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink slateblue skyblue blue teal darkkhaki green".split(" "),lineWidth:5}}}
     27function 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");
     28date_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 hosts",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",
    1829colors:["purple","gold"],lineWidth:5}}}
    19 function build_data_per_month_ltsp_modes(f,a){for(var b=[],e=0;36>e;e++){var c=Math.floor(e/3);f[e]&&(b[c]||(b[c]={thin:0,semi:0,fat:0}),b[c][f[e][0]]=parseInt(f[e][1]))}c=[];var d=new Date,g=new google.visualization.DataTable;g.addColumn({type:"date",role:"domain"},"Date");g.addColumn("number","Total thin clients");g.addColumn({type:"string",role:"style"},"Total thin clients style");g.addColumn("number","Total semi clients");g.addColumn({type:"string",role:"style"},"Total semi clients style");g.addColumn("number",
    20 "Total fat clients");g.addColumn({type:"string",role:"style"},"Total fat clients style");date_values=[];for(e=1;12>=e;e++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[e-1].thin,"color:purple",b[e-1].semi,"color:gold",b[e-1].fat,"color:olive"]),d.setMonth(month-1);g.addRows(date_values);return{data:g,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num hosts",
     30function 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",
     31"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 hosts",
    2132viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","olive"],lineWidth:5}}}
    22 function build_data_per_month_cpu(f,a){for(var b=[],e=["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 d in e)if(f[e[d]][c])for(var g in f[e[d]][c])b[c][g+"_"+e[d]]+=f[e[d]][c][g]}e=[];d=new Date;g=new google.visualization.DataTable;g.addColumn({type:"date",role:"domain"},"Date");g.addColumn("number","Total 15 mono processor");g.addColumn({type:"string",role:"style"},"Style 15 mono processor");g.addColumn("number",
    23 "Total 15 dual or quad processor");g.addColumn({type:"string",role:"style"},"Style 15 dual or quad processor");g.addColumn("number","Total 15 more than quad processor");g.addColumn({type:"string",role:"style"},"Style 15 more than quad processor");g.addColumn("number","Total 16 mono processor");g.addColumn({type:"string",role:"style"},"Style 16 mono processor");g.addColumn("number","Total 16 dual or quad processor");g.addColumn({type:"string",role:"style"},"Style 16 dual or quad processor");g.addColumn("number",
    24 "Total 16 more than quad processor");g.addColumn({type:"string",role:"style"},"Style 16 more than quad processor");date_values=[];for(c=1;12>=c;c++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),e.push(date_to_add),date_values.push([date_to_add,b[c-1]["15_mono"],"color:purple",b[c-1]["15_dualquad"],"color:gold",b[c-1]["15_more"],"color:teal",b[c-1]["16_mono"],"color:olive",b[c-1]["16_dualquad"],"color:red",b[c-1]["16_more"],"color:pink"]),d.setMonth(month-1);g.addRows(date_values);
    25 return{data:g,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:e,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"purple gold teal olive red pink".split(" "),lineWidth:5}}}
    26 function build_data_from_array(f,a){var b=[],e=new Date,c=new google.visualization.DataTable;c.addColumn({type:"date",role:"domain"},"Nhosts");c.addColumn("number",a);date_values=[];for(i=1;12>=i;i++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),b.push(date_to_add),date_values.push([date_to_add,f[i-1]]),e.setMonth(month-1);c.addRows(date_values);return{data:c,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:b,format:"MMM"},vAxis:{title:"Num hosts",
     33function 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");
     34a.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");
     35a.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"]),
     36f.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}}}
     37function 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"},
     38"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"},
     39"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");
     40a.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",
     41"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",
     42b[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",
     43colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink slateblue skyblue blue teal darkkhaki green".split(" "),lineWidth:5}}}
     44function 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",
    2745minValue:0,maxValue:"automatic",viewWindowMode:"pretty",viewWindow:{min:0,max:"auto"},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"10%",right:"10%"},focusTarget:"category",lineWidth:5}}}
    28 function doExtendedChart(){end_load_time=get_time();var f=window.location.search.substr(1);""!=f&&(f="?"+f);var a={};start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');$.getJSON("./GetExtendedStats"+f,function(b){start_graph_time=end_get_time=get_time();var e=null;for(key in b){if("clients"==key)for(type in b[key])switch(type){case "clients_per_month":a[type]={};a[type].title="Machines";a[type].releases={};a[type].releases.graph=build_data_per_month_releases(b[key][type],
    29 "Number machines by release per month");a[type].releases.title="Number machines by release per month";a[type].flavours={};a[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Number machines by flavour per month");a[type].flavours.title="Number machines by flavour per month";break;case "freq_updates_per_month":a[type]={};a[type].title="Updates";a[type].releases={};a[type].releases.graph=build_data_per_month_releases(b[key][type],"Number updates by release per month");a[type].releases.title=
    30 "Number updates by release per month";a[type].flavours={};a[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Number updates by flavour per month");a[type].flavours.title="Number updates by flavour per month";break;case "change_releases":a.changes||(a.changes={},a.changes.title="Changes");a.changes.releases||(a.changes.releases={});a.changes.releases.graph=build_data_from_array(b[key][type],"Change releases per month");a.changes.releases.title="Change releases per month";break;case "change_flavours":a.changes||
    31 (a.changes={},a.changes.title="Changes");a.changes.flavours||(a.changes.flavours={});a.changes.flavours.graph=build_data_from_array(b[key][type],"Change flavours per month");a.changes.flavours.title="Change flavours per month";break;case "architectures":a.architectures||(a.architectures={},a.architectures.title="Architectures");a.architectures.releases||(a.architectures.releases={});a.architectures.releases.graph=build_data_per_month_arch(b[key][type],"Architectures by release per month");a.architectures.releases.title=
    32 "Architectures distribution";break;case "mem":a.mem||(a.mem={},a.mem.title="Memory");a.mem.releases||(a.mem.releases={});a.mem.releases.graph=build_data_per_month_mem(b[key][type],"Memory by release per month");a.mem.releases.title="Memory distribution";break;case "cpu":a.cpu||(a.cpu={},a.cpu.title="CpuS");a.cpu.releases||(a.cpu.releases={});a.cpu.releases.graph=build_data_per_month_cpu(b[key][type],"Number CpuS by release per month");a.cpu.releases.title="Number CpuS distribution";break;case "count_ltsp":case "count_mode":a.ltsp||
    33 (a.ltsp={},a.ltsp.title="LTSP Usage"),"count_ltsp"!=type||a.ltsp.usage||(a.ltsp.usage={},a.ltsp.usage.graph=build_data_per_month_ltsp_usage(b[key][type],"LTSP usage per month"),a.ltsp.usage.title="LTSP Use"),"count_mode"!=type||a.ltsp.modes||(a.ltsp.modes={},a.ltsp.modes.graph=build_data_per_month_ltsp_modes(b[key][type],"LTSP type by type per month"),a.ltsp.modes.title="Clients LTSP Mode")}if("apps"==key)for(type in b.apps)switch(type){case "app":e=b.apps[type];break;case "app_use":b[key][type]&&
    34 (a[type]={},a[type].title="Application usage",a[type].releases={},a[type].releases.graph=build_data_per_month_releases(b[key][type],"Application use by release per month ("+e+")"),a[type].releases.title="Use per month for application "+e,a[type].flavours={},a[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Application use by flavour per month ("+e+")"),a[type].flavours.title="Use per month for application "+e)}key.startsWith("debug")&&("debug_query_time"==key&&(query_time=b[key]),
    35 "debug_keep_alive"==key&&(keep_alive=b[key]))}for(var c in a)if(a[c].title)for(var d in a[c])"title"==d?$("#accordion").append('<h3 class="'+c+'">'+a[c].title+'</h3><div id="'+c+'"></div>'):a[c][d].graph&&($("#"+c).append("<div id="+c+"_"+d+"></div>"),b=get_sizes(c),a[c][d].graph.options.width=b.width,a[c][d].graph.options.height=b.height,(new google.visualization.LineChart(document.getElementById(c+"_"+d))).draw(a[c][d].graph.data,a[c][d].graph.options));$("#loading").remove();$("#accordion").accordion({active:!1,
    36 collapsible:!0});null!=e&&$(".app_use").click();end_graph_time=get_time();print_stats(end_graph_time,query_time)})}
    37 function doChart(f){f=void 0===f?"":f;end_load_time=get_time();var a=new google.visualization.DataTable;a.addColumn("string","App");a.addColumn("number","Count");a=new google.visualization.DataTable;a.addColumn("string","App");a.addColumn("number","Count");a=new google.visualization.DataTable;a.addColumn("string","App");a.addColumn("number","Count");start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');console.log(f);""==f?(url="./GetStats",limit=10):(url="./GetLliurexStats",
    38 limit=1E3);$.getJSON(url,function(a){start_graph_time=end_get_time=get_time();count=0;for(key in a)if(!key.startsWith("debug"))for(key2 in a[key])count++;max_graph=3*count;obj=[];for(distro in a)if(distro.startsWith("debug"))"debug_query_time"==distro&&(query_time=a[distro]),"debug_keep_alive"==distro&&(keep_alive=a[distro]);else for(sabor in a[distro])for(titles=["Top apps este mes","Top apps ultimo mes","Top apps penultimo mes"],divname="chart_"+distro+"_"+sabor,$("#accordion").append("<h3>Distro "+
    39 distro+"("+sabor+")</h3>"),$("#accordion").append('<div class="'+divname+'"></h3>'),i=0;3>i;i++){$("div."+divname).append('<div id="'+divname+i+'"></div>');k=0;var b=new google.visualization.DataTable;b.addColumn("string","App");b.addColumn("number","Count");for($.each(a[distro][sabor][i][0],function(a,d){b.addRow([a,parseInt(d)]);k++});10>k;)b.addRow(["",0]),k++;obj.push(b);titles[i]=titles[i]+" (Total clients: "+a[distro][sabor][i][1].nclients+")";drawChart(obj[obj.length-1],titles[i],divname+i,
     46function 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;for(key in b){if("clients"==key)for(type in b[key])switch(type){case "clients_per_month":e[type]={};e[type].title="Machines";e[type].releases={};e[type].releases.graph=build_data_per_month_releases(b[key][type],
     47"Number machines by release per month");e[type].releases.title="Number machines by release per month";e[type].flavours={};e[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Number machines by flavour per month");e[type].flavours.title="Number machines 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],"Number updates by release per month");e[type].releases.title=
     48"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="Changes");e.changes.releases||(e.changes.releases={});e.changes.releases.graph=build_data_from_array(b[key][type],"Change releases per month");e.changes.releases.title="Change releases per month";break;case "change_flavours":e.changes||
     49(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]={releases:{},flavours:{}},e[type].title="Architectures");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";
     50e[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]={releases:{},flavours:{}},e[type].title="Memory");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],
     51"Memory by flavour per month");e[type].flavours.title="Memory distribution by flavour per month";break;case "cpu":e.cpu||(e.cpu={releases:{},flavours:{}},e.cpu.title="CpuS");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";
     52break;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=
     53b.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")&&
     54("debug_query_time"==key&&(query_time=b[key]),"debug_keep_alive"==key&&(keep_alive=b[key]))}for(var c in e)if(e[c].title){$("#accordion").append('<h3 class="'+c+'">'+e[c].title+'</h3><div id="'+c+'"></div>');for(var f in e[c])"title"!=f&&e[c][f].graph&&($("#"+c).append("<div id="+c+"_"+f+"></div>"),b=get_sizes(c),e[c][f].graph.options.width=b.width,e[c][f].graph.options.height=b.height,(new google.visualization.LineChart(document.getElementById(c+"_"+f))).draw(e[c][f].graph.data,e[c][f].graph.options))}$("#loading").remove();
     55$("#accordion").accordion({active:!1,collapsible:!0});null!=d&&$(".app_use").click();end_graph_time=get_time();print_stats(end_graph_time,query_time)})}
     56function 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",
     57limit=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 "+
     58distro+"("+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,
    4059k)}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}))}
    41 function print_stats(f,a){f=void 0===f?0:f;a=void 0===a?0:a;$("#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-a).toFixed(3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Graph time: '+((f-start_graph_time)/1E3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Query time: '+parseFloat(a).toFixed(3).toString()+
     60function 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()+
    4261" 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.