gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14482 - gauger


From: gnunet
Subject: [GNUnet-SVN] r14482 - gauger
Date: Tue, 22 Feb 2011 00:19:00 +0100

Author: bartpolot
Date: 2011-02-22 00:19:00 +0100 (Tue, 22 Feb 2011)
New Revision: 14482

Modified:
   gauger/explore.php
   gauger/plot.php
Log:
Changed data store directory


Modified: gauger/explore.php
===================================================================
--- gauger/explore.php  2011-02-21 21:08:32 UTC (rev 14481)
+++ gauger/explore.php  2011-02-21 23:19:00 UTC (rev 14482)
@@ -1,5 +1,7 @@
 <?php
 
+$DATADIR = "data/";
+
 function get_counter_name($s) {
     $s = str_replace('-SLASH-', '/', $s);
     return preg_replace('/([^_]+).*/', '\1', $s);
@@ -14,15 +16,17 @@
 }
 
 function get_range_global() {
-    $f = fopen("global_range.dat", 'r');
+    global $DATADIR;
+    $f = fopen($DATADIR.'global_range.dat', 'r');
     $buffer = fgets($f, 512);
     fclose($f);
     return explode(' ', $buffer);
 }
 
 function get_range($host, $counter) {
+    global $DATADIR;
     if(empty($host) || empty($counter)) return get_range_global();
-    $f = @fopen("$host/$counter.dat", 'r');
+    $f = @fopen("$DATADIR$host/$counter.dat", 'r');
     if ($f === false) return get_range_global();
     $b = false;
     while (($buffer = fgets($f, 512)) !== false) {
@@ -35,15 +39,16 @@
     return Array($b, $e);
 }
 
-$d = dir(".");
+$d = dir($DATADIR);
 $hosts = array();
 $metrics = array();
 while (false !== ($entry = $d->read())) {
-    if (is_dir($entry) && !($entry[0] == ".")) {
+    if (is_dir($DATADIR.$entry) && !($entry[0] == ".")) {
         $hosts[$entry] = array();
-        $d2 = dir($entry);
+        $d2 = dir($DATADIR.$entry);
         while (false !== ($counter = $d2->read())) {
-            if (preg_match("/(\.|~)/", $counter) === 0) { // Do not include 
files containing dots or tildes
+            // Do not include files containing dots or tildes or incomplete 
files
+            if (preg_match("/(\.|~)/", $counter) === 0 && 
is_file("$DATADIR$entry/$counter.dat")) {
                 $hosts[$entry][] = $counter;
                 $metrics[$counter] = get_counter_name($counter);
             }
@@ -51,6 +56,6 @@
     }
 }
 $d->close();
-// echo '<pre>';
-// print_r($metrics);
-// die();
+echo '<pre>';
+print_r(parse_ini_file("bo.conf"));
+die();

Modified: gauger/plot.php
===================================================================
--- gauger/plot.php     2011-02-21 21:08:32 UTC (rev 14481)
+++ gauger/plot.php     2011-02-21 23:19:00 UTC (rev 14482)
@@ -7,6 +7,7 @@
  */
 function plot($g, $h) {
     global $hosts;
+    global $DATADIR;
 
     $cmd =  'load "header.gp";';
     $cmd .=  ' set terminal png size ';
@@ -57,14 +58,14 @@
             }
             $counter = get_counter_name($graph);
             if($c) $plotcmd .= ',';
-            $plotcmd .= " \"$host/$graph.dat\"";
+            $plotcmd .= " \"$DATADIR$host/$graph.dat\"";
             $plotcmd .= " title \"";
             if($ch != 1) $plotcmd .= $host;
             if($ch != 1 && $cg != 1) $plotcmd .= " - ";
             if($cg != 1) $plotcmd .= $counter;
             $plotcmd .= "\"";
             $plotcmd .= " with lines lw 2";
-            if($ch == 1 && $cg == 1) $plotcmd .= ", \"$host/$graph.dat\" 
notitle with yerrorbars lw 1";
+            if($ch == 1 && $cg == 1) $plotcmd .= ", 
\"$DATADIR$host/$graph.dat\" notitle with yerrorbars lw 1";
             $c++;
             if($x_min == '*') {
                 $r = get_range($host, $graph);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]