Changeset 7204
- Timestamp:
- Apr 27, 2018, 1:06:38 PM (3 years ago)
- Location:
- lliurex-analytics-server/trunk/fuentes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
lliurex-analytics-server/trunk/fuentes/debian/changelog
r7180 r7204 1 lliurex-analytics-server (0.2.6.4) xenial; urgency=medium 2 3 * More detailed graphs 4 * Fix precision in queries with host/instances 5 6 -- M.Angel Juan <m.angel.juan@gmail.com> Fri, 27 Apr 2018 13:05:07 +0200 7 1 8 lliurex-analytics-server (0.2.6.3) xenial; urgency=medium 2 9 -
lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/db.php
r7180 r7204 341 341 } 342 342 } 343 function get_extended_data($app){ 344 //$today=date("Y-m-d"); 345 //$min_date=date("Y-m",strtotime($today." -1 year")).'-01'; 346 $this->times=0; 347 // CLIENTS DISTRIBUTION PER RELEASE/FLAVOUR 348 //$sql="select year(date) as year,month(date) as month,Releases_name,Flavours_name,count(*) as num_hosts from (select distinct Client_uid,date,Releases_name,Flavours_name from Client_Versions where date >= '$min_date' )t group by year,month,Releases_name,Flavours_name order by year Desc,month desc,Releases_name asc,num_hosts desc"; 349 $sql="select compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name,Flavours_name,count(Client_uid) as total from (select DISTINCT Client_uid,year(date) as year,month(date) as month,Releases_name,Flavours_name from Client_Versions) q group by year,month,Releases_name,Flavours_name) target on compat.year = target.year and compat.month = target.month and compat.rel = target.Releases_name and compat.fla = target.Flavours_name order by year desc,month desc,rel asc,fla asc"; 350 $cache = new Cache; 351 $cache_key='extended_1'; 352 $data = $cache->get($cache_key); 353 $stime=microtime(true); 354 if ($data != false){ 355 $clients_month=$data; 356 }else{ 357 $result=$this->dbconn->query($sql); 358 if ($result){ 359 $this->times+=microtime(true)-$stime; 360 $clients_month=[]; 361 $tmp=[]; 362 while($row=$result->fetch_array(MYSQLI_ASSOC)){ 363 $date=$row['year'].'_'.$row['month']; 364 $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']); 365 } 366 foreach ($tmp as $date){ 367 $clients_month[]=$date; 368 } 369 $cache->store($clients_month,$cache_key); 370 }else{ 371 $clients_month=$this->dbconn->error; 372 } 373 } 343 function get_extended_data($app){ 344 //$today=date("Y-m-d"); 345 //$min_date=date("Y-m",strtotime($today." -1 year")).'-01'; 346 $this->times=0; 347 // CLIENTS DISTRIBUTION PER RELEASE/FLAVOUR 348 //$sql="select year(date) as year,month(date) as month,Releases_name,Flavours_name,count(*) as num_hosts from (select distinct Client_uid,date,Releases_name,Flavours_name from Client_Versions where date >= '$min_date' )t group by year,month,Releases_name,Flavours_name order by year Desc,month desc,Releases_name asc,num_hosts desc"; 349 $sql="select compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name,Flavours_name,count(Client_uid) as total from (select DISTINCT Client_uid,year(date) as year,month(date) as month,Releases_name,Flavours_name from Client_Versions) q group by year,month,Releases_name,Flavours_name) target on compat.year = target.year and compat.month = target.month and compat.rel = target.Releases_name and compat.fla = target.Flavours_name order by year desc,month desc,rel asc,fla asc"; 350 $cache = new Cache; 351 $cache_key='extended_1'; 352 $data = $cache->get($cache_key); 353 $stime=microtime(true); 354 if ($data != false){ 355 $clients_month=$data; 356 }else{ 357 $result=$this->dbconn->query($sql); 358 if ($result){ 359 $this->times+=microtime(true)-$stime; 360 $clients_month=[]; 361 $tmp=[]; 362 while($row=$result->fetch_array(MYSQLI_ASSOC)){ 363 $date=$row['year'].'_'.$row['month']; 364 $tmp[$date][$row['rel']][$row['fla']]=intval($row['total']); 365 } 366 foreach ($tmp as $date){ 367 $clients_month[]=$date; 368 } 369 $cache->store($clients_month,$cache_key); 370 }else{ 371 $clients_month=$this->dbconn->error; 372 } 373 } 374 $sql="select compat.year,compat.month,ifnull(target.total,0) as total from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat left join (select year,month,count(Client_uid) as total from (select DISTINCT Client_uid,year(date) as year,month(date) as month from Client_Versions) q group by year,month) target on compat.year = target.year and compat.month = target.month order by year desc,month desc "; 375 $cache = new Cache; 376 $cache_key='extended_1b'; 377 $data = $cache->get($cache_key); 378 $stime=microtime(true); 379 if ($data != false){ 380 $machines_month=$data; 381 }else{ 382 $result=$this->dbconn->query($sql); 383 if ($result){ 384 $this->times+=microtime(true)-$stime; 385 $machines_month=[]; 386 $tmp=[0,0,0,0,0,0,0,0,0,0,0,0]; 387 $i=0; 388 while($row=$result->fetch_array(MYSQLI_ASSOC)){ 389 $tmp[$i++]=intval($row['total']); 390 } 391 foreach ($tmp as $date){ 392 $machines_month[]=$date; 393 } 394 $cache->store($machines_month,$cache_key); 395 }else{ 396 $machines_month=$this->dbconn->error; 397 } 398 } 374 399 // architecture 375 400 //$sql="select year(date) as year, month(date) as month, Releases_name, count(arch) as count, arch from Client_Versions group by Releases_name,year,month,arch order by year desc,month desc,Releases_name asc,arch asc;"; … … 400 425 // memory 401 426 //$sql_2G = "select year(date) as year,month(date) as month,Releases_name as rel,count(uuid) as count from Client_Versions where mem < 2048000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel order by year desc,month desc,rel asc"; 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"; 427 //$sql_2G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(uuid) as total from Client_Versions where mem < 2048000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc"; 428 $sql_2G="SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where mem < 2048000 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc"; 403 429 $cache_key='extended_memory_2G'; 404 430 $data = $cache->get($cache_key); … … 425 451 } 426 452 //$sql_4G = "select year(date) as year,month(date) as month,Releases_name as rel,count(uuid) as count from Client_Versions where mem > 2048000 and mem < 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel order by year desc,month desc,rel asc"; 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"; 453 //$sql_4G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(uuid) as total from Client_Versions where mem > 2048000 and mem < 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc"; 454 $sql_4G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where mem > 2048000 and mem < 4096000 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc"; 428 455 $cache_key='extended_memory_4G'; 429 456 $data = $cache->get($cache_key); … … 450 477 } 451 478 //$sql_8G = "select year(date) as year,month(date) as month,Releases_name as rel,count(uuid) as count from Client_Versions where mem > 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel order by year desc,month desc,rel asc"; 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"; 479 //$sql_8G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year(date) as year,month(date) as month,Releases_name as rel,Flavours_name as fla,count(uuid) as total from Client_Versions where mem > 4096000 and date >= DATE_SUB(NOW(),interval 1 year) group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc"; 480 $sql_8G = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where mem > 4096000 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc"; 453 481 $cache_key='extended_memory_8G'; 454 482 $data = $cache->get($cache_key); … … 476 504 // cpu 477 505 //$sql_mono= "select compact.year,compact.month,compact.rel,ifnull(total,0) as total from (select year,month,rel from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu = 1 group by year,month,rel) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel"; 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"; 506 //$sql_mono = "select compact.year,compact.month,compact.rel,compact.fla,ifnull(total,0) as total from (select year,month,rel,fla from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other')flavours) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, Flavours_name as fla,count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu = 1 group by year,month,rel,fla) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel and compact.fla = ct.fla order by year desc,month desc,rel asc,fla asc"; 507 $sql_mono = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where ncpu < 2 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc"; 479 508 $cache_key='extended_memory_cpu_mono'; 480 509 $data = $cache->get($cache_key); … … 501 530 } 502 531 //$sql_dualquad = "select compact.year,compact.month,compact.rel,ifnull(total,0) as total from (select year,month,rel from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu > 1 and ncpu < 5 group by year,month,rel) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel"; 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"; 532 //$sql_dualquad = "select compact.year,compact.month,compact.rel,compact.fla,ifnull(total,0) as total from (select year,month,rel,fla from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other')flavours) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, Flavours_name as fla,count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu > 1 and ncpu < 5 group by year,month,rel,fla) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel and compact.fla = ct.fla order by year desc,month desc,rel asc,fla asc"; 533 $sql_dualquad = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where ncpu > 1 and ncpu < 5 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc"; 504 534 $cache_key='extended_memory_cpu_dualquad'; 505 535 $data = $cache->get($cache_key); … … 526 556 } 527 557 //$sql_more = "select compact.year,compact.month,compact.rel,ifnull(total,0) as total from (select year,month,rel from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu > 4 group by year,month,rel) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel"; 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"; 558 //$sql_more = "select compact.year,compact.month,compact.rel,compact.fla,ifnull(total,0) as total from (select year,month,rel,fla from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year))) anyos inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12) months where STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and now() >= STR_TO_DATE(concat(year,'-',month,'-01'),'%Y-%m-%d') order by year desc, month desc) dates inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other')flavours) compact left join (select year(date) as year, month(date) as month, Releases_name as rel, Flavours_name as fla,count(uuid) as total from Client_Versions where date >= date_sub(now(),interval 1 year) and ncpu > 4 group by year,month,rel,fla) ct on compact.year = ct.year and compact.month = ct.month and compact.rel = ct.rel and compact.fla = ct.fla order by year desc,month desc,rel asc,fla asc"; 559 $sql_more = "SELECT compat.year,compat.month,compat.rel,compat.fla,ifnull(target.total,0) as total from (select year,month,rel,fla from (select year,month from (select year,month from (select year(now()) as year union all select year(date_sub(now(),interval 1 year)))years inner join (select 1 as month union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12)months)dates where str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= date_sub(now(),interval 1 year) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') < now()) compat inner join (select '15' as rel union all select '16') releases inner join (select 'client' as fla union all select 'server' union all select 'desktop' union all select 'other') flavours) compat left join (select year,month,Releases_name as rel,Flavours_name as fla,count(Client_uid) as total from (select DISTINCT Client_uid, Releases_name,Flavours_name,year(date) as year,month(date) as month from Client_Versions where ncpu > 4 and date >= DATE_SUB(NOW(),interval 1 year))clients group by year,month,rel,fla order by year desc,month desc,rel asc,fla asc ) target on compat.year = target.year and compat.month = target.month and compat.rel = target.rel and compat.fla = target.fla order by year desc,month desc,rel asc,fla asc"; 529 560 $cache_key='extended_memory_cpu_other'; 530 561 $data = $cache->get($cache_key); … … 629 660 630 661 631 $sql="select compact.year as year,compact.month as month,if(compact.type='NONE',null,compact.type) as type,ifnull(results.total,0) as total from (select * from 632 ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as type union all select 0 union all select 1) types) compact left join (select month(date) as month,year(date) as year,ifnull(ltsp,'NONE') as type,count(ifnull(ltsp,1)) as total from Client_Versions where Flavours_name = 'client' group by year(date),month(date),ltsp order by year(date) desc ,month(date) desc, ltsp desc ) results on compact.month = results.month and compact.year = results.year and compact.type = results.type"; 662 //$sql="select compact.year as year,compact.month as month,if(compact.type='NONE',null,compact.type) as type,ifnull(results.total,0) as total from (select * from ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as type union all select 0 union all select 1) types) compact left join (select month(date) as month,year(date) as year,ifnull(ltsp,'NONE') as type,count(ifnull(ltsp,1)) as total from Client_Versions where Flavours_name = 'client' group by year(date),month(date),ltsp order by year(date) desc ,month(date) desc, ltsp desc ) results on compact.month = results.month and compact.year = results.year and compact.type = results.type"; 663 $sql = "select compact.year as year,compact.month as month,if(compact.type='NONE',null,compact.type) as type,ifnull(results.total,0) as total from (select * from 664 ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as type union all select 0 union all select 1) types) compact left join (select month,year,ifnull(ltsp,'NONE') as type,count(ifnull(ltsp,1)) as total from (select DISTINCT Client_uid,year(date) as year, month(date) as month,ltsp from Client_Versions where Flavours_name = 'client')clients group by year,month,ltsp order by year desc ,month desc, ltsp desc ) results on compact.month = results.month and compact.year = results.year and compact.type = results.type"; 633 665 $count_ltsp=array(); 634 666 $cache_key='extended_5'; … … 652 684 } 653 685 $cache_key='extended_6'; 654 $sql= "select compact.year as year,compact.month as month,if(compact.mode='NONE',null,compact.mode) as mode,ifnull(results.total,0) as total from (select * from ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as mode union all select 'THIN' union all select 'SEMI' union all select 'FAT') types) compact left join (select month(date) as month,year(date) as year,ifnull(mode,'NONE') as mode,count(ifnull(mode,1)) as total from Client_Versions where Flavours_name = 'client' group by year(date),month(date),mode order by year(date) desc ,month(date) desc, mode desc ) results on compact.month = results.month and compact.year = results.year and compact.mode = results.mode"; 686 //$sql= "select compact.year as year,compact.month as month,if(compact.mode='NONE',null,compact.mode) as mode,ifnull(results.total,0) as total from (select * from ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as mode union all select 'THIN' union all select 'SEMI' union all select 'FAT') types) compact left join (select month(date) as month,year(date) as year,ifnull(mode,'NONE') as mode,count(ifnull(mode,1)) as total from Client_Versions where Flavours_name = 'client' group by year(date),month(date),mode order by year(date) desc ,month(date) desc, mode desc ) results on compact.month = results.month and compact.year = results.year and compact.mode = results.mode"; 687 $sql="select compact.year as year,compact.month as month,if(compact.mode='NONE',null,compact.mode) as mode,ifnull(results.total,0) as total from (select * from ( SELECT * FROM ( SELECT * FROM ( SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 ) t INNER JOIN ( SELECT YEAR(NOW()) AS year UNION ALL SELECT YEAR( DATE_SUB(NOW(), INTERVAL 1 YEAR)) ) t2 ) dates WHERE str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') >= DATE_SUB(NOW(),INTERVAL 1 YEAR) and str_to_date(concat(year,'-',month,'-01'),'%Y-%m-%d') <= now() GROUP BY YEAR, MONTH ORDER BY YEAR DESC, MONTH DESC ) last_times inner join (select 'NONE' as mode union all select 'THIN' union all select 'SEMI' union all select 'FAT') types) compact left join (select month,year,ifnull(mode,'NONE') as mode,count(ifnull(mode,1)) as total from (select DISTINCT Client_uid, year(date) as year,month(date) as month,mode from Client_Versions where Flavours_name = 'client') clients group by year,month,mode order by year desc ,month desc, mode desc ) results on compact.month = results.month and compact.year = results.year and compact.mode = results.mode"; 655 688 $data= $cache->get($cache_key); 656 689 $stime=microtime(true); … … 712 745 $stats['clients']['clients_per_month']=$clients_month; 713 746 } 747 if (isset($machines_month)){ 748 $stats['clients']['machines_per_month']=$machines_month; 749 } 714 750 if (isset($num_updates_month)){ 715 751 $stats['clients']['freq_updates_per_month']=$num_updates_month; -
lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph.js
r7180 r7204 96 96 isStacked: false, 97 97 hAxis:{title:'Months',ticks:dates_axis,format:'MMM'}, 98 vAxis:{title:'Num hosts',viewWindow : {min:0},format:'#'},98 vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'}, 99 99 legend:{textStyle:{fontSize: 10}}, 100 100 chartArea:{left:'5%',right:'10%'}, … … 147 147 isStacked: false, 148 148 hAxis:{title:'Months',ticks:dates_axis,format:'MMM'}, 149 vAxis:{title:'Num hosts',viewWindow : {min:0},format:'#'},149 vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'}, 150 150 legend:{textStyle:{fontSize: 10}}, 151 151 chartArea:{left:'5%',right:'10%'}, 152 152 focusTarget: 'category', 153 153 colors: ['purple','teal','gold','olive','grey'], 154 lineWidth: 5, 155 }; 156 return {data:data_table,options:options} 157 } 158 function build_data_per_month_arch(data,title){ 159 var total=[]; 160 for (var i=0 ; i < 12; i++){ 161 total[i]={'i386':0,'x86_64':0}; 162 if (! data[i]){ 163 continue; 164 } 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][arch]+=data[i][rel][fla][arch]; 169 } 170 } 171 } 172 173 } 174 var dates_axis=[]; 175 var d= new Date(); 176 var data_table = new google.visualization.DataTable(); 177 data_table.addColumn({type:'date',role:'domain'},'Date'); 178 data_table.addColumn('number','Total x86'); 179 data_table.addColumn({type:'string',role:'style'},'Style x86'); 180 data_table.addColumn('number','Total x86_64'); 181 data_table.addColumn({type:'string',role:'style'},'Style x86_64'); 182 183 date_values=[]; 184 for (i=1;i <= 12;i++){ 185 month=d.getMonth(); 186 year=d.getFullYear(); 187 date_to_add=new Date(year,month) 188 dates_axis.push(date_to_add); 189 date_values.push([date_to_add,total[i-1]['i386'],'color:purple',total[i-1]['x86_64'],'color:gold']) 190 d.setMonth(month-1); 191 } 192 data_table.addRows(date_values); 193 var options= { title: title, 194 curveType: 'function', 195 isStacked: false, 196 hAxis:{title:'Months',ticks:dates_axis,format:'MMM'}, 197 vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'}, 198 legend:{textStyle:{fontSize: 10}}, 199 chartArea:{left:'5%',right:'10%'}, 200 focusTarget: 'category', 201 colors: ['purple','gold'], 154 202 lineWidth: 5, 155 203 }; … … 200 248 isStacked: false, 201 249 hAxis:{title:'Months',ticks:dates_axis,format:'MMM'}, 202 vAxis:{title:'Num hosts',viewWindow : {min:0},format:'#'},250 vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'}, 203 251 legend:{textStyle:{fontSize: 10}}, 204 252 chartArea:{left:'5%',right:'10%'}, … … 262 310 isStacked: false, 263 311 hAxis:{title:'Months',ticks:dates_axis,format:'MMM'}, 264 vAxis:{title:'Num hosts',viewWindow : {min:0},format:'#'},312 vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'}, 265 313 legend:{textStyle:{fontSize: 10}}, 266 314 chartArea:{left:'5%',right:'10%'}, … … 323 371 focusTarget: 'category', 324 372 colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink'], 373 lineWidth: 5, 374 }; 375 return {data:data_table,options:options} 376 } 377 function build_data_per_month_mem(data,title){ 378 var total=[]; 379 var sizes=['2G','4G','8G'] 380 for (var i=0 ; i < 12; i++){ 381 total[i]={'2G':0,'4G':0,'8G':0}; 382 for (var size in sizes){ 383 if (! data[sizes[size]][i]){ 384 continue; 385 } 386 for (var rel in data[sizes[size]][i]){ 387 for (var fla in data[sizes[size]][i][rel]){ 388 total[i][sizes[size]]+=data[sizes[size]][i][rel][fla]; 389 } 390 } 391 } 392 } 393 var dates_axis=[]; 394 var d= new Date(); 395 var data_table = new google.visualization.DataTable(); 396 data_table.addColumn({type:'date',role:'domain'},'Date'); 397 data_table.addColumn('number','Total < 2G'); 398 data_table.addColumn({type:'string',role:'style'},'Style < 2G'); 399 data_table.addColumn('number','Total < 4G'); 400 data_table.addColumn({type:'string',role:'style'},'Style < 4G'); 401 data_table.addColumn('number','Total > 4G'); 402 data_table.addColumn({type:'string',role:'style'},'Style > 4G'); 403 404 date_values=[]; 405 for (i=1;i <= 12;i++){ 406 month=d.getMonth(); 407 year=d.getFullYear(); 408 date_to_add=new Date(year,month) 409 dates_axis.push(date_to_add); 410 date_values.push([date_to_add,total[i-1]['2G'],'color:gold',total[i-1]['4G'],'color:red',total[i-1]['8G'],'color:blue']) 411 d.setMonth(month-1); 412 } 413 data_table.addRows(date_values); 414 var options= { title: title, 415 curveType: 'function', 416 isStacked: false, 417 hAxis:{title:'Months',ticks:dates_axis,format:'MMM'}, 418 vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'}, 419 legend:{textStyle:{fontSize: 10}}, 420 chartArea:{left:'5%',right:'10%'}, 421 focusTarget: 'category', 422 colors: ['gold','red','blue'], 325 423 lineWidth: 5, 326 424 }; … … 432 530 isStacked: false, 433 531 hAxis:{title:'Months',ticks:dates_axis,format:'MMM'}, 434 vAxis:{title:'Num hosts',viewWindow : {min:0},format:'#'},532 vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'}, 435 533 legend:{textStyle:{fontSize: 10}}, 436 534 chartArea:{left:'5%',right:'10%'}, … … 480 578 isStacked: false, 481 579 hAxis:{title:'Months',ticks:dates_axis,format:'MMM'}, 482 vAxis:{title:'Num hosts',viewWindow : {min:0},format: '#'},580 vAxis:{title:'Num instances',viewWindow : {min:0},format: '#'}, 483 581 legend:{textStyle:{fontSize: 10}}, 484 582 chartArea:{left:'5%',right:'10%'}, … … 542 640 focusTarget: 'category', 543 641 colors: ['darkgoldenrod','goldenrod','gold','darkviolet','deeppink','pink'], 642 lineWidth: 5, 643 }; 644 return {data:data_table,options:options} 645 } 646 function build_data_per_month_cpu(data,title){ 647 var total=[]; 648 var sizes=['mono','dualquad','more'] 649 for (var i=0 ; i < 12; i++){ 650 total[i]={'mono':0,'dualquad':0,'more':0}; 651 for (var size in sizes){ 652 if (! data[sizes[size]][i]){ 653 continue; 654 } 655 for (var rel in data[sizes[size]][i]){ 656 for (var fla in data[sizes[size]][i][rel]){ 657 total[i][sizes[size]]+=data[sizes[size]][i][rel][fla]; 658 } 659 } 660 } 661 } 662 var dates_axis=[]; 663 var d= new Date(); 664 var data_table = new google.visualization.DataTable(); 665 data_table.addColumn({type:'date',role:'domain'},'Date'); 666 data_table.addColumn('number','Total mono processor'); 667 data_table.addColumn({type:'string',role:'style'},'Style mono processor'); 668 data_table.addColumn('number','Total dual or quad processor'); 669 data_table.addColumn({type:'string',role:'style'},'Style dual or quad processor'); 670 data_table.addColumn('number','Total more than quad processor'); 671 data_table.addColumn({type:'string',role:'style'},'Style more than quad processor'); 672 673 date_values=[]; 674 for (i=1;i <= 12;i++){ 675 month=d.getMonth(); 676 year=d.getFullYear(); 677 date_to_add=new Date(year,month) 678 dates_axis.push(date_to_add); 679 date_values.push([date_to_add,total[i-1]['mono'],'color:gold',total[i-1]['dualquad'],'color:red',total[i-1]['more'],'color:blue']) 680 d.setMonth(month-1); 681 } 682 data_table.addRows(date_values); 683 var options= { title: title, 684 curveType: 'function', 685 isStacked: false, 686 hAxis:{title:'Months',ticks:dates_axis,format:'MMM'}, 687 vAxis:{title:'Num instances',viewWindow : {min:0},format:'#'}, 688 legend:{textStyle:{fontSize: 10}}, 689 chartArea:{left:'5%',right:'10%'}, 690 focusTarget: 'category', 691 colors: ['gold','red','blue'], 544 692 lineWidth: 5, 545 693 }; … … 636 784 vAxis:{title:'Num hosts',minValue: 0,maxValue:'automatic',viewWindowMode:'pretty',viewWindow:{min:0,max:'auto'},format:'#'}, 637 785 legend:{textStyle:{fontSize: 10}}, 638 chartArea:{left:' 10%',right:'10%'},786 chartArea:{left:'5%',right:'10%'}, 639 787 focusTarget: 'category', 640 788 lineWidth: 5, … … 655 803 start_graph_time=end_get_time; 656 804 var app=null; 805 var order = {'machines_per_month':{},'clients_per_month':{},'freq_updates_per_month':{},'change_releases':{},'change_flavours':{},'count_ltsp':{},'count_mode':{},'architectures':{},'mem':{},'cpu':{}} 657 806 for (key in json){ 658 807 if (key == 'clients'){ 659 for (type in json[key]){ 808 for (type in order){ 809 if (! json[key][type]){ 810 continue; 811 } 660 812 switch(type){ 813 case 'machines_per_month': 814 if (! chart_data['clients_per_month']){ 815 chart_data['clients_per_month']={}; 816 } 817 if (! chart_data['clients_per_month']['hosts']){ 818 chart_data['clients_per_month']['hosts']={}; 819 } 820 chart_data['clients_per_month']['title']='Machines'; 821 chart_data['clients_per_month']['hosts']['graph']=build_data_from_array(json[key][type],'Number of unique machines used') 822 chart_data['clients_per_month']['hosts']['title']='Number of unique machines used'; 823 break; 661 824 case 'clients_per_month': 662 chart_data[type]={}; 825 if (! chart_data['clients_per_month']){ 826 chart_data['clients_per_month']={}; 827 } 828 if (! chart_data['clients_per_month']['releases']){ 829 chart_data['clients_per_month']['releases']={}; 830 } 831 if (! chart_data['clients_per_month']['flavours']){ 832 chart_data['clients_per_month']['flavours']={}; 833 } 663 834 chart_data[type]['title']='Machines'; 664 chart_data[type]['releases']={}; 665 chart_data[type]['releases']['graph']=build_data_per_month_releases(json[key][type],'Number machines by release per month') 666 chart_data[type]['releases']['title']='Number machines by release per month'; 667 chart_data[type]['flavours']={}; 668 chart_data[type]['flavours']['graph']=build_data_per_month_flavours(json[key][type],'Number machines by flavour per month') 669 chart_data[type]['flavours']['title']='Number machines by flavour per month'; 835 chart_data[type]['releases']['graph']=build_data_per_month_releases(json[key][type],'Number instances by release per month') 836 chart_data[type]['releases']['title']='Number instances by release per month'; 837 chart_data[type]['flavours']['graph']=build_data_per_month_flavours(json[key][type],'Number instances by flavour per month') 838 chart_data[type]['flavours']['title']='Number instances by flavour per month'; 670 839 break; 671 840 case 'freq_updates_per_month': … … 682 851 if (! chart_data['changes']){ 683 852 chart_data['changes']={}; 684 chart_data['changes']['title']=' Changes';853 chart_data['changes']['title']='Upgrades'; 685 854 } 686 855 if (! chart_data['changes']['releases']) … … 701 870 case 'architectures': 702 871 if (! chart_data[type]){ 703 chart_data[type]={' releases':{},'flavours':{}}872 chart_data[type]={'global':{},'releases':{},'flavours':{}} 704 873 chart_data[type]['title']='Architectures'; 705 874 } 875 chart_data[type]['global']['graph']=build_data_per_month_arch(json[key][type],'Architectures per month'); 876 chart_data[type]['global']['title']='Architectures distribution per month' 706 877 chart_data[type]['releases']['graph']=build_data_per_month_release_arch(json[key][type],'Architectures by release per month'); 707 878 chart_data[type]['releases']['title']='Architectures distribution by release per month' … … 711 882 case 'mem': 712 883 if (! chart_data[type]){ 713 chart_data[type]={' releases':{},'flavours':{}};884 chart_data[type]={'global':{},'releases':{},'flavours':{}}; 714 885 chart_data[type]['title']='Memory'; 715 886 } 887 chart_data[type]['global']['graph']=build_data_per_month_mem(json[key][type],'Memory per month'); 888 chart_data[type]['global']['title']='Memory distribution per month' 716 889 chart_data[type]['releases']['graph']=build_data_per_month_releases_mem(json[key][type],'Memory by release per month'); 717 890 chart_data[type]['releases']['title']='Memory distribution by release per month' … … 721 894 case 'cpu': 722 895 if (! chart_data['cpu']){ 723 chart_data['cpu']={' releases':{},'flavours':{}};896 chart_data['cpu']={'global':{},'releases':{},'flavours':{}}; 724 897 chart_data['cpu']['title']='CpuS'; 725 898 } 899 chart_data['cpu']['global']['graph']=build_data_per_month_cpu(json[key][type],'Number CpuS per month'); 900 chart_data['cpu']['global']['title']='Number CpuS distribution per month' 726 901 chart_data['cpu']['releases']['graph']=build_data_per_month_releases_cpu(json[key][type],'Number CpuS by release per month'); 727 902 chart_data['cpu']['releases']['title']='Number CpuS distribution by release per month' -
lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph_min.js
r7180 r7204 1 function 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)}1 function drawChart(g,e,b,c){var d=.95*$("#"+b).parent().width();c=10>c?$(window).height()/3*.75:20*c;e={title:e,width:d,height:c,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)} 2 2 function get_sizes(g){g=.95*$("#"+g).parent().width();var e=.72*$(window).height()/2;return{width:g,height:e}} 3 function build_data_per_month_releases(g,e){var b=[];for(i=0;12>i;i++)if(b[i]={15:0,16:0,all:0},g[i]){for(rel in g[i]){if("15"==rel)for(fla in g[i][rel])b[i][rel]+=g[i][rel][fla];if("16"==rel)for(fla in g[i][rel])b[i][rel]+=g[i][rel][fla]}b[i].all=b[i]["15"]+b[i]["16"]}var d=[],c=new Date,f=new google.visualization.DataTable;f.addColumn({type:"date",role:"domain"},"Release");f.addColumn("number","Total Release 15");f.addColumn({type:"string",role:"style"},"Style Release 15");f.addColumn("number", 4 "Total Release 16");f.addColumn({type:"string",role:"style"},"Style Release 16");f.addColumn("number","Total ALL Releases");f.addColumn({type:"string",role:"style"},"Style ALL Releases");date_values=[];for(i=1;12>=i;i++)month=c.getMonth(),year=c.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[i-1]["15"],"color:blue",b[i-1]["16"],"color:red",b[i-1].all,"color:grey"]),c.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:e,curveType:"function", 5 isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num 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(g,e){var b=[];for(i=0;12>i;i++)if(b[i]={server:0,client:0,desktop:0,other:0,all:0},g[i])for(rel in g[i])for(fla in g[i][rel])b[i][fla]+=g[i][rel][fla],b[i].all+=g[i][rel][fla];var d=[],c=new Date,f=new google.visualization.DataTable;f.addColumn({type:"date",role:"domain"},"Flavour");f.addColumn("number","Total Server");f.addColumn({type:"string",role:"style"},"Style Server");f.addColumn("number","Total Client");f.addColumn({type:"string",role:"style"},"Style Client"); 7 f.addColumn("number","Total Desktop");f.addColumn({type:"string",role:"style"},"Style Desktop");f.addColumn("number","Total Other");f.addColumn({type:"string",role:"style"},"Style Other");f.addColumn("number","Total ALL Flavours");f.addColumn({type:"string",role:"style"},"Style Total ALL Flavours");date_values=[];for(i=1;12>=i;i++)month=c.getMonth(),year=c.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[i-1].server,"color:purple",b[i-1].client,"color:teal", 8 b[i-1].desktop,"color:gold",b[i-1].other,"color:olive",b[i-1].all,"color:grey"]),c.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num 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_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"]), 11 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:["purple","gold","teal","olive"],lineWidth:5}}} 12 function build_data_per_month_flavour_arch(g,e){for(var b=[],d=0;12>d;d++)if(b[d]={client_i386:0,client_x86_64:0,server_i386:0,server_x86_64:0,desktop_i386:0,desktop_x86_64:0,other_i386:0,other_x86_64:0},g[d])for(var c in g[d])for(var f in g[d][c])for(var a in g[d][c][f])b[d][f+"_"+a]+=g[d][c][f][a];c=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total client x86");a.addColumn({type:"string",role:"style"},"Style client x86"); 3 function build_data_per_month_releases(g,e){var b=[];for(i=0;12>i;i++)if(b[i]={15:0,16:0,all:0},g[i]){for(rel in g[i]){if("15"==rel)for(fla in g[i][rel])b[i][rel]+=g[i][rel][fla];if("16"==rel)for(fla in g[i][rel])b[i][rel]+=g[i][rel][fla]}b[i].all=b[i]["15"]+b[i]["16"]}var c=[],d=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=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),c.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"]),d.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:e,curveType:"function", 5 isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["blue","red","grey"],lineWidth:5}}} 6 function build_data_per_month_flavours(g,e){var b=[];for(i=0;12>i;i++)if(b[i]={server:0,client:0,desktop:0,other:0,all:0},g[i])for(rel in g[i])for(fla in g[i][rel])b[i][fla]+=g[i][rel][fla],b[i].all+=g[i][rel][fla];var c=[],d=new Date,f=new google.visualization.DataTable;f.addColumn({type:"date",role:"domain"},"Flavour");f.addColumn("number","Total Server");f.addColumn({type:"string",role:"style"},"Style Server");f.addColumn("number","Total Client");f.addColumn({type:"string",role:"style"},"Style Client"); 7 f.addColumn("number","Total Desktop");f.addColumn({type:"string",role:"style"},"Style Desktop");f.addColumn("number","Total Other");f.addColumn({type:"string",role:"style"},"Style Other");f.addColumn("number","Total ALL Flavours");f.addColumn({type:"string",role:"style"},"Style Total ALL Flavours");date_values=[];for(i=1;12>=i;i++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),c.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"]),d.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","teal","gold","olive","grey"],lineWidth:5}}} 9 function build_data_per_month_arch(g,e){for(var b=[],c=0;12>c;c++)if(b[c]={i386:0,x86_64:0},g[c])for(var d in g[c])for(var f in g[c][d])for(var a in g[c][d][f])b[c][a]+=g[c][d][f][a];d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total x86");a.addColumn({type:"string",role:"style"},"Style x86");a.addColumn("number","Total x86_64");a.addColumn({type:"string",role:"style"},"Style x86_64");date_values=[];for(c=1;12>=c;c++)month= 10 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].i386,"color:purple",b[c-1].x86_64,"color:gold"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold"],lineWidth:5}}} 11 function build_data_per_month_release_arch(g,e){for(var b=[],c=0;12>c;c++)if(b[c]={"15_i386":0,"15_x86_64":0,"16_i386":0,"16_x86_64":0},g[c])for(var d in g[c])for(var f in g[c][d])for(var a in g[c][d][f])b[c][d+"_"+a]+=g[c][d][f][a];d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 x86");a.addColumn({type:"string",role:"style"},"Style 15 x86");a.addColumn("number","Total 15 x86_64");a.addColumn({type:"string",role:"style"}, 12 "Style 15 x86_64");a.addColumn("number","Total 16 x86");a.addColumn({type:"string",role:"style"},"Style 16 x86");a.addColumn("number","Total 16 x86_64");a.addColumn({type:"string",role:"style"},"Style 16 x86_64");date_values=[];for(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_i386"],"color:purple",b[c-1]["15_x86_64"],"color:gold",b[c-1]["16_i386"],"color:teal",b[c-1]["16_x86_64"],"color:olive"]), 13 f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","teal","olive"],lineWidth:5}}} 14 function build_data_per_month_flavour_arch(g,e){for(var b=[],c=0;12>c;c++)if(b[c]={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[c])for(var d in g[c])for(var f in g[c][d])for(var a in g[c][d][f])b[c][f+"_"+a]+=g[c][d][f][a];d=[];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"); 13 15 a.addColumn("number","Total client x86_64");a.addColumn({type:"string",role:"style"},"Style client x86_64");a.addColumn("number","Total server x86");a.addColumn({type:"string",role:"style"},"Style server x86");a.addColumn("number","Total server x86_64");a.addColumn({type:"string",role:"style"},"Style server x86_64");a.addColumn("number","Total desktop x86");a.addColumn({type:"string",role:"style"},"Style desktop x86");a.addColumn("number","Total desktop x86_64");a.addColumn({type:"string",role:"style"}, 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(" "),16 "Style desktop x86_64");a.addColumn("number","Total other x86");a.addColumn({type:"string",role:"style"},"Style other x86");a.addColumn("number","Total other x86_64");a.addColumn({type:"string",role:"style"},"Style other x86_64");date_values=[];for(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_i386,"color:goldenrod",b[c-1].client_x86_64,"color:gold",b[c-1].server_i386,"color:darkviolet",b[c-1].server_x86_64, 17 "color:deeppink",b[c-1].desktop_i386,"color:slateblue",b[c-1].desktop_x86_64,"color:skyblue",b[c-1].other_i386,"color:plum",b[c-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:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"goldenrod gold darkviolet deeppink slateblue skyblue plum pink".split(" "), 16 18 lineWidth:5}}} 17 function build_data_per_month_releases_mem(g,e){for(var b=[], d=["2G","4G","8G"],c=0;12>c;c++){b[c]={"15_2G":0,"15_4G":0,"15_8G":0,"16_2G":0,"16_4G":0,"16_8G":0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][a+"_"+d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 < 2G");a.addColumn({type:"string",role:"style"},"Style 15 < 2G");a.addColumn("number","Total 15 < 4G");18 a.addColumn({type:"string",role:"style"},"Style 15 < 4G");a.addColumn("number","Total 15 > 4G");a.addColumn({type:"string",role:"style"},"Style 15 > 4G");a.addColumn("number","Total 16 < 2G");a.addColumn({type:"string",role:"style"},"Style 16 < 2G");a.addColumn("number","Total 16 < 4G");a.addColumn({type:"string",role:"style"},"Style 16 < 4G");a.addColumn("number","Total 16 > 4G");a.addColumn({type:"string",role:"style"},"Style 16 > 4G");date_values=[];for( c=1;12>=c;c++)month=f.getMonth(),year=f.getFullYear(),19 date_to_add=new Date(year,month), d.push(date_to_add),date_values.push([date_to_add,b[c-1]["15_2G"],"color:darkgoldenrod",b[c-1]["15_4G"],"color:goldenrod",b[c-1]["15_8G"],"color:gold",b[c-1]["16_2G"],"color:darkviolet",b[c-1]["16_4G"],"color:deeppink",b[c-1]["16_8G"],"color:pink"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},19 function build_data_per_month_releases_mem(g,e){for(var b=[],c=["2G","4G","8G"],d=0;12>d;d++){b[d]={"15_2G":0,"15_4G":0,"15_8G":0,"16_2G":0,"16_4G":0,"16_8G":0};for(var f in c)if(g[c[f]][d])for(var a in g[c[f]][d])for(var h in g[c[f]][d][a])b[d][a+"_"+c[f]]+=g[c[f]][d][a][h]}c=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 < 2G");a.addColumn({type:"string",role:"style"},"Style 15 < 2G");a.addColumn("number","Total 15 < 4G"); 20 a.addColumn({type:"string",role:"style"},"Style 15 < 4G");a.addColumn("number","Total 15 > 4G");a.addColumn({type:"string",role:"style"},"Style 15 > 4G");a.addColumn("number","Total 16 < 2G");a.addColumn({type:"string",role:"style"},"Style 16 < 2G");a.addColumn("number","Total 16 < 4G");a.addColumn({type:"string",role:"style"},"Style 16 < 4G");a.addColumn("number","Total 16 > 4G");a.addColumn({type:"string",role:"style"},"Style 16 > 4G");date_values=[];for(d=1;12>=d;d++)month=f.getMonth(),year=f.getFullYear(), 21 date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1]["15_2G"],"color:darkgoldenrod",b[d-1]["15_4G"],"color:goldenrod",b[d-1]["15_8G"],"color:gold",b[d-1]["16_2G"],"color:darkviolet",b[d-1]["16_4G"],"color:deeppink",b[d-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:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}}, 20 22 chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink".split(" "),lineWidth:5}}} 21 function build_data_per_month_flavours_mem(g,e){for(var b=[],d=["2G","4G","8G"],c=0;12>c;c++){b[c]={client_2G:0,client_4G:0,client_8G:0,server_2G:0,server_4G:0,server_8G:0,desktop_2G:0,desktop_4G:0,desktop_8G:0,other_2G:0,other_4G:0,other_8G:0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][h+"_"+d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total client < 2G"); 23 function build_data_per_month_mem(g,e){for(var b=[],c=["2G","4G","8G"],d=0;12>d;d++){b[d]={"2G":0,"4G":0,"8G":0};for(var f in c)if(g[c[f]][d])for(var a in g[c[f]][d])for(var h in g[c[f]][d][a])b[d][c[f]]+=g[c[f]][d][a][h]}c=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total < 2G");a.addColumn({type:"string",role:"style"},"Style < 2G");a.addColumn("number","Total < 4G");a.addColumn({type:"string",role:"style"},"Style < 4G"); 24 a.addColumn("number","Total > 4G");a.addColumn({type:"string",role:"style"},"Style > 4G");date_values=[];for(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]["2G"],"color:gold",b[d-1]["4G"],"color:red",b[d-1]["8G"],"color:blue"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances", 25 viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["gold","red","blue"],lineWidth:5}}} 26 function build_data_per_month_flavours_mem(g,e){for(var b=[],c=["2G","4G","8G"],d=0;12>d;d++){b[d]={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 c)if(g[c[f]][d])for(var a in g[c[f]][d])for(var h in g[c[f]][d][a])b[d][h+"_"+c[f]]+=g[c[f]][d][a][h]}c=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total client < 2G"); 22 27 a.addColumn({type:"string",role:"style"},"Style client < 2G");a.addColumn("number","Total client < 4G");a.addColumn({type:"string",role:"style"},"Style client < 4G");a.addColumn("number","Total client > 4G");a.addColumn({type:"string",role:"style"},"Style client > 4G");a.addColumn("number","Total server < 2G");a.addColumn({type:"string",role:"style"},"Style server < 2G");a.addColumn("number","Total server < 4G");a.addColumn({type:"string",role:"style"},"Style server < 4G");a.addColumn("number","Total server > 4G"); 23 28 a.addColumn({type:"string",role:"style"},"Style server > 4G");a.addColumn("number","Total desktop < 2G");a.addColumn({type:"string",role:"style"},"Style desktop < 2G");a.addColumn("number","Total desktop < 4G");a.addColumn({type:"string",role:"style"},"Style desktop < 4G");a.addColumn("number","Total desktop > 4G");a.addColumn({type:"string",role:"style"},"Style desktop > 4G");a.addColumn("number","Total other < 2G");a.addColumn({type:"string",role:"style"},"Style other < 2G");a.addColumn("number", 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",25 b[ c-1].server_8G,"color:pink",b[c-1].desktop_2G,"color:slateblue",b[c-1].desktop_4G,"color:skyblue",b[c-1].desktop_8G,"color:blue",b[c-1].other_2G,"color:teal",b[c-1].other_4G,"color:darkkhaki",b[c-1].other_8G,"color:green"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},29 "Total other < 4G");a.addColumn({type:"string",role:"style"},"Style other < 4G");a.addColumn("number","Total other > 4G");a.addColumn({type:"string",role:"style"},"Style other > 4G");date_values=[];for(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_2G,"color:darkgoldenrod",b[d-1].client_4G,"color:goldenrod",b[d-1].client_8G,"color:gold",b[d-1].server_2G,"color:darkviolet",b[d-1].server_4G,"color:deeppink", 30 b[d-1].server_8G,"color:pink",b[d-1].desktop_2G,"color:slateblue",b[d-1].desktop_4G,"color:skyblue",b[d-1].desktop_8G,"color:blue",b[d-1].other_2G,"color:teal",b[d-1].other_4G,"color:darkkhaki",b[d-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:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"}, 26 31 focusTarget:"category",colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink slateblue skyblue blue teal darkkhaki green".split(" "),lineWidth:5}}} 27 function build_data_per_month_ltsp_usage(g,e){for(var b=[], d=0;24>d;d++){var c=Math.floor(d/2);g[d]&&(b[c]||(b[c]={0:0,1:0}),b[c][parseInt(g[d][0])]=parseInt(g[d][1]))}c=[];var f=new Date,a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total normal clients");a.addColumn({type:"string",role:"style"},"Total normal clients style");a.addColumn("number","Total ltsp clients");a.addColumn({type:"string",role:"style"},"Total ltsp clients style");28 date_values=[];for( d=1;12>=d;d++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),c.push(date_to_add),date_values.push([date_to_add,b[d-1][0],"color:purple",b[d-1][1],"color:gold"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",32 function build_data_per_month_ltsp_usage(g,e){for(var b=[],c=0;24>c;c++){var d=Math.floor(c/2);g[c]&&(b[d]||(b[d]={0:0,1:0}),b[d][parseInt(g[c][0])]=parseInt(g[c][1]))}d=[];var f=new Date,a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total normal clients");a.addColumn({type:"string",role:"style"},"Total normal clients style");a.addColumn("number","Total ltsp clients");a.addColumn({type:"string",role:"style"},"Total ltsp clients style"); 33 date_values=[];for(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][0],"color:purple",b[c-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:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category", 29 34 colors:["purple","gold"],lineWidth:5}}} 30 function build_data_per_month_ltsp_modes(g,e){for(var b=[], d=0;36>d;d++){var c=Math.floor(d/3);g[d]&&(b[c]||(b[c]={thin:0,semi:0,fat:0}),b[c][g[d][0]]=parseInt(g[d][1]))}c=[];var f=new Date,a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total thin clients");a.addColumn({type:"string",role:"style"},"Total thin clients style");a.addColumn("number","Total semi clients");a.addColumn({type:"string",role:"style"},"Total semi clients style");a.addColumn("number",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",35 function build_data_per_month_ltsp_modes(g,e){for(var b=[],c=0;36>c;c++){var d=Math.floor(c/3);g[c]&&(b[d]||(b[d]={thin:0,semi:0,fat:0}),b[d][g[c][0]]=parseInt(g[c][1]))}d=[];var f=new Date,a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total thin clients");a.addColumn({type:"string",role:"style"},"Total thin clients style");a.addColumn("number","Total semi clients");a.addColumn({type:"string",role:"style"},"Total semi clients style");a.addColumn("number", 36 "Total fat clients");a.addColumn({type:"string",role:"style"},"Total fat clients style");date_values=[];for(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].thin,"color:purple",b[c-1].semi,"color:gold",b[c-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:d,format:"MMM"},vAxis:{title:"Num instances", 32 37 viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","olive"],lineWidth:5}}} 33 function build_data_per_month_releases_cpu(g,e){for(var b=[], d=["mono","dualquad","more"],c=0;12>c;c++){b[c]={"15_mono":0,"15_dualquad":0,"15_more":0,"16_mono":0,"16_dualquad":0,"16_more":0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][a+"_"+d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total 15 mono processor");a.addColumn({type:"string",role:"style"},"Style 15 mono processor");38 function build_data_per_month_releases_cpu(g,e){for(var b=[],c=["mono","dualquad","more"],d=0;12>d;d++){b[d]={"15_mono":0,"15_dualquad":0,"15_more":0,"16_mono":0,"16_dualquad":0,"16_more":0};for(var f in c)if(g[c[f]][d])for(var a in g[c[f]][d])for(var h in g[c[f]][d][a])b[d][a+"_"+c[f]]+=g[c[f]][d][a][h]}c=[];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"); 34 39 a.addColumn("number","Total 15 dual or quad processor");a.addColumn({type:"string",role:"style"},"Style 15 dual or quad processor");a.addColumn("number","Total 15 more than quad processor");a.addColumn({type:"string",role:"style"},"Style 15 more than quad processor");a.addColumn("number","Total 16 mono processor");a.addColumn({type:"string",role:"style"},"Style 16 mono processor");a.addColumn("number","Total 16 dual or quad processor");a.addColumn({type:"string",role:"style"},"Style 16 dual or quad processor"); 35 a.addColumn("number","Total 16 more than quad processor");a.addColumn({type:"string",role:"style"},"Style 16 more than quad processor");date_values=[];for(c=1;12>=c;c++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),d.push(date_to_add),date_values.push([date_to_add,b[c-1]["15_mono"],"color:darkgoldenrod",b[c-1]["15_dualquad"],"color:goldenrod",b[c-1]["15_more"],"color:gold",b[c-1]["16_mono"],"color:darkviolet",b[c-1]["16_dualquad"],"color:deeppink",b[c-1]["16_more"],"color:pink"]), 36 f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink".split(" "),lineWidth:5}}} 37 function build_data_per_month_flavours_cpu(g,e){for(var b=[],d=["mono","dualquad","more"],c=0;12>c;c++){b[c]={client_mono:0,client_dualquad:0,client_more:0,server_mono:0,server_dualquad:0,server_more:0,desktop_mono:0,desktop_dualquad:0,desktop_more:0,other_mono:0,other_dualquad:0,other_more:0};for(var f in d)if(g[d[f]][c])for(var a in g[d[f]][c])for(var h in g[d[f]][c][a])b[c][h+"_"+d[f]]+=g[d[f]][c][a][h]}d=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"}, 40 a.addColumn("number","Total 16 more than quad processor");a.addColumn({type:"string",role:"style"},"Style 16 more than quad processor");date_values=[];for(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_mono"],"color:darkgoldenrod",b[d-1]["15_dualquad"],"color:goldenrod",b[d-1]["15_more"],"color:gold",b[d-1]["16_mono"],"color:darkviolet",b[d-1]["16_dualquad"],"color:deeppink",b[d-1]["16_more"],"color:pink"]), 41 f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink".split(" "),lineWidth:5}}} 42 function build_data_per_month_cpu(g,e){for(var b=[],c=["mono","dualquad","more"],d=0;12>d;d++){b[d]={mono:0,dualquad:0,more:0};for(var f in c)if(g[c[f]][d])for(var a in g[c[f]][d])for(var h in g[c[f]][d][a])b[d][c[f]]+=g[c[f]][d][a][h]}c=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"},"Date");a.addColumn("number","Total mono processor");a.addColumn({type:"string",role:"style"},"Style mono processor");a.addColumn("number","Total dual or quad processor");a.addColumn({type:"string", 43 role:"style"},"Style dual or quad processor");a.addColumn("number","Total more than quad processor");a.addColumn({type:"string",role:"style"},"Style more than quad processor");date_values=[];for(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].mono,"color:gold",b[d-1].dualquad,"color:red",b[d-1].more,"color:blue"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function", 44 isStacked:!1,hAxis:{title:"Months",ticks:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["gold","red","blue"],lineWidth:5}}} 45 function build_data_per_month_flavours_cpu(g,e){for(var b=[],c=["mono","dualquad","more"],d=0;12>d;d++){b[d]={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 c)if(g[c[f]][d])for(var a in g[c[f]][d])for(var h in g[c[f]][d][a])b[d][h+"_"+c[f]]+=g[c[f]][d][a][h]}c=[];f=new Date;a=new google.visualization.DataTable;a.addColumn({type:"date",role:"domain"}, 38 46 "Date");a.addColumn("number","Total client mono processor");a.addColumn({type:"string",role:"style"},"Style client mono processor");a.addColumn("number","Total client dual or quad processor");a.addColumn({type:"string",role:"style"},"Style client dual or quad processor");a.addColumn("number","Total client more than quad processor");a.addColumn({type:"string",role:"style"},"Style client more than quad processor");a.addColumn("number","Total server mono processor");a.addColumn({type:"string",role:"style"}, 39 47 "Style server mono processor");a.addColumn("number","Total server dual or quad processor");a.addColumn({type:"string",role:"style"},"Style server dual or quad processor");a.addColumn("number","Total server more than quad processor");a.addColumn({type:"string",role:"style"},"Style server more than quad processor");a.addColumn("number","Total desktop mono processor");a.addColumn({type:"string",role:"style"},"Style desktop mono processor");a.addColumn("number","Total desktop dual or quad processor"); 40 48 a.addColumn({type:"string",role:"style"},"Style desktop dual or quad processor");a.addColumn("number","Total desktop more than quad processor");a.addColumn({type:"string",role:"style"},"Style desktop more than quad processor");a.addColumn("number","Total other mono processor");a.addColumn({type:"string",role:"style"},"Style other mono processor");a.addColumn("number","Total other dual or quad processor");a.addColumn({type:"string",role:"style"},"Style other dual or quad processor");a.addColumn("number", 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",42 b[ c-1].desktop_mono,"color:slateblue",b[c-1].desktop_dualquad,"color:skyblue",b[c-1].desktop_more,"color:blue",b[c-1].other_mono,"color:teal",b[c-1].other_dualquad,"color:darkkhaki",b[c-1].other_more,"color:green"]),f.setMonth(month-1);a.addRows(date_values);return{data:a,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:d,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",49 "Total other more than quad processor");a.addColumn({type:"string",role:"style"},"Style other more than quad processor");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_mono,"color:darkgoldenrod",b[d-1].client_dualquad,"color:goldenrod",b[d-1].client_more,"color:gold",b[d-1].server_mono,"color:darkviolet",b[d-1].server_dualquad,"color:deeppink",b[d-1].server_more,"color:pink", 50 b[d-1].desktop_mono,"color:slateblue",b[d-1].desktop_dualquad,"color:skyblue",b[d-1].desktop_more,"color:blue",b[d-1].other_mono,"color:teal",b[d-1].other_dualquad,"color:darkkhaki",b[d-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:c,format:"MMM"},vAxis:{title:"Num instances",viewWindow:{min:0},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category", 43 51 colors:"darkgoldenrod goldenrod gold darkviolet deeppink pink slateblue skyblue blue teal darkkhaki green".split(" "),lineWidth:5}}} 44 function build_data_from_array(g,e){var b=[],d=new Date,c=new google.visualization.DataTable;c.addColumn({type:"date",role:"domain"},"Nhosts");c.addColumn("number",e);date_values=[];for(i=1;12>=i;i++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),b.push(date_to_add),date_values.push([date_to_add,g[i-1]]),d.setMonth(month-1);c.addRows(date_values);return{data:c,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:b,format:"MMM"},vAxis:{title:"Num hosts", 45 minValue:0,maxValue:"automatic",viewWindowMode:"pretty",viewWindow:{min:0,max:"auto"},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"10%",right:"10%"},focusTarget:"category",lineWidth:5}}} 46 function doExtendedChart(){end_load_time=get_time();var g=window.location.search.substr(1);""!=g&&(g="?"+g);var e={};start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');$.getJSON("./GetExtendedStats"+g,function(b){start_graph_time=end_get_time=get_time();var d=null;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"; 50 e[type].flavours.graph=build_data_per_month_flavour_arch(b[key][type],"Architectures by flavour per month");e[type].flavours.title="Architectures distribution by flavour per month";break;case "mem":e[type]||(e[type]={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"; 52 break;case "count_ltsp":case "count_mode":e.ltsp||(e.ltsp={},e.ltsp.title="LTSP Usage"),"count_ltsp"!=type||e.ltsp.usage||(e.ltsp.usage={},e.ltsp.usage.graph=build_data_per_month_ltsp_usage(b[key][type],"LTSP usage per month"),e.ltsp.usage.title="LTSP Use"),"count_mode"!=type||e.ltsp.modes||(e.ltsp.modes={},e.ltsp.modes.graph=build_data_per_month_ltsp_modes(b[key][type],"LTSP type by type per month"),e.ltsp.modes.title="Clients LTSP Mode")}if("apps"==key)for(type in b.apps)switch(type){case "app":d= 53 b.apps[type];break;case "app_use":b[key][type]&&(e[type]={},e[type].title="Application usage",e[type].releases={},e[type].releases.graph=build_data_per_month_releases(b[key][type],"Application use by release per month ("+d+")"),e[type].releases.title="Use per month for application "+d,e[type].flavours={},e[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Application use by flavour per month ("+d+")"),e[type].flavours.title="Use per month for application "+d)}key.startsWith("debug")&& 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)})} 52 function build_data_from_array(g,e){var b=[],c=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Nhosts");d.addColumn("number",e);date_values=[];for(i=1;12>=i;i++)month=c.getMonth(),year=c.getFullYear(),date_to_add=new Date(year,month),b.push(date_to_add),date_values.push([date_to_add,g[i-1]]),c.setMonth(month-1);d.addRows(date_values);return{data:d,options:{title:e,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:b,format:"MMM"},vAxis:{title:"Num hosts", 53 minValue:0,maxValue:"automatic",viewWindowMode:"pretty",viewWindow:{min:0,max:"auto"},format:"#"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",lineWidth:5}}} 54 function doExtendedChart(){end_load_time=get_time();var g=window.location.search.substr(1);""!=g&&(g="?"+g);var e={};start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');$.getJSON("./GetExtendedStats"+g,function(b){start_graph_time=end_get_time=get_time();var c=null,d={machines_per_month:{},clients_per_month:{},freq_updates_per_month:{},change_releases:{},change_flavours:{},count_ltsp:{},count_mode:{},architectures:{},mem:{},cpu:{}};for(key in b){if("clients"==key)for(type in d)if(b[key][type])switch(type){case "machines_per_month":e.clients_per_month|| 55 (e.clients_per_month={});e.clients_per_month.hosts||(e.clients_per_month.hosts={});e.clients_per_month.title="Machines";e.clients_per_month.hosts.graph=build_data_from_array(b[key][type],"Number of unique machines used");e.clients_per_month.hosts.title="Number of unique machines used";break;case "clients_per_month":e.clients_per_month||(e.clients_per_month={});e.clients_per_month.releases||(e.clients_per_month.releases={});e.clients_per_month.flavours||(e.clients_per_month.flavours={});e[type].title= 56 "Machines";e[type].releases.graph=build_data_per_month_releases(b[key][type],"Number instances by release per month");e[type].releases.title="Number instances by release per month";e[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Number instances by flavour per month");e[type].flavours.title="Number instances by flavour per month";break;case "freq_updates_per_month":e[type]={};e[type].title="Updates";e[type].releases={};e[type].releases.graph=build_data_per_month_releases(b[key][type], 57 "Number updates by release per month");e[type].releases.title="Number updates by release per month";e[type].flavours={};e[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Number updates by flavour per month");e[type].flavours.title="Number updates by flavour per month";break;case "change_releases":e.changes||(e.changes={},e.changes.title="Upgrades");e.changes.releases||(e.changes.releases={});e.changes.releases.graph=build_data_from_array(b[key][type],"Change releases per month"); 58 e.changes.releases.title="Change releases per month";break;case "change_flavours":e.changes||(e.changes={},e.changes.title="Changes");e.changes.flavours||(e.changes.flavours={});e.changes.flavours.graph=build_data_from_array(b[key][type],"Change flavours per month");e.changes.flavours.title="Change flavours per month";break;case "architectures":e[type]||(e[type]={global:{},releases:{},flavours:{}},e[type].title="Architectures");e[type].global.graph=build_data_per_month_arch(b[key][type],"Architectures per month"); 59 e[type].global.title="Architectures distribution per month";e[type].releases.graph=build_data_per_month_release_arch(b[key][type],"Architectures by release per month");e[type].releases.title="Architectures distribution by release per month";e[type].flavours.graph=build_data_per_month_flavour_arch(b[key][type],"Architectures by flavour per month");e[type].flavours.title="Architectures distribution by flavour per month";break;case "mem":e[type]||(e[type]={global:{},releases:{},flavours:{}},e[type].title= 60 "Memory");e[type].global.graph=build_data_per_month_mem(b[key][type],"Memory per month");e[type].global.title="Memory distribution per month";e[type].releases.graph=build_data_per_month_releases_mem(b[key][type],"Memory by release per month");e[type].releases.title="Memory distribution by release per month";e[type].flavours.graph=build_data_per_month_flavours_mem(b[key][type],"Memory by flavour per month");e[type].flavours.title="Memory distribution by flavour per month";break;case "cpu":e.cpu||(e.cpu= 61 {global:{},releases:{},flavours:{}},e.cpu.title="CpuS");e.cpu.global.graph=build_data_per_month_cpu(b[key][type],"Number CpuS per month");e.cpu.global.title="Number CpuS distribution per month";e.cpu.releases.graph=build_data_per_month_releases_cpu(b[key][type],"Number CpuS by release per month");e.cpu.releases.title="Number CpuS distribution by release per month";e.cpu.flavours.graph=build_data_per_month_flavours_cpu(b[key][type],"Number CpuS by release per month");e.cpu.flavours.title="Number CpuS distribution by flavour per month"; 62 break;case "count_ltsp":case "count_mode":e.ltsp||(e.ltsp={},e.ltsp.title="LTSP Usage"),"count_ltsp"!=type||e.ltsp.usage||(e.ltsp.usage={},e.ltsp.usage.graph=build_data_per_month_ltsp_usage(b[key][type],"LTSP usage per month"),e.ltsp.usage.title="LTSP Use"),"count_mode"!=type||e.ltsp.modes||(e.ltsp.modes={},e.ltsp.modes.graph=build_data_per_month_ltsp_modes(b[key][type],"LTSP type by type per month"),e.ltsp.modes.title="Clients LTSP Mode")}if("apps"==key)for(type in b.apps)switch(type){case "app":c= 63 b.apps[type];break;case "app_use":b[key][type]&&(e[type]={},e[type].title="Application usage",e[type].releases={},e[type].releases.graph=build_data_per_month_releases(b[key][type],"Application use by release per month ("+c+")"),e[type].releases.title="Use per month for application "+c,e[type].flavours={},e[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Application use by flavour per month ("+c+")"),e[type].flavours.title="Use per month for application "+c)}key.startsWith("debug")&& 64 ("debug_query_time"==key&&(query_time=b[key]),"debug_keep_alive"==key&&(keep_alive=b[key]))}for(var f in e)if(e[f].title){$("#accordion").append('<h3 class="'+f+'">'+e[f].title+'</h3><div id="'+f+'"></div>');for(var a in e[f])"title"!=a&&e[f][a].graph&&($("#"+f).append("<div id="+f+"_"+a+"></div>"),b=get_sizes(f),e[f][a].graph.options.width=b.width,e[f][a].graph.options.height=b.height,(new google.visualization.LineChart(document.getElementById(f+"_"+a))).draw(e[f][a].graph.data,e[f][a].graph.options))}$("#loading").remove(); 65 $("#accordion").accordion({active:!1,collapsible:!0});null!=c&&$(".app_use").click();end_graph_time=get_time();print_stats(end_graph_time,query_time)})} 56 66 function doChart(g){g=void 0===g?"":g;end_load_time=get_time();var e=new google.visualization.DataTable;e.addColumn("string","App");e.addColumn("number","Count");e=new google.visualization.DataTable;e.addColumn("string","App");e.addColumn("number","Count");e=new google.visualization.DataTable;e.addColumn("string","App");e.addColumn("number","Count");start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');console.log(g);""==g?(url="./GetStats",limit=10):(url="./GetLliurexStats", 57 67 limit=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 "+ 58 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 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,68 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 c=new google.visualization.DataTable;c.addColumn("string","App");c.addColumn("number","Count");for($.each(b[distro][sabor][i][0],function(b,e){c.addRow([b,parseInt(e)]);k++});10>k;)c.addRow(["",0]),k++;obj.push(c);titles[i]=titles[i]+" (Total clients: "+b[distro][sabor][i][1].nclients+")";drawChart(obj[obj.length-1],titles[i],divname+i, 59 69 k)}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}))} 60 70 function print_stats(g,e){g=void 0===g?0:g;e=void 0===e?0:e;$("#stats_box").append('<span class="stats">Load time: '+((end_load_time-start_load_time)/1E3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Get time: '+parseFloat((end_get_time-start_get_time)/1E3-e).toFixed(3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Graph time: '+((g-start_graph_time)/1E3).toString()+" sec</span>");$("#stats_box").append('<span class="stats">Query time: '+parseFloat(e).toFixed(3).toString()+
Note: See TracChangeset
for help on using the changeset viewer.