Esempio n. 1
0
function process_files($files, $host = "2016")
{
    $merger = new CSV_merger();
    $summary = new Group_Summary();
    foreach ($files as $file) {
        $stats = new VT_stats_top12();
        $stats->load_file($file, $host);
        $grouper = $stats->count_things();
        //$grouper = $stats->count_things_differently();
        $grouper->report_total();
        $summary->add_group($file, $grouper->total, $grouper->total_time);
        //$merger->append( $grouper->elapsed );
        $merger->append($grouper->percentages);
        //$merger->append( $grouper->groups );
    }
    $merger->report_count();
    echo "Elapsed," . implode($files, ",") . PHP_EOL;
    $merger->sort();
    $merger->report();
    $merger->accum();
    echo "Accum," . implode($files, ",") . PHP_EOL;
    $merger->report_accum();
    $summary->report();
}
Esempio n. 2
0
 /**
  * Count all the things we want to count by grouping on key values. 
  * 
  * We may need to convert the actual value into a subset.
  * For the grouping fields see class-vt-row.php
  * 
  * 
  * Key        | Subset  | What this shows
  * ---------- | -------  | ---------------------------------------
  * plugins    | null    | Group by number of active plugins          = 41
  * files      | 			  |	ranges from 446 to 556
  * queries		|				  |	ranges from 16 to 1081 - with some large gaps
  * elapsed    |	elapsed |
  * 
  */
 function count_things()
 {
     $grouper = new Object_Grouper();
     echo "Grouping: " . count($this->rows) . PHP_EOL;
     $grouper->populate($this->rows);
     $grouper->subset(null);
     $grouper->groupby("suri");
     $grouper->arsort();
     $this->having = 100;
     $grouper->having(array($this, "having_filter_value_ge"));
     $grouper->report_groups();
     // The 'tl' part of suritl stands for top level not term last!
     $grouper->time_field("final");
     $grouper->subset(null);
     $grouper->groupby("suritl");
     // we can't sort and expect the elapsed total to be sorted too
     // so in the mean time don't sort here
     // $grouper->arsort();
     //$grouper->report_percentages();
     // Also there's a bug in report_percentages when mixed with time_field
     // it calculates the average from the percentage figure not the count.
     $grouper->having(array($this, "having_filter_value_ge"));
     $this->having = count($this->rows) / 100;
     $grouper->report_groups();
     $this->having = 0.05;
     $grouper->report_percentages();
     /**
     		$grouper->subset();
     		$grouper->groupby( "files" );
     		$grouper->ksort();
     		$grouper->report_groups();
     $grouper->subset();
     		$grouper->groupby( "queries" );
     		$grouper->ksort();
     		$grouper->report_groups();
     $grouper->subset();
     		$grouper->groupby( "remote_IP" );
     		$grouper->ksort();
     		$grouper->report_groups();
     */
     $grouper->having();
     $grouper->time_field();
     $grouper->groupby("elapsed", array($this, "elapsed"));
     $grouper->ksort();
     $grouper->report_groups();
     $grouper->time_field();
     $grouper->groupby("final", array($this, "elapsed"));
     $grouper->ksort();
     $grouper->report_percentages();
     $merger = new CSV_merger();
     $merger->append($grouper->groups);
     $merger->append($grouper->percentages);
     echo "Merged report:" . PHP_EOL;
     $merger->report();
     /**
      * Produce a chart comparing the execution times for each month. 
      * with the total count converted to percentages to enable easier visual comparison
      * 
      */
     $grouper->where(array($this, "month_filter"));
     $merger = new CSV_merger();
     for ($this->month = 10; $this->month <= 12; $this->month++) {
         $grouper->groupby("final", array($this, "elapsed"));
         $grouper->percentages();
         $merger->append($grouper->percentages);
     }
     $merger->report();
 }
Esempio n. 3
0
<?php

// (C) Copyright Bobbing Wide 2015
oik_require("class-CSV-merger.php", "play");
$merger = new CSV_merger();
$fred = array("a" => "fred", "b" => "blogs");
$hilma = array("a" => "hilma", "b" => "blogs2");
$merger->append($fred);
$merger->append($hilma);
$merger->report();