--- /dev/null
+#!/usr/bin/php
+<?php
+
+$simulation = 7;
+
+$hps = 24;
+
+$dir = dirname(__FILE__);
+$cts = scandir($dir);
+natsort($cts);
+$graph = array();
+
+foreach($cts as $ct){
+
+ $ndir = $dir . '/' . $ct;
+
+ if(is_dir($ndir)){
+ $v = explode('-',$ct,2);
+ if($v[0] == $simulation){
+
+ if(isset($v[1])){
+
+ $breadth = (int) $v[1];
+
+ $hosts = $breadth * $breadth * $hps;
+
+ $eth = $ndir . '/ethernet/static/analysis';
+ $moose = $ndir . '/moose/static/analysis';
+
+ if(file_exists($eth)){
+
+ if(file_exists($moose)){
+
+ $data = file($eth);
+
+ $mode = 0; // 0 <= STATE;
+
+ foreach($data as $data){
+ if($mode == 0){
+ if(trim($data) == "State Table"){
+ $mode = 1;
+ }
+ } elseif($mode == 1) {
+ $addr = trim($data);
+ $mode = 2;
+ } elseif($mode == 2){
+ $w = explode("\t", trim($data));
+ if(trim($w[0]) == 'Entries' && isset($w[1])){
+ if(!isset($graph['ethernet'][$breadth])){
+ $graph['ethernet'][$breadth] = 0;
+ }
+ $val = (int) trim($w[1]);
+ if($val > $graph['ethernet'][$breadth]){
+ $graph['ethernet'][$breadth] = $val;
+ }
+ $mode = 3;
+ } else {
+ $mode = 1;
+ }
+ } else {
+ $mode = 1;
+ }
+ }
+
+ $data = file($moose);
+
+ $mode = 0; // 0 <= STATE;
+
+ foreach($data as $data){
+ if($mode == 0){
+ if(trim($data) == "State Table"){
+ $mode = 1;
+ }
+ } elseif($mode == 1) {
+ $addr = trim($data);
+ $mode = 2;
+ } elseif($mode == 2){
+ $w = explode("\t", trim($data));
+ if(trim($w[0]) == 'Hosts' && isset($w[1])){
+ if(!isset($graph['moose']['hosts'][$breadth])){
+ $graph['moose']['hosts'][$breadth] = 0;
+ }
+ $val = (int) trim($w[1]);
+ if($val > $graph['moose']['hosts'][$breadth]){
+ $graph['moose']['hosts'][$breadth] = $val;
+ }
+ $mode = 3;
+ } else {
+ $mode = 1;
+ }
+ } elseif($mode == 3){
+ $w = explode("\t", trim($data));
+ if(trim($w[0]) == 'Switches' && isset($w[1])){
+ if(!isset($graph['moose']['switches'][$breadth])){
+ $graph['moose']['switches'][$breadth] = 0;
+ }
+ $val = (int) trim($w[1]);
+ if($val > $graph['moose']['switches'][$breadth]){
+ $graph['moose']['switches'][$breadth] = $val;
+ }
+ $mode = 4;
+ } else {
+ $mode = 1;
+ }
+ } elseif($mode == 4){
+ $w = explode("\t", trim($data));
+ if(trim($w[0]) == 'Total' && isset($w[1])){
+ if(!isset($graph['moose']['total'][$breadth])){
+ $graph['moose']['total'][$breadth] = 0;
+ }
+ $val = (int) trim($w[1]);
+ if($val > $graph['moose']['total'][$breadth]){
+ $graph['moose']['total'][$breadth] = $val;
+ }
+ $mode = 5;
+ } else {
+ $mode = 1;
+ }
+ } else {
+ $mode = 1;
+ }
+ }
+
+ } } } } }
+}
+
+foreach($graph['ethernet'] as $k => $v){
+ $h = $k * $k * $hps;
+ echo "$h $v {$graph['moose']['total'][$k]} {$graph['moose']['hosts'][$k]} {$graph['moose']['switches'][$k]}\r\n";
+}
+