projects / phoronix-test-suite.git / commitdiff
Build Results
 
Summary

Description: Phoronix Test Suite open-source benchmarking development
Last Change: Tue 10/28/14 19:38

Recent Commits
Time
Signed-Off By
Description
Commit Diff
Tue 10/28/14 19:38
Michael Larabel  
pts-core: Add 3840 x 2160... 
Sat 10/25/14 20:09
Michael Larabel  
phoromatic: Implement... 
Sat 10/25/14 20:02
Michael Larabel  
phoromatic: Improve... 
Fri 10/24/14 15:59
Michael Larabel  
phoromatic: 4 username... 
Fri 10/24/14 12:06
Michael Larabel  
phoromatic: Add today's... 
Fri 10/24/14 11:52
Michael Larabel  
phoromatic: Add a... 
 
> --git a/README b/README
index c0455ef
..d041b93 100644
--- a/README
+++ b/README
@@ -6,+6,@@ Phoronix Test Suite is licensed under the GNU GPLv3See COPYING file for more d

 Patches
, new profilesetc welcomeNon-technical support messages can be directed to phoronix [atphoronix.com.

+
The default font that ships with the Phoronix Test Suite for the results graphing is from the DejaVu font collectionhttp://dejavu.sourceforge.net/
+
 
LINKS:

 
Check Out This Link To See What The Phoronix Test Suite Is All About (GuideAnnouncement, & More): http://www.phoronix.com/scan.php?page=article&item=phoronix_pts&num=1
diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php
index 7f73c26
..b0ae0dc 100644
--- a/pts-core/functions/pts-functions.php
+++ b/pts-core/functions/pts-functions.php
@@ -40,+40,@@ define("DISTRO_XML_LOCATION""pts/distro-xml/");
 
define("DISTRO_SCRIPT_LOCATION""pts/distro-scripts/");
 
define("BENCHMARK_RESOURCE_LOCATION""pts/benchmark-resources/");
 
define("PTS_USER_DIR"pts_find_home("~/.phoronix-test-suite/"));
+
//define("FONT_DIRECTORY" "/usr/share/fonts/");

 
pts_user_config_init();
 
define("BENCHMARK_ENVIRONMENT"pts_find_home(pts_read_user_config("PhoronixTestSuite/Options/Benchmarking/EnvironmentDirectory""~/.phoronix-test-suite/installed-tests/")));
@@ -
151,+152,@@ function pts_save_result($save_to null$save_results null$directory nul
         mkdir
($directory "pts-results-viewer");
     }

-    
//pts_copy("pts-core/pts-results-viewer/phoronix-test-suite.gif", $directory . "pts-results-viewer/phoronix-test-suite.gif");
     
pts_copy("pts-core/pts-results-viewer/pts.js"$directory "pts-results-viewer/pts.js");
     
pts_copy("pts-core/pts-results-viewer/pts-results-viewer.xsl"$directory "pts-results-viewer/pts-results-viewer.xsl");
     
pts_copy("pts-core/pts-results-viewer/pts-viewer.css"$directory "pts-results-viewer/pts-viewer.css");
@@ -
163,67 +163,64 @@ function pts_save_result($save_to null$save_results null$directory nul
         $bool 
true;
     else
     {
-        
// Create graphs locally or remotely
+        $save_name basename($save_to".xml");

-    
/*    if(!extension_loaded("gd"))
+        if($save_name == "composite")
         {
-            if(dl("gd.so"))
+            if(!extension_loaded("gd"))
             {
-                $gd_available = true;
+            /*    if(dl("gd.so"))
+                {
+                    $gd_available = true;
+                }
+                else    */
+                    $gd_available false;
+                    echo 
"The PHP GD extension must be loaded in order for the graphs to display!";
             }
             else
-                
$gd_available false;
-        }
-        else
-            
$gd_available true;
-
-        if(
$gd_available)
-        {
-            if(!
is_dir($directory "result-graphs"))
-            {
-                
mkdir($directory "result-graphs");
-            }
-
-            
$basename basename($save_to".xml");
-            if(!
is_dir($directory "result-graphs" $basename))
-            {
-                
mkdir($directory "result-graphs" $basename);
-            }
-
-            
$xml_reader = new tandem_XmlReader($save_results);
-            
$results_name $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Name");
-            
$results_version $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Version");
-            
$results_attributes $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Attributes");
-            
$results_scale $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Scale");
-            
$results_proportion $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Proportion");
-            
$results_result_format $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/ResultFormat");
-            
$results_raw $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Results");
-
-            
$results_identifiers = array();
-            
$results_values = array();
-
-            foreach(
$results_raw as $result_raw)
-            {
-                
$xml_results = new tandem_XmlReader($result_raw);
-                
array_push($results_identifiers$xml_results->getXMLArrayValues("Group/Entry/Identifier"));
-                
array_push($results_values$xml_results->getXMLArrayValues("Group/Entry/Value"));
-            }
+                
$gd_available true;

-            for(
$i 0$i count($results_name); $i++)
+            if(
$gd_available)
             {
-                if(
strlen($results_version[$i]) > 2)
-                    
$results_name[$i] .= " v" $results_version[$i];
-
-                
$t = new pts_BarGraph($results_name[$i], $results_attributes[$i], $results_scale[$i]);
-                
$t->loadGraphIdentifiers($results_identifiers[$i]);
-                
$t->loadGraphValues($results_values[$i], "#1");
-                
$t->save_graph($directory "result-graphs" $basename "/" . ($i 1) . ".png");
-                
$t->renderGraph();
+                if(!
is_dir($save_to_dir "/result-graphs"))
+                {
+                    
mkdir($save_to_dir "/result-graphs");
+                }
+
+                
$xml_reader = new tandem_XmlReader($save_results);
+                
$results_name $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Name");
+                
$results_version $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Version");
+                
$results_attributes $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Attributes");
+                
$results_scale $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Scale");
+                
$results_proportion $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Proportion");
+                
$results_result_format $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/ResultFormat");
+                
$results_raw $xml_reader->getXMLArrayValues("PhoronixTestSuite/Benchmark/Results");
+
+                
$results_identifiers = array();
+                
$results_values = array();
+
+                foreach(
$results_raw as $result_raw)
+                {
+                    
$xml_results = new tandem_XmlReader($result_raw);
+                    
array_push($results_identifiers$xml_results->getXMLArrayValues("Group/Entry/Identifier"));
+                    
array_push($results_values$xml_results->getXMLArrayValues("Group/Entry/Value"));
+                }
+
+                for(
$i 0$i count($results_name); $i++)
+                {
+                    if(
strlen($results_version[$i]) > 2)
+                        
$results_name[$i] .= " v" $results_version[$i];
+
+                    
$t = new pts_BarGraph($results_name[$i], $results_attributes[$i], $results_scale[$i]);
+                    
$t->loadGraphIdentifiers($results_identifiers[$i]);
+                    
$t->loadGraphValues($results_values[$i], "#1");
+                    
$t->save_graph($save_to_dir "/result-graphs/" . ($i 1) . ".png");
+                    
$t->renderGraph();
+                }
+
+                unset(
$xml_reader$results_name$results_version$results_attributes$results_scale$results_proportion$results_result_format$results_raw$results_identifiers$results_values);
             }
-
-            unset(
$xml_reader$results_name$results_version$results_attributes$results_scale$results_proportion$results_result_format$results_raw$results_identifiers$results_values);
         }
-         */

         
$bool file_put_contents($directory $save_to$save_results);
     }
diff --git a/pts-core/objects/object_pts_BarGraph.php b/pts-core/objects/object_pts_BarGraph.php
deleted file mode 100644
index 41796f8
..0000000
--- a/pts-core/objects/object_pts_BarGraph.php
+++ /dev/null
@@ -1,114 +0,@@
-<?
php
-
-
/*
-   Copyright (C) 2008, Michael Larabel.
-   Copyright (C) 2008, Phoronix Media.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-class 
pts_BarGraph extends pts_Graph
-{
-    public function 
__construct($Title$SubTitle$YTitle)
-    {
-        
parent::__construct($Title$SubTitle$YTitle);
-        
$this->graph_type "BAR_GRAPH";
-    }
-    protected function 
render_graph_identifiers()
-    {
-        
$identifier_count count($this->graph_identifiers);
-        
$graph_width $this->graph_left_end $this->graph_left_start;
-        
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
-
-        
$px_from_top_start $this->graph_top_end 5;
-        
$px_from_top_end $this->graph_top_end 5;
-
-        
$longest_string $this->find_longest_string($this->graph_identifiers);
-        
$font_size $this->graph_font_size_identifiers;
-
-        while(
$this->return_ttf_string_width($longest_string$this->graph_font$font_size) > ($identifier_width 3))
-            
$font_size -= 0.5;
-
-        for(
$i 0$i $identifier_count$i++)
-        {
-            
$px_bound_left $this->graph_left_start + ($identifier_width $i);
-            
$px_bound_right $this->graph_left_start + ($identifier_width * ($i 1));
-
-            if(
$i == 0)
-                
imageline($this->graph_image$px_bound_left$px_from_top_start$px_bound_left$px_from_top_end$this->graph_color_notches);
-
-            
imageline($this->graph_image$px_bound_right$px_from_top_start$px_bound_right$px_from_top_end$this->graph_color_notches);
-
-            
$this->gd_write_text_center($this->graph_identifiers[$i], $font_size$this->graph_color_headers$px_bound_left ceil($identifier_width 2), $px_from_top_end 1FALSETRUE);
-        }
-    }
-    protected function 
render_graph_bars()
-    {
-        
$identifier_count count($this->graph_identifiers) + 1;
-        
$graph_width $this->graph_left_end $this->graph_left_start;
-        
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
-        
$bar_count count($this->graph_data);
-        
$bar_width floor($identifier_width $bar_count);
-
-        
$font_size $this->graph_font_size_bars;
-
-        while(
$this->return_ttf_string_width(bcdiv($this->graph_maximum_value13), $this->graph_font$font_size) > ($bar_width 6))
-            
$font_size -= 0.5;
-
-        for(
$i_o 0$i_o $bar_count$i_o++)
-        {
-            
$paint_color $this->next_paint_color();
-
-            for(
$i 0$i count($this->graph_data[$i_o]); $i++)
-            {
-                
$value $this->graph_data[$i_o][$i];
-                
$graph_size round(($value $this->graph_maximum_value) * ($this->graph_top_end $this->graph_top_start));
-                
$value_plot_top $this->graph_top_end $graph_size;
-
-                
$identifier_count count($this->graph_data[$i_o]);
-                
$graph_width $this->graph_left_end $this->graph_left_start;
-                
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
-                
$bar_width floor($identifier_width $bar_count);
-                
$px_bound_left $this->graph_left_start + ($identifier_width $i)  + ($bar_width $i_o) + 2;
-                
$px_bound_right $this->graph_left_start + ($identifier_width * ($i 1)) - ($bar_width * ($bar_count $i_o 1));
-
-                if(
$i_o == 0)
-                    
$size_diff_left 5;
-                else
-                    
$size_diff_left 0;
-
-                if((
$i_o 1) == $bar_count)
-                    
$size_diff_right 5;
-                else
-                    
$size_diff_right 0;
-
-                if(
$value_plot_top 1)
-                    
$value_plot_top 1;
-
-                
imagerectangle($this->graph_image$px_bound_left $size_diff_left$value_plot_top 1$px_bound_right $size_diff_right$this->graph_top_end 1$this->graph_color_body_light);
-                
imagefilledrectangle($this->graph_image$px_bound_left $size_diff_left 1$value_plot_top$px_bound_right $size_diff_right 1$this->graph_top_end 1$paint_color);
-                
$value bcdiv($value12);
-
-                if(
$graph_size 20)
-                    
$this->gd_write_text_center($this->graph_data[$i_o][$i], $font_size$this->graph_color_body_text$px_bound_left + (($px_bound_right $px_bound_left) / 2), $value_plot_top 3);
-            }
-        }
-    }
-    protected function 
render_graph_result()
-    {
-        
$this->render_graph_bars();
-    }
-}
-
-
?>
diff --git a/pts-core/objects/object_pts_Graph.php b/pts-core/objects/object_pts_Graph.php
deleted file mode 100644
index 55f58dc..0000000
--- a/pts-core/objects/object_pts_Graph.php
+++ /dev/null
@@ -1,431 +0,0 @@
-<?php
-
-
/*
-   Copyright (C) 2008, Michael Larabel.
-   Copyright (C) 2008, Phoronix Media.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-class 
pts_Graph
-{
-    
// Defaults
-    var $graph_attr_marks 6// Number of marks to make on vertical axis
-    var $graph_attr_width 580// Graph width
-    var $graph_attr_height 300// Graph height
-    var $graph_attr_big_border FALSE// Border around graph or not
-
-    var 
$graph_left_start 27// Distance in px to start graph from left side
-    var $graph_left_end_opp 10// Distance in px to end graph from right side
-    var $graph_top_start 59// Distance in px to start graph from top side
-    var $graph_top_end_opp 22// Distance in px to end graph from bottom side
-
-    
// Colors
-    var $graph_color_notches "#000000"// Color for notches
-    var $graph_color_text "#000000"// Color for text
-    var $graph_color_border "#000000"// Color for border (if used)
-    var $graph_color_main_headers "#2b6b29"// Color of main text headers
-    var $graph_color_headers "#2b6b29"// Color of other headers
-    var $graph_color_background "#FFFFFF"// Color of background
-    var $graph_color_body "#8b8f7c"// Color of graph body
-    var $graph_color_body_text "#FFFFFF"// Color of graph body text
-    var $graph_color_body_light "#B0B59E"// Color of the border around graph bars (if doing a bar graph)
-
-    var 
$graph_color_paint = array("#3b433a""#bb2413""#ff9933""#006c00""#5028ca"); // Colors to use for the bars / lines, one color for each key
-
-    
// Text
-    var $graph_font "dejavu_sans.ttf"// TTF file name
-    var $graph_font_size_tick_mark 10// Tick mark size
-    var $graph_font_size_key 9// Size of height for keys
-    var $graph_font_size_heading 18// Font size of headings
-    var $graph_font_size_bars 12// Font size for text on the bars/objects
-    var $graph_font_size_identifiers 11// Font size of identifiers
-    var $graph_font_size_sub_heading 12// Font size of headers
-    var $graph_font_size_axis_heading 11// Font size of axis headers
-    var $graph_watermark_text "PHORONIX-TEST-SUITE.COM"// Text for watermark in upper right hand corner. If null, no watermark will display
-    var $graph_version "";
-    var 
$graph_proportion "";
-
-    
// CHANGE DIRECTORY FOR TTF FONT LOCATION INSIDE __construct FUNCTION
-
-    
// Not user-friendly changes below this line
-    var $graph_body_image FALSE;
-    var 
$graph_type "GRAPH";
-    var 
$graph_image;
-    var 
$graph_maximum_value;
-
-    var 
$graph_output null;
-    var 
$graph_data = array();
-    var 
$graph_data_title = array();
-    var 
$graph_color_paint_index = -1;
-    var 
$graph_identifiers;
-    var 
$graph_title;
-    var 
$graph_sub_title;
-    var 
$graph_y_title;
-    var 
$graph_top_end;
-    var 
$graph_left_end;
-
-    public function 
__construct($Title$SubTitle$YTitle)
-    {
-        
$this->graph_title $Title;
-        
$this->graph_sub_title $SubTitle;
-        
$this->graph_y_title $YTitle;
-
-        
$this->graph_top_end $this->graph_attr_height $this->graph_top_end_opp;
-        
$this->graph_left_end $this->graph_attr_width $this->graph_left_end_opp;
-
-        
// Directory for TTF Fonts
-        putenv("GDFONTPATH=" getcwd()); // The directory where the TTF font files should be. getcwd() will look in the same directory as this file
-    }
-
-    
//
-    // Load Functions
-    //
-
-    public function 
loadGraphIdentifiers($data_array)
-    {
-        
$this->graph_identifiers $data_array;
-    }
-    public function 
loadGraphVersion($data)
-    {
-        if(!empty(
$data))
-            
$this->graph_version "Phoronix Test Suite v" $data;
-    }
-    public function 
loadGraphProportion($data)
-    {
-        if(
$data == "LIB")
-            
$this->graph_proportion "* Less is better";
-        
//else if($data == "HIB")
-        //    $this->graph_proportion = "* More is better";
-    }
-    public function 
loadGraphData($data_array)
-    {
-        
loadGraphValues($data_array);
-    }
-    public function 
loadGraphValues($data_array$data_title NULL)
-    {
-        for(
$i 0$i count($data_array); $i++)
-            if(
is_float($data_array[$i]))
-                
$data_array[$i] = bcdiv($data_array[$i], 12);
-
-        
array_push($this->graph_data$data_array);
-        
array_push($this->graph_data_title$data_title);
-    }
-    public function 
setGraphBackgroundPNG($File)
-    {
-        
$IMG = @imagecreatefrompng($File);
-
-        if(
$IMG != FALSE)
-            
$this->graph_body_image $IMG;
-    }
-
-    
//
-    // Misc Functions
-    //
-
-    protected function 
next_paint_color()
-    {
-        if(
$this->graph_color_paint_index count($this->graph_color_paint))
-        {
-            
$this->graph_color_paint_index += 1;
-        }
-        else
-        {
-            
$this->graph_color_paint_index 0;
-        }
-
-        return 
$this->graph_color_paint[$this->graph_color_paint_index];
-    }
-    protected function 
reset_paint_index()
-    {
-        
$this->graph_color_paint_index = -1;
-    }
-    protected function 
maximum_graph_value()
-    {
-        
$maximum $this->graph_attr_marks;
-
-        foreach(
$this->graph_data as $graph_set)
-            foreach(
$graph_set as $set_item)
-                if(
$set_item $maximum)
-                    
$maximum $set_item;
-
-        return 
$maximum;
-    }
-    protected function 
convert_hex_to_gd($Hex)
-    {
-        return 
imagecolorallocate($this->graph_imagehexdec(substr($Hex12)), hexdec(substr($Hex32)), hexdec(substr($Hex52)));
-    }
-    protected function 
return_ttf_string_dimensions($String$Font$Size$Big FALSE)
-    {
-        
$box_array imagettfbbox($Size0$Font$String);
-        
$box_width $box_array[4] - $box_array[6];
-
-        if(
$Big)
-            
$box_array imagettfbbox($Size0$Font"AZ@![]()@|");
-        
$box_height $box_array[1] - $box_array[7];
-
-        
// Width x Height
-        return array($box_width$box_height);
-    }
-    protected function 
return_ttf_string_width($String$Font$Size)
-    {
-        
$dimensions $this->return_ttf_string_dimensions($String$Font$Size);
-        return 
$dimensions[0];
-    }
-    protected function 
gd_write_text_center($String$Size$Color$CenterX$CenterY$Rotate FALSE$Big FALSE)
-    {
-        if(empty(
$String))
-            return;
-
-        
$Font $this->graph_font;
-
-        
$ttf_dimensions $this->return_ttf_string_dimensions(strtoupper($String), $Font$Size$Big);
-        
$ttf_height $ttf_dimensions[1];
-
-        
$ttf_dimensions $this->return_ttf_string_dimensions($String$Font$Size$Big);
-        
$ttf_width $ttf_dimensions[0];
-
-        if(
$CenterX == "TRUE_CENTER")
-            
$CenterX $this->graph_attr_width 2;
-        else if(
$CenterX == "GRAPH_CENTER")
-            
$CenterX $this->return_graph_x_center();
-
-        if(
$Rotate == FALSE)
-        {
-            
$Rotation 0;
-            
$text_x $CenterX round($ttf_width 2);
-            
$text_y $CenterY $ttf_height;
-        }
-        else
-        {
-            
$Rotation 90;
-            
$text_x $CenterX $ttf_height;
-            
$text_y $CenterY round($ttf_width 2);
-        }
-
-        
imagettftext($this->graph_image$Size$Rotation$text_x$text_y$Color$Font$String);
-    }
-    protected function 
find_longest_string($arr_string)
-    {
-        
$longest_string "";
-        
$px_length 0;
-
-        foreach(
$arr_string as $one_string)
-            if((
$new_length strlen($one_string)) > strlen($longest_string))
-            {
-                
$longest_string $one_string;
-                
$px_length $new_length;
-            }
-        return 
$longest_string;
-    }
-    protected function 
return_graph_x_center()
-    {
-        return 
$this->graph_left_start + (($this->graph_left_end $this->graph_left_start) / 2);
-    }
-    protected function 
gd_write_text_right($String$Size$Color$RightX$CenterY$Rotate FALSE)
-    {
-        if(empty(
$String))
-            return;
-
-        
$Font $this->graph_font;
-
-        
$ttf_dimensions $this->return_ttf_string_dimensions($String$Font$Size);
-
-        
$ttf_width $ttf_dimensions[0];
-        
$ttf_height $ttf_dimensions[1];
-
-        
$Rotation 0;
-        
$text_x $RightX $ttf_width;
-        
$text_y $CenterY round($ttf_height 2);
-
-        
imagettftext($this->graph_image$Size$Rotation$text_x$text_y$Color$Font$String);
-    }
-    protected function 
gd_write_text_left($String$Size$Color$LeftX$CenterY$Rotate FALSE)
-    {
-        if(empty(
$String))
-            return;
-
-        
$Font $this->graph_font;
-
-        
$ttf_dimensions $this->return_ttf_string_dimensions($String$Font$Size);
-
-        
$ttf_width $ttf_dimensions[0];
-        
$ttf_height $ttf_dimensions[1];
-
-        
$Rotation 0;
-        
$text_x $LeftX;
-        
$text_y $CenterY round($ttf_height 2);
-
-        
imagettftext($this->graph_image$Size$Rotation$text_x$text_y$Color$Font$String);
-    }
-
-    
//
-    // Render Functions
-    //
-
-    protected function 
render_graph_init()
-    {
-        
$this->graph_image imagecreate($this->graph_attr_width$this->graph_attr_height);
-        
imageantialias($this->graph_imagetrue);
-        
imageinterlace($this->graph_imagetrue);
-
-        
// Initalize GD Colors
-
-        
$this->graph_color_notches $this->convert_hex_to_gd($this->graph_color_notches);
-        
$this->graph_color_text $this->convert_hex_to_gd($this->graph_color_text);
-        
$this->graph_color_border $this->convert_hex_to_gd($this->graph_color_border);
-        
$this->graph_color_main_headers $this->convert_hex_to_gd($this->graph_color_main_headers);
-        
$this->graph_color_headers $this->convert_hex_to_gd($this->graph_color_headers);
-        
$this->graph_color_background $this->convert_hex_to_gd($this->graph_color_background);
-        
$this->graph_color_body $this->convert_hex_to_gd($this->graph_color_body);
-        
$this->graph_color_body_text $this->convert_hex_to_gd($this->graph_color_body_text);
-        
$this->graph_color_body_light $this->convert_hex_to_gd($this->graph_color_body_light);
-
-        for(
$i 0$i count($this->graph_color_paint); $i++)
-            
$this->graph_color_paint[$i] = $this->convert_hex_to_gd($this->graph_color_paint[$i]);
-
-        
// Background Color
-        imagefilledrectangle($this->graph_image00$this->graph_attr_width$this->graph_attr_height$this->graph_color_background);
-
-        if(
$this->graph_attr_big_border == TRUE)
-            
imagerectangle($this->graph_image00$this->graph_attr_width 1$this->graph_attr_height 1$this->graph_color_border);
-
-        
// Etc
-        $this->graph_maximum_value = (floor(round($this->maximum_graph_value() * 1.35) / $this->graph_attr_marks) + 1) * $this->graph_attr_marks;
-    }
-    protected function 
render_graph_base()
-    {
-        if(
count($this->graph_data_title) > 1)
-        {
-            
$num_key_lines ceil(count($this->graph_data_title) / 4);
-            
$this->graph_top_start $this->graph_top_start + ($num_key_lines 10);
-        }
-
-        
// Make room for tick markings, left hand side
-        $this->graph_left_start += $this->return_ttf_string_width($this->graph_maximum_value$this->graph_font$this->graph_font_size_tick_mark) + 2;
-
-        
imagefilledrectangle($this->graph_image$this->graph_left_start$this->graph_top_start$this->graph_left_end$this->graph_top_end$this->graph_color_body);
-        
imagerectangle($this->graph_image$this->graph_left_start$this->graph_top_start$this->graph_left_end$this->graph_top_end$this->graph_color_border);
-
-        if(
$this->graph_body_image != FALSE)
-        {
-            
imagecopymerge($this->graph_image$this->graph_body_image$this->graph_left_start + (($this->graph_left_end $this->graph_left_start) / 2) - imagesx($this->graph_body_image) / 2$this->graph_top_start + (($this->graph_top_end $this->graph_top_start) / 2) - imagesy($this->graph_body_image) / 200imagesx($this->graph_body_image), imagesy($this->graph_body_image), 95);
-
-        }
-
-        
// Text
-        $this->gd_write_text_left($this->graph_proportion7$this->graph_color_body_light$this->graph_left_start 1$this->graph_top_start 6);
-        
$this->gd_write_text_right($this->graph_version7$this->graph_color_body_light$this->graph_left_end 2$this->graph_top_start 6);
-        
$this->gd_write_text_center($this->graph_title$this->graph_font_size_heading$this->graph_color_main_headers"GRAPH_CENTER"6);
-        
$this->gd_write_text_center($this->graph_sub_title$this->graph_font_size_sub_heading$this->graph_color_main_headers"GRAPH_CENTER"36);
-        
$this->gd_write_text_center($this->graph_y_title$this->graph_font_size_axis_heading$this->graph_color_headers4$this->graph_top_start + (($this->graph_top_end $this->graph_top_start) / 2), TRUE);
-    }
-    protected function 
render_graph_value_ticks()
-    {
-        
$tick_width = ($this->graph_top_end $this->graph_top_start) / $this->graph_attr_marks;
-        
$px_from_left_start $this->graph_left_start 5;
-        
$px_from_left_end $this->graph_left_start 5;
-
-        
$display_value 0;
-
-        for(
$i 0$i $this->graph_attr_marks$i++)
-        {
-            
$px_from_top $this->graph_top_end - ($tick_width $i);
-
-            
imageline($this->graph_image$px_from_left_start$px_from_top$px_from_left_end$px_from_top$this->graph_color_notches);
-
-            
$this->gd_write_text_right($display_value$this->graph_font_size_tick_mark$this->graph_color_text$px_from_left_start 3$px_from_top);
-
-            if(
$i != && $this->graph_type == "LINE_GRAPH")
-            {
-                
$line_width 6;
-                for(
$y $px_from_left_end $line_width$y $this->graph_left_end$y += ($line_width 2))
-                    if(
$y $line_width $this->graph_left_end)
-                        
imageline($this->graph_image$y$px_from_top$y += $line_width$px_from_top$this->graph_color_body_light);
-                    else
-                        
imageline($this->graph_image$y$px_from_top$y += ($this->graph_left_end $y) - 1$px_from_top$this->graph_color_body_light);
-            }
-
-            
$display_value += bcdiv($this->graph_maximum_value $this->graph_attr_marks12);
-        }
-    }
-    public function 
renderGraph()
-    {
-        
$this->render_graph_init();
-        
$this->render_graph_base();
-        
$this->render_graph_identifiers();
-        
$this->render_graph_value_ticks();
-        
$this->render_graph_key();
-        
$this->render_graph_result();
-        
$this->render_graph_watermark();
-        
$this->return_graph_image();
-    }
-    protected function 
render_graph_identifiers()
-    {
-        return;
-    }
-    protected function 
render_graph_result()
-    {
-        return;
-    }
-    protected function 
render_graph_key()
-    {
-        if(
count($this->graph_data_title) < 2)
-            return;
-
-        
$key_counter 0;
-        
$component_y $this->graph_top_start 11;
-        
$this->reset_paint_index();
-
-        for(
$i 0$i count($this->graph_data_title); $i++)
-        {
-            if(!empty(
$this->graph_data_title))
-            {
-                
$this_color $this->next_paint_color();
-                
$key_counter += 1;
-                
$key_offset $key_counter 4;
-
-                
$component_x $this->graph_left_start 15 + (($this->graph_left_end $this->graph_left_start) / 4) * $key_offset;
-
-                
$this->gd_write_text_left($this->graph_data_title[$i], $this->graph_font_size_key$this_color$component_x$component_y);
-
-                
imagefilledrectangle($this->graph_image$component_x 13$component_y 5$component_x 3$component_y 5$this_color);
-                
imagerectangle($this->graph_image$component_x 13$component_y 5$component_x 3$component_y 5$this->graph_color_notches);
-
-                if(
$key_counter == 0)
-                    
$component_y -= 12;
-            }
-        }
-        
$this->reset_paint_index();
-    }
-    protected function 
render_graph_watermark()
-    {
-        if(empty(
$this->graph_watermark_text))
-            return;
-
-        
$this->gd_write_text_right($this->graph_watermark_text10$this->graph_color_text$this->graph_left_end 2,  $this->graph_top_start 8);
-
-    }
-    protected function 
return_graph_image()
-    {
-        
Imagepng($this->graph_image$this->graph_output0);
-        
ImageDestroy($this->graph_image);
-    }
-    protected function 
save_graph($file)
-    {
-        
$this->graph_output $file;
-    }
-}
-
-
?>
diff --git a/pts-core/objects/object_pts_LineGraph.php b/pts-core/objects/object_pts_LineGraph.php
deleted file mode 100644
index a5dee3f..0000000
--- a/pts-core/objects/object_pts_LineGraph.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-
-
/*
-   Copyright (C) 2008, Michael Larabel.
-   Copyright (C) 2008, Phoronix Media.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-class 
pts_LineGraph extends pts_Graph
-{
-    public function 
__construct($Title$SubTitle$YTitle)
-    {
-        
parent::__construct($Title$SubTitle$YTitle);
-        
$this->graph_type "LINE_GRAPH";
-    }
-    protected function 
render_graph_identifiers()
-    {
-        
$identifier_count count($this->graph_identifiers) + 1;
-        
$graph_width $this->graph_left_end $this->graph_left_start;
-        
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
-
-        
$px_from_top_start $this->graph_top_end 5;
-        
$px_from_top_end $this->graph_top_end 5;
-
-        
$longest_string $this->find_longest_string($this->graph_identifiers);
-        
$font_size $this->graph_font_size_identifiers;
-
-        while(
$this->return_ttf_string_width($longest_string$this->graph_font$font_size) > ($identifier_width 2))
-            
$font_size -= 0.5;
-
-        for(
$i 0$i < ($identifier_count 1); $i++)
-        {
-            
$px_from_left $this->graph_left_start + ($identifier_width * ($i 1));
-
-            
imageline($this->graph_image$px_from_left$px_from_top_start$px_from_left$px_from_top_end$this->graph_color_notches);
-            
$this->gd_write_text_center($this->graph_identifiers[$i], $font_size$this->graph_color_headers$px_from_left$px_from_top_end 2);
-        }
-    }
-    protected function 
renderGraphLines()
-    {
-        
$identifier_count count($this->graph_identifiers) + 1;
-        
$graph_width $this->graph_left_end $this->graph_left_start;
-        
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
-
-        for(
$i_o 0$i_o count($this->graph_data); $i_o++)
-        {
-            
$previous_placement = -1;
-            
$previous_offset = -1;
-            
$paint_color $this->next_paint_color();
-
-            for(
$i 0$i count($this->graph_data[$i_o]); $i++)
-            {
-                
$value $this->graph_data[$i_o][$i];
-                
$value_plot_top $this->graph_top_end round(($value $this->graph_maximum_value) * ($this->graph_top_end $this->graph_top_start));
-                
$px_from_left $this->graph_left_start + ($identifier_width * ($i 1));
-
-                if(
$previous_placement != -&& $previous_offset != -1)
-                {
-                    
imageline($this->graph_image$previous_offset$previous_placement$px_from_left$value_plot_top$paint_color);
-                    
$this->render_graph_pointer($previous_offset$previous_placement);
-                }
-                if(
$i == count($this->graph_data[$i_o]) - 1)
-                    
$this->render_graph_pointer($px_from_left$value_plot_top);
-
-            
$previous_placement $value_plot_top;
-            
$previous_offset $px_from_left;
-
-            }
-        }
-    }
-    protected function 
render_graph_result()
-    {
-        
$this->renderGraphLines();
-    }
-    protected function 
render_graph_pointer($x$y)
-    {
-        
imageline($this->graph_image$x 5$y 5$x 5$y 5$this->graph_color_notches);
-        
imageline($this->graph_image$x 5$y 5$x 5$y 5$this->graph_color_notches);
-        
imagefilledrectangle($this->graph_image$x 2$y 2$x 2$y 2$this->graph_color_notches);
-    }
-}
-
-
?>
diff --git a/pts-core/objects/pts_BarGraph.php b/pts-core/objects/pts_BarGraph.php
new file mode 100644
index 0000000..41796f8
--- /dev/null
+++ b/pts-core/objects/pts_BarGraph.php
@@ -0,0 +1,114 @@
+<?php
+
+
/*
+   Copyright (C) 2008, Michael Larabel.
+   Copyright (C) 2008, Phoronix Media.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class 
pts_BarGraph extends pts_Graph
+{
+    public function 
__construct($Title$SubTitle$YTitle)
+    {
+        
parent::__construct($Title$SubTitle$YTitle);
+        
$this->graph_type "BAR_GRAPH";
+    }
+    protected function 
render_graph_identifiers()
+    {
+        
$identifier_count count($this->graph_identifiers);
+        
$graph_width $this->graph_left_end $this->graph_left_start;
+        
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
+
+        
$px_from_top_start $this->graph_top_end 5;
+        
$px_from_top_end $this->graph_top_end 5;
+
+        
$longest_string $this->find_longest_string($this->graph_identifiers);
+        
$font_size $this->graph_font_size_identifiers;
+
+        while(
$this->return_ttf_string_width($longest_string$this->graph_font$font_size) > ($identifier_width 3))
+            
$font_size -= 0.5;
+
+        for(
$i 0$i $identifier_count$i++)
+        {
+            
$px_bound_left $this->graph_left_start + ($identifier_width $i);
+            
$px_bound_right $this->graph_left_start + ($identifier_width * ($i 1));
+
+            if(
$i == 0)
+                
imageline($this->graph_image$px_bound_left$px_from_top_start$px_bound_left$px_from_top_end$this->graph_color_notches);
+
+            
imageline($this->graph_image$px_bound_right$px_from_top_start$px_bound_right$px_from_top_end$this->graph_color_notches);
+
+            
$this->gd_write_text_center($this->graph_identifiers[$i], $font_size$this->graph_color_headers$px_bound_left ceil($identifier_width 2), $px_from_top_end 1FALSETRUE);
+        }
+    }
+    protected function 
render_graph_bars()
+    {
+        
$identifier_count count($this->graph_identifiers) + 1;
+        
$graph_width $this->graph_left_end $this->graph_left_start;
+        
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
+        
$bar_count count($this->graph_data);
+        
$bar_width floor($identifier_width $bar_count);
+
+        
$font_size $this->graph_font_size_bars;
+
+        while(
$this->return_ttf_string_width(bcdiv($this->graph_maximum_value13), $this->graph_font$font_size) > ($bar_width 6))
+            
$font_size -= 0.5;
+
+        for(
$i_o 0$i_o $bar_count$i_o++)
+        {
+            
$paint_color $this->next_paint_color();
+
+            for(
$i 0$i count($this->graph_data[$i_o]); $i++)
+            {
+                
$value $this->graph_data[$i_o][$i];
+                
$graph_size round(($value $this->graph_maximum_value) * ($this->graph_top_end $this->graph_top_start));
+                
$value_plot_top $this->graph_top_end $graph_size;
+
+                
$identifier_count count($this->graph_data[$i_o]);
+                
$graph_width $this->graph_left_end $this->graph_left_start;
+                
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
+                
$bar_width floor($identifier_width $bar_count);
+                
$px_bound_left $this->graph_left_start + ($identifier_width $i)  + ($bar_width $i_o) + 2;
+                
$px_bound_right $this->graph_left_start + ($identifier_width * ($i 1)) - ($bar_width * ($bar_count $i_o 1));
+
+                if(
$i_o == 0)
+                    
$size_diff_left 5;
+                else
+                    
$size_diff_left 0;
+
+                if((
$i_o 1) == $bar_count)
+                    
$size_diff_right 5;
+                else
+                    
$size_diff_right 0;
+
+                if(
$value_plot_top 1)
+                    
$value_plot_top 1;
+
+                
imagerectangle($this->graph_image$px_bound_left $size_diff_left$value_plot_top 1$px_bound_right $size_diff_right$this->graph_top_end 1$this->graph_color_body_light);
+                
imagefilledrectangle($this->graph_image$px_bound_left $size_diff_left 1$value_plot_top$px_bound_right $size_diff_right 1$this->graph_top_end 1$paint_color);
+                
$value bcdiv($value12);
+
+                if(
$graph_size 20)
+                    
$this->gd_write_text_center($this->graph_data[$i_o][$i], $font_size$this->graph_color_body_text$px_bound_left + (($px_bound_right $px_bound_left) / 2), $value_plot_top 3);
+            }
+        }
+    }
+    protected function 
render_graph_result()
+    {
+        
$this->render_graph_bars();
+    }
+}
+
+
?>
diff --git a/pts-core/objects/pts_Graph.php b/pts-core/objects/pts_Graph.php
new file mode 100644
index 0000000..48f3981
--- /dev/null
+++ b/pts-core/objects/pts_Graph.php
@@ -0,0 +1,439 @@
+<?php
+
+
/*
+   Copyright (C) 2008, Michael Larabel.
+   Copyright (C) 2008, Phoronix Media.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class 
pts_Graph
+{
+    
// Defaults
+    var $graph_attr_marks 6// Number of marks to make on vertical axis
+    var $graph_attr_width 580// Graph width
+    var $graph_attr_height 300// Graph height
+    var $graph_attr_big_border FALSE// Border around graph or not
+
+    var 
$graph_left_start 27// Distance in px to start graph from left side
+    var $graph_left_end_opp 10// Distance in px to end graph from right side
+    var $graph_top_start 59// Distance in px to start graph from top side
+    var $graph_top_end_opp 22// Distance in px to end graph from bottom side
+
+    
// Colors
+    var $graph_color_notches "#000000"// Color for notches
+    var $graph_color_text "#000000"// Color for text
+    var $graph_color_border "#000000"// Color for border (if used)
+    var $graph_color_main_headers "#2b6b29"// Color of main text headers
+    var $graph_color_headers "#2b6b29"// Color of other headers
+    var $graph_color_background "#FFFFFF"// Color of background
+    var $graph_color_body "#8b8f7c"// Color of graph body
+    var $graph_color_body_text "#FFFFFF"// Color of graph body text
+    var $graph_color_body_light "#B0B59E"// Color of the border around graph bars (if doing a bar graph)
+
+    var 
$graph_color_paint = array("#3b433a""#bb2413""#ff9933""#006c00""#5028ca"); // Colors to use for the bars / lines, one color for each key
+
+    
// Text
+    var $graph_font "DejaVuSans.ttf"// TTF file name
+    var $graph_font_size_tick_mark 10// Tick mark size
+    var $graph_font_size_key 9// Size of height for keys
+    var $graph_font_size_heading 18// Font size of headings
+    var $graph_font_size_bars 12// Font size for text on the bars/objects
+    var $graph_font_size_identifiers 11// Font size of identifiers
+    var $graph_font_size_sub_heading 12// Font size of headers
+    var $graph_font_size_axis_heading 11// Font size of axis headers
+    var $graph_watermark_text "PHORONIX-TEST-SUITE.COM"// Text for watermark in upper right hand corner. If null, no watermark will display
+    var $graph_version "";
+    var 
$graph_proportion "";
+
+    
// CHANGE DIRECTORY FOR TTF FONT LOCATION INSIDE __construct FUNCTION
+
+    
// Not user-friendly changes below this line
+    var $graph_body_image FALSE;
+    var 
$graph_type "GRAPH";
+    var 
$graph_image;
+    var 
$graph_maximum_value;
+
+    var 
$graph_output null;
+    var 
$graph_data = array();
+    var 
$graph_data_title = array();
+    var 
$graph_color_paint_index = -1;
+    var 
$graph_identifiers;
+    var 
$graph_title;
+    var 
$graph_sub_title;
+    var 
$graph_y_title;
+    var 
$graph_top_end;
+    var 
$graph_left_end;
+
+    public function 
__construct($Title$SubTitle$YTitle)
+    {
+        
$this->graph_title $Title;
+        
$this->graph_sub_title $SubTitle;
+        
$this->graph_y_title $YTitle;
+
+        
$this->graph_top_end $this->graph_attr_height $this->graph_top_end_opp;
+        
$this->graph_left_end $this->graph_attr_width $this->graph_left_end_opp;
+
+        
// Directory for TTF Fonts
+        if(!defined("FONT_DIRECTORY"))
+        {
+            
putenv("GDFONTPATH=pts-core/pts-results-viewer/");
+            
//putenv("GDFONTPATH=" . getcwd()); // The directory where the TTF font files should be. getcwd() will look in the same directory as this file
+        }
+        else
+        {
+            
putenv("GDFONTPATH=" FONT_DIRECTORY);
+        }
+    }
+
+    
//
+    // Load Functions
+    //
+
+    public function 
loadGraphIdentifiers($data_array)
+    {
+        
$this->graph_identifiers $data_array;
+    }
+    public function 
loadGraphVersion($data)
+    {
+        if(!empty(
$data))
+            
$this->graph_version "Phoronix Test Suite v" $data;
+    }
+    public function 
loadGraphProportion($data)
+    {
+        if(
$data == "LIB")
+            
$this->graph_proportion "* Less is better";
+        
//else if($data == "HIB")
+        //    $this->graph_proportion = "* More is better";
+    }
+    public function 
loadGraphData($data_array)
+    {
+        
loadGraphValues($data_array);
+    }
+    public function 
loadGraphValues($data_array$data_title NULL)
+    {
+        for(
$i 0$i count($data_array); $i++)
+            if(
is_float($data_array[$i]))
+                
$data_array[$i] = bcdiv($data_array[$i], 12);
+
+        
array_push($this->graph_data$data_array);
+        
array_push($this->graph_data_title$data_title);
+    }
+    public function 
setGraphBackgroundPNG($File)
+    {
+        
$IMG = @imagecreatefrompng($File);
+
+        if(
$IMG != FALSE)
+            
$this->graph_body_image $IMG;
+    }
+
+    
//
+    // Misc Functions
+    //
+
+    protected function 
next_paint_color()
+    {
+        if(
$this->graph_color_paint_index count($this->graph_color_paint))
+        {
+            
$this->graph_color_paint_index += 1;
+        }
+        else
+        {
+            
$this->graph_color_paint_index 0;
+        }
+
+        return 
$this->graph_color_paint[$this->graph_color_paint_index];
+    }
+    protected function 
reset_paint_index()
+    {
+        
$this->graph_color_paint_index = -1;
+    }
+    protected function 
maximum_graph_value()
+    {
+        
$maximum $this->graph_attr_marks;
+
+        foreach(
$this->graph_data as $graph_set)
+            foreach(
$graph_set as $set_item)
+                if(
$set_item $maximum)
+                    
$maximum $set_item;
+
+        return 
$maximum;
+    }
+    protected function 
convert_hex_to_gd($Hex)
+    {
+        return 
imagecolorallocate($this->graph_imagehexdec(substr($Hex12)), hexdec(substr($Hex32)), hexdec(substr($Hex52)));
+    }
+    protected function 
return_ttf_string_dimensions($String$Font$Size$Big FALSE)
+    {
+        
$box_array imagettfbbox($Size0$Font$String);
+        
$box_width $box_array[4] - $box_array[6];
+
+        if(
$Big)
+            
$box_array imagettfbbox($Size0$Font"AZ@![]()@|");
+        
$box_height $box_array[1] - $box_array[7];
+
+        
// Width x Height
+        return array($box_width$box_height);
+    }
+    protected function 
return_ttf_string_width($String$Font$Size)
+    {
+        
$dimensions $this->return_ttf_string_dimensions($String$Font$Size);
+        return 
$dimensions[0];
+    }
+    protected function 
gd_write_text_center($String$Size$Color$CenterX$CenterY$Rotate FALSE$Big FALSE)
+    {
+        if(empty(
$String))
+            return;
+
+        
$Font $this->graph_font;
+
+        
$ttf_dimensions $this->return_ttf_string_dimensions(strtoupper($String), $Font$Size$Big);
+        
$ttf_height $ttf_dimensions[1];
+
+        
$ttf_dimensions $this->return_ttf_string_dimensions($String$Font$Size$Big);
+        
$ttf_width $ttf_dimensions[0];
+
+        if(
$CenterX == "TRUE_CENTER")
+            
$CenterX $this->graph_attr_width 2;
+        else if(
$CenterX == "GRAPH_CENTER")
+            
$CenterX $this->return_graph_x_center();
+
+        if(
$Rotate == FALSE)
+        {
+            
$Rotation 0;
+            
$text_x $CenterX round($ttf_width 2);
+            
$text_y $CenterY $ttf_height;
+        }
+        else
+        {
+            
$Rotation 90;
+            
$text_x $CenterX $ttf_height;
+            
$text_y $CenterY round($ttf_width 2);
+        }
+
+        
imagettftext($this->graph_image$Size$Rotation$text_x$text_y$Color$Font$String);
+    }
+    protected function 
find_longest_string($arr_string)
+    {
+        
$longest_string "";
+        
$px_length 0;
+
+        foreach(
$arr_string as $one_string)
+            if((
$new_length strlen($one_string)) > strlen($longest_string))
+            {
+                
$longest_string $one_string;
+                
$px_length $new_length;
+            }
+        return 
$longest_string;
+    }
+    protected function 
return_graph_x_center()
+    {
+        return 
$this->graph_left_start + (($this->graph_left_end $this->graph_left_start) / 2);
+    }
+    protected function 
gd_write_text_right($String$Size$Color$RightX$CenterY$Rotate FALSE)
+    {
+        if(empty(
$String))
+            return;
+
+        
$Font $this->graph_font;
+
+        
$ttf_dimensions $this->return_ttf_string_dimensions($String$Font$Size);
+
+        
$ttf_width $ttf_dimensions[0];
+        
$ttf_height $ttf_dimensions[1];
+
+        
$Rotation 0;
+        
$text_x $RightX $ttf_width;
+        
$text_y $CenterY round($ttf_height 2);
+
+        
imagettftext($this->graph_image$Size$Rotation$text_x$text_y$Color$Font$String);
+    }
+    protected function 
gd_write_text_left($String$Size$Color$LeftX$CenterY$Rotate FALSE)
+    {
+        if(empty(
$String))
+            return;
+
+        
$Font $this->graph_font;
+
+        
$ttf_dimensions $this->return_ttf_string_dimensions($String$Font$Size);
+
+        
$ttf_width $ttf_dimensions[0];
+        
$ttf_height $ttf_dimensions[1];
+
+        
$Rotation 0;
+        
$text_x $LeftX;
+        
$text_y $CenterY round($ttf_height 2);
+
+        
imagettftext($this->graph_image$Size$Rotation$text_x$text_y$Color$Font$String);
+    }
+
+    
//
+    // Render Functions
+    //
+
+    protected function 
render_graph_init()
+    {
+        
$this->graph_image imagecreate($this->graph_attr_width$this->graph_attr_height);
+        
//imageantialias($this->graph_image, true);
+        imageinterlace($this->graph_imagetrue);
+
+        
// Initalize GD Colors
+
+        
$this->graph_color_notches $this->convert_hex_to_gd($this->graph_color_notches);
+        
$this->graph_color_text $this->convert_hex_to_gd($this->graph_color_text);
+        
$this->graph_color_border $this->convert_hex_to_gd($this->graph_color_border);
+        
$this->graph_color_main_headers $this->convert_hex_to_gd($this->graph_color_main_headers);
+        
$this->graph_color_headers $this->convert_hex_to_gd($this->graph_color_headers);
+        
$this->graph_color_background $this->convert_hex_to_gd($this->graph_color_background);
+        
$this->graph_color_body $this->convert_hex_to_gd($this->graph_color_body);
+        
$this->graph_color_body_text $this->convert_hex_to_gd($this->graph_color_body_text);
+        
$this->graph_color_body_light $this->convert_hex_to_gd($this->graph_color_body_light);
+
+        for(
$i 0$i count($this->graph_color_paint); $i++)
+            
$this->graph_color_paint[$i] = $this->convert_hex_to_gd($this->graph_color_paint[$i]);
+
+        
// Background Color
+        imagefilledrectangle($this->graph_image00$this->graph_attr_width$this->graph_attr_height$this->graph_color_background);
+
+        if(
$this->graph_attr_big_border == TRUE)
+            
imagerectangle($this->graph_image00$this->graph_attr_width 1$this->graph_attr_height 1$this->graph_color_border);
+
+        
// Etc
+        $this->graph_maximum_value = (floor(round($this->maximum_graph_value() * 1.35) / $this->graph_attr_marks) + 1) * $this->graph_attr_marks;
+    }
+    protected function 
render_graph_base()
+    {
+        if(
count($this->graph_data_title) > 1)
+        {
+            
$num_key_lines ceil(count($this->graph_data_title) / 4);
+            
$this->graph_top_start $this->graph_top_start + ($num_key_lines 10);
+        }
+
+        
// Make room for tick markings, left hand side
+        $this->graph_left_start += $this->return_ttf_string_width($this->graph_maximum_value$this->graph_font$this->graph_font_size_tick_mark) + 2;
+
+        
imagefilledrectangle($this->graph_image$this->graph_left_start$this->graph_top_start$this->graph_left_end$this->graph_top_end$this->graph_color_body);
+        
imagerectangle($this->graph_image$this->graph_left_start$this->graph_top_start$this->graph_left_end$this->graph_top_end$this->graph_color_border);
+
+        if(
$this->graph_body_image != FALSE)
+        {
+            
imagecopymerge($this->graph_image$this->graph_body_image$this->graph_left_start + (($this->graph_left_end $this->graph_left_start) / 2) - imagesx($this->graph_body_image) / 2$this->graph_top_start + (($this->graph_top_end $this->graph_top_start) / 2) - imagesy($this->graph_body_image) / 200imagesx($this->graph_body_image), imagesy($this->graph_body_image), 95);
+
+        }
+
+        
// Text
+        $this->gd_write_text_left($this->graph_proportion7$this->graph_color_body_light$this->graph_left_start 1$this->graph_top_start 6);
+        
$this->gd_write_text_right($this->graph_version7$this->graph_color_body_light$this->graph_left_end 2$this->graph_top_start 6);
+        
$this->gd_write_text_center($this->graph_title$this->graph_font_size_heading$this->graph_color_main_headers"GRAPH_CENTER"6);
+        
$this->gd_write_text_center($this->graph_sub_title$this->graph_font_size_sub_heading$this->graph_color_main_headers"GRAPH_CENTER"36);
+        
$this->gd_write_text_center($this->graph_y_title$this->graph_font_size_axis_heading$this->graph_color_headers4$this->graph_top_start + (($this->graph_top_end $this->graph_top_start) / 2), TRUE);
+    }
+    protected function 
render_graph_value_ticks()
+    {
+        
$tick_width = ($this->graph_top_end $this->graph_top_start) / $this->graph_attr_marks;
+        
$px_from_left_start $this->graph_left_start 5;
+        
$px_from_left_end $this->graph_left_start 5;
+
+        
$display_value 0;
+
+        for(
$i 0$i $this->graph_attr_marks$i++)
+        {
+            
$px_from_top $this->graph_top_end - ($tick_width $i);
+
+            
imageline($this->graph_image$px_from_left_start$px_from_top$px_from_left_end$px_from_top$this->graph_color_notches);
+
+            
$this->gd_write_text_right($display_value$this->graph_font_size_tick_mark$this->graph_color_text$px_from_left_start 3$px_from_top);
+
+            if(
$i != && $this->graph_type == "LINE_GRAPH")
+            {
+                
$line_width 6;
+                for(
$y $px_from_left_end $line_width$y $this->graph_left_end$y += ($line_width 2))
+                    if(
$y $line_width $this->graph_left_end)
+                        
imageline($this->graph_image$y$px_from_top$y += $line_width$px_from_top$this->graph_color_body_light);
+                    else
+                        
imageline($this->graph_image$y$px_from_top$y += ($this->graph_left_end $y) - 1$px_from_top$this->graph_color_body_light);
+            }
+
+            
$display_value += bcdiv($this->graph_maximum_value $this->graph_attr_marks12);
+        }
+    }
+    public function 
renderGraph()
+    {
+        
$this->render_graph_init();
+        
$this->render_graph_base();
+        
$this->render_graph_identifiers();
+        
$this->render_graph_value_ticks();
+        
$this->render_graph_key();
+        
$this->render_graph_result();
+        
$this->render_graph_watermark();
+        
$this->return_graph_image();
+    }
+    protected function 
render_graph_identifiers()
+    {
+        return;
+    }
+    protected function 
render_graph_result()
+    {
+        return;
+    }
+    protected function 
render_graph_key()
+    {
+        if(
count($this->graph_data_title) < 2)
+            return;
+
+        
$key_counter 0;
+        
$component_y $this->graph_top_start 11;
+        
$this->reset_paint_index();
+
+        for(
$i 0$i count($this->graph_data_title); $i++)
+        {
+            if(!empty(
$this->graph_data_title))
+            {
+                
$this_color $this->next_paint_color();
+                
$key_counter += 1;
+                
$key_offset $key_counter 4;
+
+                
$component_x $this->graph_left_start 15 + (($this->graph_left_end $this->graph_left_start) / 4) * $key_offset;
+
+                
$this->gd_write_text_left($this->graph_data_title[$i], $this->graph_font_size_key$this_color$component_x$component_y);
+
+                
imagefilledrectangle($this->graph_image$component_x 13$component_y 5$component_x 3$component_y 5$this_color);
+                
imagerectangle($this->graph_image$component_x 13$component_y 5$component_x 3$component_y 5$this->graph_color_notches);
+
+                if(
$key_counter == 0)
+                    
$component_y -= 12;
+            }
+        }
+        
$this->reset_paint_index();
+    }
+    protected function 
render_graph_watermark()
+    {
+        if(empty(
$this->graph_watermark_text))
+            return;
+
+        
$this->gd_write_text_right($this->graph_watermark_text10$this->graph_color_text$this->graph_left_end 2,  $this->graph_top_start 8);
+
+    }
+    protected function 
return_graph_image()
+    {
+        
Imagepng($this->graph_image$this->graph_output0);
+        
ImageDestroy($this->graph_image);
+    }
+    public function 
save_graph($file)
+    {
+        
$this->graph_output $file;
+    }
+}
+
+
?>
diff --git a/pts-core/objects/pts_LineGraph.php b/pts-core/objects/pts_LineGraph.php
new file mode 100644
index 0000000..a5dee3f
--- /dev/null
+++ b/pts-core/objects/pts_LineGraph.php
@@ -0,0 +1,95 @@
+<?php
+
+
/*
+   Copyright (C) 2008, Michael Larabel.
+   Copyright (C) 2008, Phoronix Media.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class 
pts_LineGraph extends pts_Graph
+{
+    public function 
__construct($Title$SubTitle$YTitle)
+    {
+        
parent::__construct($Title$SubTitle$YTitle);
+        
$this->graph_type "LINE_GRAPH";
+    }
+    protected function 
render_graph_identifiers()
+    {
+        
$identifier_count count($this->graph_identifiers) + 1;
+        
$graph_width $this->graph_left_end $this->graph_left_start;
+        
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
+
+        
$px_from_top_start $this->graph_top_end 5;
+        
$px_from_top_end $this->graph_top_end 5;
+
+        
$longest_string $this->find_longest_string($this->graph_identifiers);
+        
$font_size $this->graph_font_size_identifiers;
+
+        while(
$this->return_ttf_string_width($longest_string$this->graph_font$font_size) > ($identifier_width 2))
+            
$font_size -= 0.5;
+
+        for(
$i 0$i < ($identifier_count 1); $i++)
+        {
+            
$px_from_left $this->graph_left_start + ($identifier_width * ($i 1));
+
+            
imageline($this->graph_image$px_from_left$px_from_top_start$px_from_left$px_from_top_end$this->graph_color_notches);
+            
$this->gd_write_text_center($this->graph_identifiers[$i], $font_size$this->graph_color_headers$px_from_left$px_from_top_end 2);
+        }
+    }
+    protected function 
renderGraphLines()
+    {
+        
$identifier_count count($this->graph_identifiers) + 1;
+        
$graph_width $this->graph_left_end $this->graph_left_start;
+        
$identifier_width = ($this->graph_left_end $this->graph_left_start) / $identifier_count;
+
+        for(
$i_o 0$i_o count($this->graph_data); $i_o++)
+        {
+            
$previous_placement = -1;
+            
$previous_offset = -1;
+            
$paint_color $this->next_paint_color();
+
+            for(
$i 0$i count($this->graph_data[$i_o]); $i++)
+            {
+                
$value $this->graph_data[$i_o][$i];
+                
$value_plot_top $this->graph_top_end round(($value $this->graph_maximum_value) * ($this->graph_top_end $this->graph_top_start));
+                
$px_from_left $this->graph_left_start + ($identifier_width * ($i 1));
+
+                if(
$previous_placement != -&& $previous_offset != -1)
+                {
+                    
imageline($this->graph_image$previous_offset$previous_placement$px_from_left$value_plot_top$paint_color);
+                    
$this->render_graph_pointer($previous_offset$previous_placement);
+                }
+                if(
$i == count($this->graph_data[$i_o]) - 1)
+                    
$this->render_graph_pointer($px_from_left$value_plot_top);
+
+            
$previous_placement $value_plot_top;
+            
$previous_offset $px_from_left;
+
+            }
+        }
+    }
+    protected function 
render_graph_result()
+    {
+        
$this->renderGraphLines();
+    }
+    protected function 
render_graph_pointer($x$y)
+    {
+        
imageline($this->graph_image$x 5$y 5$x 5$y 5$this->graph_color_notches);
+        
imageline($this->graph_image$x 5$y 5$x 5$y 5$this->graph_color_notches);
+        
imagefilledrectangle($this->graph_image$x 2$y 2$x 2$y 2$this->graph_color_notches);
+    }
+}
+
+
?>
diff --git a/pts-core/pts-results-viewer/DejaVuSans.ttf b/pts-core/pts-results-viewer/DejaVuSans.ttf
new file mode 100644
index 0000000..3299ee5
Binary files /dev/null and b/pts-core/pts-results-viewer/DejaVuSans.ttf differ
diff --git a/pts-core/pts-run-cmd.php b/pts-core/pts-run-cmd.php
index b2f8ddc..3cbe4c2 100644
--- a/pts-core/pts-run-cmd.php
+++ b/pts-core/pts-run-cmd.php
@@ -17,13 +17,14 @@ switch($COMMAND)
         {
             unlink(SAVE_RESULTS_LOCATION . $ARG_1 . "/composite.xml");

-            $i = 1;
-            while(is_file(SAVE_RESULTS_LOCATION . $ARG_1 . "/test-" . "$i.xml"))
-            {
-                unlink(SAVE_RESULTS_LOCATION . $ARG_1 . "/test-" . "$i.xml");
-                $i++;
-            }
+            foreach(glob(SAVE_RESULTS_LOCATION . $ARG_1 . "/result-graphs/*.png") as $remove_file)
+                unlink($remove_file);
+
+            foreach(glob(SAVE_RESULTS_LOCATION . $ARG_1 . "/test-*.xml") as $remove_file)
+                unlink($remove_file);
+
             unlink(SAVE_RESULTS_LOCATION . $ARG_1 . "/pts-results-viewer.xsl");
+            rmdir(SAVE_RESULTS_LOCATION . $ARG_1 . "/result-graphs/");
             rmdir(SAVE_RESULTS_LOCATION . $ARG_1);
             echo "\nRemoved: $ARG_1\n";
    &nb
 
Phoronix.com
Linux Driver Forums
Copyright © 2014 by Phoronix Media