summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-04-24 12:37:29 -0400
committerMichael Larabel <michael@phx-laptop.(none)>2008-04-24 12:37:29 -0400
commit0fdf46c9a6f00f63f47d1e004fad8609c64a8f48 (patch)
tree51d0be883ceacf7cec73e3b55dc1a75d70edb3c3
parent49faf9c9e6db4b397606a6c8df072fff5e842d96 (diff)
downloadphoronix-test-suite-upstream-0fdf46c9a6f00f63f47d1e004fad8609c64a8f48.tar.gz
phoronix-test-suite-upstream-0fdf46c9a6f00f63f47d1e004fad8609c64a8f48.tar.xz
phoronix-test-suite-upstream-0fdf46c9a6f00f63f47d1e004fad8609c64a8f48.zip
Implement local graph rendering! With this commit, you MUST now have PHP
GD installed for local font rendering!
-rw-r--r--README2
-rw-r--r--pts-core/functions/pts-functions.php103
-rw-r--r--pts-core/objects/pts_BarGraph.php (renamed from pts-core/objects/object_pts_BarGraph.php)0
-rw-r--r--pts-core/objects/pts_Graph.php (renamed from pts-core/objects/object_pts_Graph.php)16
-rw-r--r--pts-core/objects/pts_LineGraph.php (renamed from pts-core/objects/object_pts_LineGraph.php)0
-rw-r--r--pts-core/pts-results-viewer/DejaVuSans.ttfbin0 -> 569008 bytes
-rw-r--r--pts-core/pts-run-cmd.php13
7 files changed, 71 insertions, 63 deletions
diff --git a/README b/README
index c0455ef..d041b93 100644
--- a/README
+++ b/README
@@ -6,6 +6,8 @@ Phoronix Test Suite is licensed under the GNU GPLv3. See COPYING file for more d
Patches, new profiles, etc welcome. Non-technical support messages can be directed to phoronix [at] phoronix.com.
+The default font that ships with the Phoronix Test Suite for the results graphing is from the DejaVu font collection: http://dejavu.sourceforge.net/
+
LINKS:
Check Out This Link To See What The Phoronix Test Suite Is All About (Guide, Announcement, & 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,6 +40,7 @@ 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,7 +152,6 @@ 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/pts_BarGraph.php
index 41796f8..41796f8 100644
--- a/pts-core/objects/object_pts_BarGraph.php
+++ b/pts-core/objects/pts_BarGraph.php
diff --git a/pts-core/objects/object_pts_Graph.php b/pts-core/objects/pts_Graph.php
index 55f58dc..48f3981 100644
--- a/pts-core/objects/object_pts_Graph.php
+++ b/pts-core/objects/pts_Graph.php
@@ -45,7 +45,7 @@ class pts_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 = "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
@@ -86,7 +86,15 @@ class pts_Graph
$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
+ 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);
+ }
}
//
@@ -277,7 +285,7 @@ class pts_Graph
protected function render_graph_init()
{
$this->graph_image = imagecreate($this->graph_attr_width, $this->graph_attr_height);
- imageantialias($this->graph_image, true);
+ //imageantialias($this->graph_image, true);
imageinterlace($this->graph_image, true);
// Initalize GD Colors
@@ -422,7 +430,7 @@ class pts_Graph
Imagepng($this->graph_image, $this->graph_output, 0);
ImageDestroy($this->graph_image);
}
- protected function save_graph($file)
+ public function save_graph($file)
{
$this->graph_output = $file;
}
diff --git a/pts-core/objects/object_pts_LineGraph.php b/pts-core/objects/pts_LineGraph.php
index a5dee3f..a5dee3f 100644
--- a/pts-core/objects/object_pts_LineGraph.php
+++ b/pts-core/objects/pts_LineGraph.php
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
--- /dev/null
+++ b/pts-core/pts-results-viewer/DejaVuSans.ttf
Binary files 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";
}