Changeset 6884


Ignore:
Timestamp:
Feb 21, 2018, 12:55:47 PM (18 months ago)
Author:
mabarracus
Message:

Completed platformdata visualization

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

Legend:

Unmodified
Added
Removed
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/db.php

    r6876 r6884  
    311311             }
    312312            }
    313 
    314          
     313        // architecture
     314        $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;";
     315        $cache_key='extended_arch';
     316        $data = $cache->get($cache_key);
     317        $stime=microtime(true);
     318        if ($data != false){
     319            $clients_arch=$data;
     320        }else{
     321            $result=$this->dbconn->query($sql);
     322            if ($result){
     323                $this->times+=microtime(true)-$stime;
     324                $clients_arch=[];
     325                $tmp=[];
     326                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     327                    $date=$row['year'].'_'.$row['month'];
     328                    $tmp[$date][$row['Releases_name']][$row['arch']]=intval($row['count']);
     329                }
     330                foreach ($tmp as $date){
     331                    $clients_arch[]=$date;
     332                }
     333                $cache->store($clients_arch,$cache_key);
     334            }else{
     335                $clients_arch=$this->dbconn->error;
     336            }
     337        }
     338        // memory
     339        //$sql_2G="select year(date) as year, month(date) as month, Releases_name, count(Client_uid) as count from Client_Versions where mem < 2048000 group by Releases_name, year, month order by year desc,month desc,Releases_name asc;";
     340        $sql_2G = "select year(t1.date) as year, month(t1.date) as month, t1.Releases_name as rel, count(t2.uuid) as count from Client_Versions t1 left join (select * from Client_Versions where mem < 2048000 ) t2 on t1.uuid = t2.uuid group by year, month, rel order by year desc,month desc,rel asc;";         
     341        $cache_key='extended_memory_2G';
     342        $data = $cache->get($cache_key);
     343        $stime=microtime(true);
     344        if ($data != false){
     345            $clients_2G=$data;
     346        }else{
     347            $result=$this->dbconn->query($sql_2G);
     348            if ($result){
     349                $this->times+=microtime(true)-$stime;
     350                $clients_2G=[];
     351                $tmp=[];
     352                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     353                    $date=$row['year'].'_'.$row['month'];
     354                    $tmp[$date][$row['Releases_name']]=intval($row['count']);
     355                }
     356                foreach ($tmp as $date){
     357                    $clients_2G[]=$date;
     358                }
     359                $cache->store($clients_2G,$cache_key);
     360            }else{
     361                $clients_2G=$this->dbconn->error;
     362            }
     363        }
     364        //$sql_4G="select year(date) as year, month(date) as month, Releases_name, count(Client_uid) as count from Client_Versions where mem > 2048000 and mem < 4096000 group by Releases_name, year, month order by year desc,month desc,Releases_name asc;";
     365        $sql_4G = "select year(t1.date) as year, month(t1.date) as month, t1.Releases_name as rel, count(t2.uuid) as count from Client_Versions t1 left join (select * from Client_Versions where mem > 2048000 and mem < 4096000 ) t2 on t1.uuid = t2.uuid group by year, month, rel order by year desc,month desc,rel asc;";
     366        $cache_key='extended_memory_4G';
     367        $data = $cache->get($cache_key);
     368        $stime=microtime(true);
     369        if ($data != false){
     370            $clients_4G=$data;
     371        }else{
     372            $result=$this->dbconn->query($sql_4G);
     373            if ($result){
     374                $this->times+=microtime(true)-$stime;
     375                $clients_4G=[];
     376                $tmp=[];
     377                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     378                    $date=$row['year'].'_'.$row['month'];
     379                    $tmp[$date][$row['Releases_name']]=intval($row['count']);
     380                }
     381                foreach ($tmp as $date){
     382                    $clients_4G[]=$date;
     383                }
     384                $cache->store($clients_4G,$cache_key);
     385            }else{
     386                $clients_4G=$this->dbconn->error;
     387            }
     388        }
     389        //$sql_8G="select year(date) as year, month(date) as month, Releases_name, count(Client_uid) as count from Client_Versions where mem > 4096000 group by Releases_name, year, month order by year desc,month desc,Releases_name asc;";
     390        $sql_8G = "select year(t1.date) as year, month(t1.date) as month, t1.Releases_name as rel, count(t2.uuid) as count from Client_Versions t1 left join (select * from Client_Versions where mem > 4096000 ) t2 on t1.uuid = t2.uuid group by year, month, rel order by year desc,month desc,rel asc;";
     391        $cache_key='extended_memory_8G';
     392        $data = $cache->get($cache_key);
     393        $stime=microtime(true);
     394        if ($data != false){
     395            $clients_8G=$data;
     396        }else{
     397            $result=$this->dbconn->query($sql_8G);
     398            if ($result){
     399                $this->times+=microtime(true)-$stime;
     400                $clients_8G=[];
     401                $tmp=[];
     402                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     403                    $date=$row['year'].'_'.$row['month'];
     404                    $tmp[$date][$row['rel']]=intval($row['count']);
     405                }
     406                foreach ($tmp as $date){
     407                    $clients_8G[]=$date;
     408                }
     409                $cache->store($clients_8G,$cache_key);
     410            }else{
     411                $clients_8G=$this->dbconn->error;
     412            }
     413        }
     414        // cpu
     415        //$sql_mono = "select year(date) as year, month(date) as month, Releases_name, count(Client_uid) as count from Client_Versions where ncpu < 2 group by Releases_name, year, month order by year desc,month desc,Releases_name asc;";
     416        $sql_mono = "select year(t1.date) as year, month(t1.date) as month, t1.Releases_name as rel, count(t2.uuid) as count from Client_Versions t1 left join (select * from Client_Versions where ncpu = 1 ) t2 on t1.uuid = t2.uuid group by year, month, rel order by year desc,month desc,rel asc;";
     417        $cache_key='extended_memory_cpu_mono';
     418        $data = $cache->get($cache_key);
     419        $stime=microtime(true);
     420        if ($data != false){
     421            $clients_mono=$data;
     422        }else{
     423            $result=$this->dbconn->query($sql_mono);
     424            if ($result){
     425                $this->times+=microtime(true)-$stime;
     426                $clients_mono=[];
     427                $tmp=[];
     428                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     429                    $date=$row['year'].'_'.$row['month'];
     430                    $tmp[$date][$row['rel']]=intval($row['count']);
     431                }
     432                foreach ($tmp as $date){
     433                    $clients_mono[]=$date;
     434                }
     435                $cache->store($clients_mono,$cache_key);
     436            }else{
     437                $clients_mono=$this->dbconn->error;
     438            }
     439        }
     440        //$sql_dualquad = "select year(date) as year, month(date) as month, Releases_name, count(Client_uid) as count from Client_Versions where ncpu > 1 and ncpu < 5 group by Releases_name, year, month order by year desc,month desc,Releases_name asc;";
     441        $sql_dualquad = "select year(t1.date) as year, month(t1.date) as month, t1.Releases_name as rel, count(t2.uuid) as count from Client_Versions t1 left join (select * from Client_Versions where ncpu > 1 and ncpu < 5 ) t2 on t1.uuid = t2.uuid group by year, month, rel order by year desc,month desc,rel asc;";
     442        $cache_key='extended_memory_cpu_dualquad';
     443        $data = $cache->get($cache_key);
     444        $stime=microtime(true);
     445        if ($data != false){
     446            $clients_dualquad=$data;
     447        }else{
     448            $result=$this->dbconn->query($sql_dualquad);
     449            if ($result){
     450                $this->times+=microtime(true)-$stime;
     451                $clients_dualquad=[];
     452                $tmp=[];
     453                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     454                    $date=$row['year'].'_'.$row['month'];
     455                    $tmp[$date][$row['rel']]=intval($row['count']);
     456                }
     457                foreach ($tmp as $date){
     458                    $clients_dualquad[]=$date;
     459                }
     460                $cache->store($clients_dualquad,$cache_key);
     461            }else{
     462                $clients_dualquad=$this->dbconn->error;
     463            }
     464        }
     465        $sql_more = "select year(t1.date) as year, month(t1.date) as month, t1.Releases_name as rel, count(t2.uuid) as count from Client_Versions t1 left join (select * from Client_Versions where ncpu > 4 ) t2 on t1.uuid = t2.uuid group by year, month, rel order by year desc,month desc,rel asc;";
     466        $cache_key='extended_memory_cpu_other';
     467        $data = $cache->get($cache_key);
     468        $stime=microtime(true);
     469        if ($data != false){
     470            $clients_more=$data;
     471        }else{
     472            $result=$this->dbconn->query($sql_more);
     473            if ($result){
     474                $this->times+=microtime(true)-$stime;
     475                $clients_more=[];
     476                $tmp=[];
     477                while($row=$result->fetch_array(MYSQLI_ASSOC)){
     478                    $date=$row['year'].'_'.$row['month'];
     479                    $tmp[$date][$row['rel']]=intval($row['count']);
     480                }
     481                foreach ($tmp as $date){
     482                    $clients_more[]=$date;
     483                }
     484                $cache->store($clients_more,$cache_key);
     485            }else{
     486                $clients_more=$this->dbconn->error;
     487            }
     488        }
    315489         // CLIENT UPDATES
    316490         $sql="select year,month,count(*) as nclients,sum(cnt)-count(*) as nclients_updated from (select Client_uid,count(Client_uid) as cnt,year(date) as year,month(date) as month from Client_Versions where date >= '$min_date' GROUP by Client_uid,year,month having count(Client_uid) >= 1 ) t group by year,month order by year desc,month desc";
     
    442616             $stats['clients']['change_flavours']=$change_flavour;
    443617         }
     618         if (isset($clients_arch)){
     619             $stats['clients']['architectures']=$clients_arch;
     620         }
     621         if (isset($clients_2G)){
     622             $stats['clients']['mem']['2G']=$clients_2G;
     623         }
     624         if (isset($clients_4G)){
     625             $stats['clients']['mem']['4G']=$clients_4G;
     626         }
     627         if (isset($clients_8G)){
     628             $stats['clients']['mem']['8G']=$clients_8G;
     629         }
     630         if (isset($clients_mono)){
     631             $stats['clients']['cpu']['mono']=$clients_mono;
     632         }
     633         if (isset($clients_dualquad)){
     634             $stats['clients']['cpu']['dualquad']=$clients_dualquad;
     635         }
     636         if (isset($clients_more)){
     637             $stats['clients']['cpu']['more']=$clients_more;
     638         }
    444639         $stats['debug_query_time']=strval(number_format($this->times,5));
    445640         if (file_exists($this->ka_file)){
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph.js

    r6876 r6884  
    3737    var custom_width=$('#'+id).parent().width()*0.95;
    3838    var custom_height=$(window).height()*0.72/2;
     39    switch(id){
     40        case 'clients_per_month':
     41        case 'freq_updates_per_month':
     42        case 'change_releases':
     43        case 'change_flavours':
     44            break;
     45        case 'architectures':
     46        case 'mem':
     47        case 'cpu':
     48            break
     49    }
    3950    return {'width':custom_width,'height':custom_height};
    4051}
     
    145156    return {data:data_table,options:options}
    146157}
     158function build_data_per_month_arch(data,title){
     159    var total=[];
     160    for (i=0 ; i < 12; i++){
     161        total[i]={'15_i386':0,'15_x86_64':0,'16_i386':0,'16_x86_64':0};
     162        if (! data[i]){
     163            continue;
     164        }
     165        for (rel in data[i]){
     166            for (arch in data[i][rel]){
     167                total[i][rel+'_'+arch]+=data[i][rel][arch];
     168            }
     169        }
     170
     171    }
     172    var dates_axis=[];
     173    var d= new Date();
     174    var data_table = new google.visualization.DataTable();
     175    data_table.addColumn({type:'date',role:'domain'},'Date');
     176    data_table.addColumn('number','Total 15 x86');
     177    data_table.addColumn({type:'string',role:'style'},'Style 15 x86');
     178    data_table.addColumn('number','Total 15 x86_64');
     179    data_table.addColumn({type:'string',role:'style'},'Style 15 x86_64');
     180    data_table.addColumn('number','Total 16 x86');
     181    data_table.addColumn({type:'string',role:'style'},'Style 16 x86');
     182    data_table.addColumn('number','Total 16 x86_64');
     183    data_table.addColumn({type:'string',role:'style'},'Style 16 x86_64');
     184
     185
     186    date_values=[];
     187    for (i=1;i <= 12;i++){
     188        month=d.getMonth();
     189        year=d.getFullYear();
     190        date_to_add=new Date(year,month)
     191        dates_axis.push(date_to_add);
     192        date_values.push([date_to_add,total[i-1]['15_i386'],'color:purple',total[i-1]['15_x86_64'],'color:gold',total[i-1]['16_i386'],'color:teal',total[i-1]['16_x86_64'],'color:olive'])
     193        d.setMonth(month-1);
     194    }
     195    data_table.addRows(date_values);
     196    var options= {  title: title,
     197                    curveType: 'function',
     198                    isStacked: false,
     199                    hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
     200                    vAxis:{title:'Num hosts'},
     201                    legend:{textStyle:{fontSize: 10}},
     202                    chartArea:{left:'5%',right:'10%'},
     203                    focusTarget: 'category',
     204                    colors: ['purple','gold','teal','olive'],
     205                    lineWidth: 5,
     206                    };
     207    return {data:data_table,options:options}
     208}
     209
     210function build_data_per_month_mem(data,title){
     211    var total=[];
     212    var sizes=['2G','4G','8G']
     213    for (var i=0 ; i < 12; i++){
     214        total[i]={'15_2G':0,'15_4G':0,'15_8G':0,'16_2G':0,'16_4G':0,'16_8G':0};
     215        for (var size in sizes){
     216            if (! data[sizes[size]][i]){
     217                continue;
     218            }
     219            for (var rel in data[sizes[size]][i]){
     220                total[i][rel+'_'+sizes[size]]+=data[sizes[size]][i][rel];
     221            }
     222        }
     223    }
     224    var dates_axis=[];
     225    var d= new Date();
     226    var data_table = new google.visualization.DataTable();
     227    data_table.addColumn({type:'date',role:'domain'},'Date');
     228    data_table.addColumn('number','Total 15 < 2G');
     229    data_table.addColumn({type:'string',role:'style'},'Style 15 < 2G');
     230    data_table.addColumn('number','Total 15 < 4G');
     231    data_table.addColumn({type:'string',role:'style'},'Style 15 < 4G');
     232    data_table.addColumn('number','Total 15 > 4G');
     233    data_table.addColumn({type:'string',role:'style'},'Style 15 > 4G');
     234    data_table.addColumn('number','Total 16 < 2G');
     235    data_table.addColumn({type:'string',role:'style'},'Style 16 < 2G');
     236    data_table.addColumn('number','Total 16 < 4G');
     237    data_table.addColumn({type:'string',role:'style'},'Style 16 < 4G');
     238    data_table.addColumn('number','Total 16 > 4G');
     239    data_table.addColumn({type:'string',role:'style'},'Style 16 > 4G');
     240
     241    date_values=[];
     242    for (i=1;i <= 12;i++){
     243        month=d.getMonth();
     244        year=d.getFullYear();
     245        date_to_add=new Date(year,month)
     246        dates_axis.push(date_to_add);
     247        date_values.push([date_to_add,total[i-1]['15_2G'],'color:purple',total[i-1]['15_4G'],'color:gold',total[i-1]['15_8G'],'color:teal',total[i-1]['16_2G'],'color:olive',total[i-1]['16_4G'],'color:red',total[i-1]['16_8G'],'color:pink'])
     248        d.setMonth(month-1);
     249    }
     250    data_table.addRows(date_values);
     251    var options= {  title: title,
     252                    curveType: 'function',
     253                    isStacked: false,
     254                    hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
     255                    vAxis:{title:'Num hosts'},
     256                    legend:{textStyle:{fontSize: 10}},
     257                    chartArea:{left:'5%',right:'10%'},
     258                    focusTarget: 'category',
     259                    colors: ['purple','gold','teal','olive','red','pink'],
     260                    lineWidth: 5,
     261                    };
     262    return {data:data_table,options:options}
     263}
     264
     265function build_data_per_month_cpu(data,title){
     266    var total=[];
     267    var sizes=['mono','dualquad','more']
     268    for (var i=0 ; i < 12; i++){
     269        total[i]={'15_mono':0,'15_dualquad':0,'15_more':0,'16_mono':0,'16_dualquad':0,'16_more':0};
     270        for (var size in sizes){
     271            if (! data[sizes[size]][i]){
     272                continue;
     273            }
     274            for (var rel in data[sizes[size]][i]){
     275                total[i][rel+'_'+sizes[size]]+=data[sizes[size]][i][rel];
     276            }
     277        }
     278    }
     279    var dates_axis=[];
     280    var d= new Date();
     281    var data_table = new google.visualization.DataTable();
     282    data_table.addColumn({type:'date',role:'domain'},'Date');
     283    data_table.addColumn('number','Total 15 mono processor');
     284    data_table.addColumn({type:'string',role:'style'},'Style 15 mono processor');
     285    data_table.addColumn('number','Total 15 dual or quad processor');
     286    data_table.addColumn({type:'string',role:'style'},'Style 15 dual or quad processor');
     287    data_table.addColumn('number','Total 15 more than quad processor');
     288    data_table.addColumn({type:'string',role:'style'},'Style 15 more than quad processor');
     289    data_table.addColumn('number','Total 16 mono processor');
     290    data_table.addColumn({type:'string',role:'style'},'Style 16 mono processor');
     291    data_table.addColumn('number','Total 16 dual or quad processor');
     292    data_table.addColumn({type:'string',role:'style'},'Style 16 dual or quad processor');
     293    data_table.addColumn('number','Total 16 more than quad processor');
     294    data_table.addColumn({type:'string',role:'style'},'Style 16 more than quad processor');
     295
     296    date_values=[];
     297    for (i=1;i <= 12;i++){
     298        month=d.getMonth();
     299        year=d.getFullYear();
     300        date_to_add=new Date(year,month)
     301        dates_axis.push(date_to_add);
     302        date_values.push([date_to_add,total[i-1]['15_mono'],'color:purple',total[i-1]['15_dualquad'],'color:gold',total[i-1]['15_more'],'color:teal',total[i-1]['16_mono'],'color:olive',total[i-1]['16_dualquad'],'color:red',total[i-1]['16_more'],'color:pink'])
     303        d.setMonth(month-1);
     304    }
     305    data_table.addRows(date_values);
     306    var options= {  title: title,
     307                    curveType: 'function',
     308                    isStacked: false,
     309                    hAxis:{title:'Months',ticks:dates_axis,format:'MMM'},
     310                    vAxis:{title:'Num hosts',viewWindow : {min:0}},
     311                    legend:{textStyle:{fontSize: 10}},
     312                    chartArea:{left:'5%',right:'10%'},
     313                    focusTarget: 'category',
     314                    colors: ['purple','gold','teal','olive','red','pink'],
     315                    lineWidth: 5,
     316                    };
     317    return {data:data_table,options:options}
     318}
    147319function build_data_from_array(data,title){
    148320    var dates_axis=[];
     
    230402                        chart_data['changes']['flavours']['title']='Change flavours per month';
    231403                        break;
     404                    case 'architectures':
     405                        if (! chart_data['architectures']){
     406                            chart_data['architectures']={};
     407                            chart_data['architectures']['title']='Architectures';
     408                        }
     409                        if (! chart_data['architectures']['releases'])
     410                            chart_data['architectures']['releases']={}
     411                        chart_data['architectures']['releases']['graph']=build_data_per_month_arch(json[key][type],'Architectures by release per month');
     412                        chart_data['architectures']['releases']['title']='Architectures distribution'
     413                        break;
     414                    case 'mem':
     415                        if (! chart_data['mem']){
     416                            chart_data['mem']={};
     417                            chart_data['mem']['title']='Memory';
     418                        }
     419                        if (! chart_data['mem']['releases'])
     420                            chart_data['mem']['releases']={}
     421                        chart_data['mem']['releases']['graph']=build_data_per_month_mem(json[key][type],'Memory by release per month');
     422                        chart_data['mem']['releases']['title']='Memory distribution'
     423                        break;
     424                    case 'cpu':
     425                        if (! chart_data['cpu']){
     426                            chart_data['cpu']={};
     427                            chart_data['cpu']['title']='CpuS';
     428                        }
     429                        if (! chart_data['cpu']['releases'])
     430                            chart_data['cpu']['releases']={}
     431                        chart_data['cpu']['releases']['graph']=build_data_per_month_cpu(json[key][type],'Number CpuS by release per month');
     432                        chart_data['cpu']['releases']['title']='Number CpuS distribution'
     433                        break;
     434                   
    232435                }
    233436            }
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/analytics/graph_min.js

    r6876 r6884  
    1 function drawChart(c,a,b,e){var f=.95*$("#"+b).parent().width();e=10>e?$(window).height()/3*.75:20*e;a={title:a,width:f,height:e,fontSize:10,legend:"none",hAxis:{viewWindow:{min:0}},chartArea:{left:"5%",right:"1%"}};c=new google.visualization.DataView(c);c.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(c,a)}
     1function drawChart(c,a,b,g){var e=.95*$("#"+b).parent().width();g=10>g?$(window).height()/3*.75:20*g;a={title:a,width:e,height:g,fontSize:10,legend:"none",hAxis:{viewWindow:{min:0}},chartArea:{left:"5%",right:"1%"}};c=new google.visualization.DataView(c);c.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(c,a)}
    22function get_sizes(c){c=.95*$("#"+c).parent().width();var a=.72*$(window).height()/2;return{width:c,height:a}}
    3 function build_data_per_month_releases(c,a){var b=[];for(i=0;12>i;i++)if(b[i]={15:0,16:0,all:0},c[i]){for(rel in c[i]){if("15"==rel)for(fla in c[i][rel])b[i][rel]+=c[i][rel][fla];if("16"==rel)for(fla in c[i][rel])b[i][rel]+=c[i][rel][fla]}b[i].all=b[i]["15"]+b[i]["16"]}var e=[],f=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Release");d.addColumn("number","Total Release 15");d.addColumn({type:"string",role:"style"},"Style Release 15");d.addColumn("number",
    4 "Total Release 16");d.addColumn({type:"string",role:"style"},"Style Release 16");d.addColumn("number","Total ALL Releases");d.addColumn({type:"string",role:"style"},"Style ALL Releases");date_values=[];for(i=1;12>=i;i++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),e.push(date_to_add),date_values.push([date_to_add,b[i-1]["15"],"color:blue",b[i-1]["16"],"color:red",b[i-1].all,"color:grey"]),f.setMonth(month-1);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",
    5 isStacked:!1,hAxis:{title:"Months",ticks:e,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0}},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["blue","red","grey"],lineWidth:5}}}
    6 function build_data_per_month_flavours(c,a){var b=[];for(i=0;12>i;i++)if(b[i]={server:0,client:0,desktop:0,other:0,all:0},c[i])for(rel in c[i])for(fla in c[i][rel])b[i][fla]+=c[i][rel][fla],b[i].all+=c[i][rel][fla];var e=[],f=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Flavour");d.addColumn("number","Total Server");d.addColumn({type:"string",role:"style"},"Style Server");d.addColumn("number","Total Client");d.addColumn({type:"string",role:"style"},"Style Client");
    7 d.addColumn("number","Total Desktop");d.addColumn({type:"string",role:"style"},"Style Desktop");d.addColumn("number","Total Other");d.addColumn({type:"string",role:"style"},"Style Other");d.addColumn("number","Total ALL Flavours");d.addColumn({type:"string",role:"style"},"Style Total ALL Flavours");date_values=[];for(i=1;12>=i;i++)month=f.getMonth(),year=f.getFullYear(),date_to_add=new Date(year,month),e.push(date_to_add),date_values.push([date_to_add,b[i-1].server,"color:purple",b[i-1].client,"color:teal",
    8 b[i-1].desktop,"color:gold",b[i-1].other,"color:olive",b[i-1].all,"color:grey"]),f.setMonth(month-1);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:e,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0}},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","teal","gold","olive","grey"],lineWidth:5}}}
    9 function build_data_from_array(c,a){var b=[],e=new Date,f=new google.visualization.DataTable;f.addColumn({type:"date",role:"domain"},"Nhosts");f.addColumn("number",a);date_values=[];for(i=1;12>=i;i++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),b.push(date_to_add),date_values.push([date_to_add,c[i-1]]),e.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:b,format:"MMM"},vAxis:{title:"Num hosts",
     3function build_data_per_month_releases(c,a){var b=[];for(i=0;12>i;i++)if(b[i]={15:0,16:0,all:0},c[i]){for(rel in c[i]){if("15"==rel)for(fla in c[i][rel])b[i][rel]+=c[i][rel][fla];if("16"==rel)for(fla in c[i][rel])b[i][rel]+=c[i][rel][fla]}b[i].all=b[i]["15"]+b[i]["16"]}var g=[],e=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Release");d.addColumn("number","Total Release 15");d.addColumn({type:"string",role:"style"},"Style Release 15");d.addColumn("number",
     4"Total Release 16");d.addColumn({type:"string",role:"style"},"Style Release 16");d.addColumn("number","Total ALL Releases");d.addColumn({type:"string",role:"style"},"Style ALL Releases");date_values=[];for(i=1;12>=i;i++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),g.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"]),e.setMonth(month-1);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",
     5isStacked:!1,hAxis:{title:"Months",ticks:g,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0}},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["blue","red","grey"],lineWidth:5}}}
     6function build_data_per_month_flavours(c,a){var b=[];for(i=0;12>i;i++)if(b[i]={server:0,client:0,desktop:0,other:0,all:0},c[i])for(rel in c[i])for(fla in c[i][rel])b[i][fla]+=c[i][rel][fla],b[i].all+=c[i][rel][fla];var g=[],e=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Flavour");d.addColumn("number","Total Server");d.addColumn({type:"string",role:"style"},"Style Server");d.addColumn("number","Total Client");d.addColumn({type:"string",role:"style"},"Style Client");
     7d.addColumn("number","Total Desktop");d.addColumn({type:"string",role:"style"},"Style Desktop");d.addColumn("number","Total Other");d.addColumn({type:"string",role:"style"},"Style Other");d.addColumn("number","Total ALL Flavours");d.addColumn({type:"string",role:"style"},"Style Total ALL Flavours");date_values=[];for(i=1;12>=i;i++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),g.push(date_to_add),date_values.push([date_to_add,b[i-1].server,"color:purple",b[i-1].client,"color:teal",
     8b[i-1].desktop,"color:gold",b[i-1].other,"color:olive",b[i-1].all,"color:grey"]),e.setMonth(month-1);d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:g,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0}},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","teal","gold","olive","grey"],lineWidth:5}}}
     9function build_data_per_month_arch(c,a){var b=[];for(i=0;12>i;i++)if(b[i]={"15_i386":0,"15_x86_64":0,"16_i386":0,"16_x86_64":0},c[i])for(rel in c[i])for(arch in c[i][rel])b[i][rel+"_"+arch]+=c[i][rel][arch];var g=[],e=new Date,d=new google.visualization.DataTable;d.addColumn({type:"date",role:"domain"},"Date");d.addColumn("number","Total 15 x86");d.addColumn({type:"string",role:"style"},"Style 15 x86");d.addColumn("number","Total 15 x86_64");d.addColumn({type:"string",role:"style"},"Style 15 x86_64");
     10d.addColumn("number","Total 16 x86");d.addColumn({type:"string",role:"style"},"Style 16 x86");d.addColumn("number","Total 16 x86_64");d.addColumn({type:"string",role:"style"},"Style 16 x86_64");date_values=[];for(i=1;12>=i;i++)month=e.getMonth(),year=e.getFullYear(),date_to_add=new Date(year,month),g.push(date_to_add),date_values.push([date_to_add,b[i-1]["15_i386"],"color:purple",b[i-1]["15_x86_64"],"color:gold",b[i-1]["16_i386"],"color:teal",b[i-1]["16_x86_64"],"color:olive"]),e.setMonth(month-1);
     11d.addRows(date_values);return{data:d,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:g,format:"MMM"},vAxis:{title:"Num hosts"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:["purple","gold","teal","olive"],lineWidth:5}}}
     12function build_data_per_month_mem(c,a){for(var b=[],g=["2G","4G","8G"],e=0;12>e;e++){b[e]={"15_2G":0,"15_4G":0,"15_8G":0,"16_2G":0,"16_4G":0,"16_8G":0};for(var d in g)if(c[g[d]][e])for(var f in c[g[d]][e])b[e][f+"_"+g[d]]+=c[g[d]][e][f]}g=[];d=new Date;f=new google.visualization.DataTable;f.addColumn({type:"date",role:"domain"},"Date");f.addColumn("number","Total 15 < 2G");f.addColumn({type:"string",role:"style"},"Style 15 < 2G");f.addColumn("number","Total 15 < 4G");f.addColumn({type:"string",role:"style"},
     13"Style 15 < 4G");f.addColumn("number","Total 15 > 4G");f.addColumn({type:"string",role:"style"},"Style 15 > 4G");f.addColumn("number","Total 16 < 2G");f.addColumn({type:"string",role:"style"},"Style 16 < 2G");f.addColumn("number","Total 16 < 4G");f.addColumn({type:"string",role:"style"},"Style 16 < 4G");f.addColumn("number","Total 16 > 4G");f.addColumn({type:"string",role:"style"},"Style 16 > 4G");date_values=[];for(e=1;12>=e;e++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),
     14g.push(date_to_add),date_values.push([date_to_add,b[e-1]["15_2G"],"color:purple",b[e-1]["15_4G"],"color:gold",b[e-1]["15_8G"],"color:teal",b[e-1]["16_2G"],"color:olive",b[e-1]["16_4G"],"color:red",b[e-1]["16_8G"],"color:pink"]),d.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:g,format:"MMM"},vAxis:{title:"Num hosts"},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"purple gold teal olive red pink".split(" "),
     15lineWidth:5}}}
     16function build_data_per_month_cpu(c,a){for(var b=[],g=["mono","dualquad","more"],e=0;12>e;e++){b[e]={"15_mono":0,"15_dualquad":0,"15_more":0,"16_mono":0,"16_dualquad":0,"16_more":0};for(var d in g)if(c[g[d]][e])for(var f in c[g[d]][e])b[e][f+"_"+g[d]]+=c[g[d]][e][f]}g=[];d=new Date;f=new google.visualization.DataTable;f.addColumn({type:"date",role:"domain"},"Date");f.addColumn("number","Total 15 mono processor");f.addColumn({type:"string",role:"style"},"Style 15 mono processor");f.addColumn("number","Total 15 dual or quad processor");
     17f.addColumn({type:"string",role:"style"},"Style 15 dual or quad processor");f.addColumn("number","Total 15 more than quad processor");f.addColumn({type:"string",role:"style"},"Style 15 more than quad processor");f.addColumn("number","Total 16 mono processor");f.addColumn({type:"string",role:"style"},"Style 16 mono processor");f.addColumn("number","Total 16 dual or quad processor");f.addColumn({type:"string",role:"style"},"Style 16 dual or quad processor");f.addColumn("number","Total 16 more than quad processor");
     18f.addColumn({type:"string",role:"style"},"Style 16 more than quad processor");date_values=[];for(e=1;12>=e;e++)month=d.getMonth(),year=d.getFullYear(),date_to_add=new Date(year,month),g.push(date_to_add),date_values.push([date_to_add,b[e-1]["15_mono"],"color:purple",b[e-1]["15_dualquad"],"color:gold",b[e-1]["15_more"],"color:teal",b[e-1]["16_mono"],"color:olive",b[e-1]["16_dualquad"],"color:red",b[e-1]["16_more"],"color:pink"]),d.setMonth(month-1);f.addRows(date_values);return{data:f,options:{title:a,
     19curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:g,format:"MMM"},vAxis:{title:"Num hosts",viewWindow:{min:0}},legend:{textStyle:{fontSize:10}},chartArea:{left:"5%",right:"10%"},focusTarget:"category",colors:"purple gold teal olive red pink".split(" "),lineWidth:5}}}
     20function build_data_from_array(c,a){var b=[],g=new Date,e=new google.visualization.DataTable;e.addColumn({type:"date",role:"domain"},"Nhosts");e.addColumn("number",a);date_values=[];for(i=1;12>=i;i++)month=g.getMonth(),year=g.getFullYear(),date_to_add=new Date(year,month),b.push(date_to_add),date_values.push([date_to_add,c[i-1]]),g.setMonth(month-1);e.addRows(date_values);return{data:e,options:{title:a,curveType:"function",isStacked:!1,hAxis:{title:"Months",ticks:b,format:"MMM"},vAxis:{title:"Num hosts",
    1021minValue:0,maxValue:"automatic",viewWindowMode:"pretty",viewWindow:{min:0,max:"auto"}},legend:{textStyle:{fontSize:10}},chartArea:{left:"10%",right:"10%"},focusTarget:"category",lineWidth:5}}}
    1122function doExtendedChart(){end_load_time=get_time();var c=window.location.search.substr(1);""!=c&&(c="?"+c);var a={};start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');$.getJSON("./GetExtendedStats"+c,function(b){start_graph_time=end_get_time=get_time();var c=null;for(key in b){if("clients"==key)for(type in b[key])switch(type){case "clients_per_month":a[type]={};a[type].title="Machines";a[type].releases={};a[type].releases.graph=build_data_per_month_releases(b[key][type],
    1223"Number machines by release per month");a[type].releases.title="Number machines by release per month";a[type].flavours={};a[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Number machines by flavour per month");a[type].flavours.title="Number machines by flavour per month";break;case "freq_updates_per_month":a[type]={};a[type].title="Updates";a[type].releases={};a[type].releases.graph=build_data_per_month_releases(b[key][type],"Number updates by release per month");a[type].releases.title=
    1324"Number updates by release per month";a[type].flavours={};a[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Number updates by flavour per month");a[type].flavours.title="Number updates by flavour per month";break;case "change_releases":a.changes||(a.changes={},a.changes.title="Changes");a.changes.releases||(a.changes.releases={});a.changes.releases.graph=build_data_from_array(b[key][type],"Change releases per month");a.changes.releases.title="Change releases per month";break;case "change_flavours":a.changes||
    14 (a.changes={},a.changes.title="Changes"),a.changes.flavours||(a.changes.flavours={}),a.changes.flavours.graph=build_data_from_array(b[key][type],"Change flavours per month"),a.changes.flavours.title="Change flavours per month"}if("apps"==key)for(type in b.apps)switch(type){case "app":c=b.apps[type];break;case "app_use":b[key][type]&&(a[type]={},a[type].title="Application usage",a[type].releases={},a[type].releases.graph=build_data_per_month_releases(b[key][type],"Application use by release per month ("+
    15 c+")"),a[type].releases.title="Use per month for application "+c,a[type].flavours={},a[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Application use by flavour per month ("+c+")"),a[type].flavours.title="Use per month for application "+c)}key.startsWith("debug")&&("debug_query_time"==key&&(query_time=b[key]),"debug_keep_alive"==key&&(keep_alive=b[key]))}for(chart_type in a)if(a[chart_type].title)for(chart_variant in a[chart_type])"title"==chart_variant?$("#accordion").append('<h3 class="'+
    16 chart_type+'">'+a[chart_type].title+'</h3><div id="'+chart_type+'"></div>'):a[chart_type][chart_variant].graph&&($("#"+chart_type).append("<div id="+chart_type+"_"+chart_variant+"></div>"),b=get_sizes(chart_type),a[chart_type][chart_variant].graph.options.width=b.width,a[chart_type][chart_variant].graph.options.height=b.height,(new google.visualization.LineChart(document.getElementById(chart_type+"_"+chart_variant))).draw(a[chart_type][chart_variant].graph.data,a[chart_type][chart_variant].graph.options));
    17 $("#loading").remove();$("#accordion").accordion({active:!1,collapsible:!0});null!=c&&$(".app_use").click();end_graph_time=get_time();print_stats(end_graph_time,query_time)})}
     25(a.changes={},a.changes.title="Changes");a.changes.flavours||(a.changes.flavours={});a.changes.flavours.graph=build_data_from_array(b[key][type],"Change flavours per month");a.changes.flavours.title="Change flavours per month";break;case "architectures":a.architectures||(a.architectures={},a.architectures.title="Architectures");a.architectures.releases||(a.architectures.releases={});a.architectures.releases.graph=build_data_per_month_arch(b[key][type],"Architectures by release per month");a.architectures.releases.title=
     26"Architectures distribution";break;case "mem":a.mem||(a.mem={},a.mem.title="Memory");a.mem.releases||(a.mem.releases={});a.mem.releases.graph=build_data_per_month_mem(b[key][type],"Memory by release per month");a.mem.releases.title="Memory distribution";break;case "cpu":a.cpu||(a.cpu={},a.cpu.title="CpuS"),a.cpu.releases||(a.cpu.releases={}),a.cpu.releases.graph=build_data_per_month_cpu(b[key][type],"Number CpuS by release per month"),a.cpu.releases.title="Number CpuS distribution"}if("apps"==key)for(type in b.apps)switch(type){case "app":c=
     27b.apps[type];break;case "app_use":b[key][type]&&(a[type]={},a[type].title="Application usage",a[type].releases={},a[type].releases.graph=build_data_per_month_releases(b[key][type],"Application use by release per month ("+c+")"),a[type].releases.title="Use per month for application "+c,a[type].flavours={},a[type].flavours.graph=build_data_per_month_flavours(b[key][type],"Application use by flavour per month ("+c+")"),a[type].flavours.title="Use per month for application "+c)}key.startsWith("debug")&&
     28("debug_query_time"==key&&(query_time=b[key]),"debug_keep_alive"==key&&(keep_alive=b[key]))}for(chart_type in a)if(a[chart_type].title)for(chart_variant in a[chart_type])"title"==chart_variant?$("#accordion").append('<h3 class="'+chart_type+'">'+a[chart_type].title+'</h3><div id="'+chart_type+'"></div>'):a[chart_type][chart_variant].graph&&($("#"+chart_type).append("<div id="+chart_type+"_"+chart_variant+"></div>"),b=get_sizes(chart_type),a[chart_type][chart_variant].graph.options.width=b.width,a[chart_type][chart_variant].graph.options.height=
     29b.height,(new google.visualization.LineChart(document.getElementById(chart_type+"_"+chart_variant))).draw(a[chart_type][chart_variant].graph.data,a[chart_type][chart_variant].graph.options));$("#loading").remove();$("#accordion").accordion({active:!1,collapsible:!0});null!=c&&$(".app_use").click();end_graph_time=get_time();print_stats(end_graph_time,query_time)})}
    1830function doChart(c){c=void 0===c?"":c;end_load_time=get_time();var a=new google.visualization.DataTable;a.addColumn("string","App");a.addColumn("number","Count");a=new google.visualization.DataTable;a.addColumn("string","App");a.addColumn("number","Count");a=new google.visualization.DataTable;a.addColumn("string","App");a.addColumn("number","Count");start_get_time=get_time();$("#accordion").append('<div id="loading"></div>');console.log(c);""==c?(url="./GetStats",limit=10):(url="./GetLliurexStats",
    1931limit=1E3);$.getJSON(url,function(a){start_graph_time=end_get_time=get_time();count=0;for(key in a)if(!key.startsWith("debug"))for(key2 in a[key])count++;max_graph=3*count;obj=[];for(distro in a)if(distro.startsWith("debug"))"debug_query_time"==distro&&(query_time=a[distro]),"debug_keep_alive"==distro&&(keep_alive=a[distro]);else for(sabor in a[distro])for(titles=["Top apps este mes","Top apps ultimo mes","Top apps penultimo mes"],divname="chart_"+distro+"_"+sabor,$("#accordion").append("<h3>Distro "+
  • lliurex-analytics-server/trunk/fuentes/lliurex-analytics-server/usr/lib/analytics-server/update_allow_platformdata.sql

    r6819 r6884  
    77ALTER TABLE `Client_Versions` ADD `arch` VARCHAR(10) NULL DEFAULT NULL AFTER `string_flavour`, ADD `mem` INT UNSIGNED NULL DEFAULT NULL AFTER `arch`, ADD `vga` VARCHAR(80) NULL DEFAULT NULL AFTER `mem`, ADD `cpu` VARCHAR(80) NULL DEFAULT NULL AFTER `vga`, ADD `ncpu` TINYINT UNSIGNED NULL DEFAULT NULL AFTER `cpu`;
    88
     9ALTER TABLE `PackagesWhitelist` ADD `status` BOOLEAN NULL DEFAULT NULL AFTER `name`;
     10
    911commit;
Note: See TracChangeset for help on using the changeset viewer.