/usr/share/phoronix-test-suite/pts-core/objects/pts_Graph/pts_PassFailGraph.php is in phoronix-test-suite 3.6.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | <?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2011, Phoronix Media
Copyright (C) 2008 - 2011, Michael Larabel
pts_PassFailGraph.php: An abstract graph object extending pts_Graph for showing results in a pass/fail scenario.
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_PassFailGraph extends pts_Graph
{
public function __construct(&$result_object, &$result_file = null)
{
parent::__construct($result_object, $result_file);
$this->graph_value_type = "ABSTRACT";
$this->graph_hide_identifiers = true;
$this->graph_data_title = array("PASSED", "FAILED");
}
protected function render_graph_passfail()
{
$identifier_count = count($this->graph_identifiers);
$vertical_border = 18;
$horizontal_border = 10;
$spacing = 8;
$columns = 1;
$graph_width = $this->graph_left_end - $this->graph_left_start - ($horizontal_border * 2);
$graph_height = $this->graph_top_end - $this->graph_top_start - ($vertical_border * 1.5);
$font_size = $this->graph_font_size_bars * 1.5;
$pass_color = $this->get_paint_color('PASS');
$fail_color = $this->get_paint_color('FAIL');
for($i = 2; $i <= sqrt($identifier_count); $i++)
{
if(intval($identifier_count / $i) == ($identifier_count / $i))
{
$columns = $i;
}
}
$identifiers_per_column = $identifier_count / $columns;
$identifier_height = floor(($graph_height - (($identifiers_per_column - 1) * $spacing)) / $identifiers_per_column);
$identifier_width = floor(($graph_width - (($columns - 1) * $spacing)) / $columns);
$width = $identifier_width - 8;
$height = $line_height - 4;
$main_font_size = $this->text_size_bounds($this->graph_maximum_value, $this->graph_font, $font_size, 4, $width, $height);
for($c = 0; $c < $columns; $c++)
{
for($i = 0; $i < $identifiers_per_column; $i++)
{
$element_i = ($c * $identifiers_per_column) + $i;
$this_identifier = $this->graph_identifiers[$element_i];
$this_value = $this->graph_data[0][$element_i];
$this_horizontal_start = $this->graph_left_start + $horizontal_border + ($c * ($identifier_width + $spacing));
$this_horizontal_end = $this->graph_left_start + $horizontal_border + ($c * ($identifier_width + $spacing)) + $identifier_width;
$this_vertical_start = $this->graph_top_start + $vertical_border + ($i * ($identifier_height + $spacing));
$this_vertical_end = $this->graph_top_start + $vertical_border + ($i * ($identifier_height + $spacing)) + $identifier_height;
if($this_value == "PASS")
{
$paint_color = $pass_color;
}
else
{
$paint_color = $fail_color;
}
$this->graph_image->draw_rectangle_with_border($this_horizontal_start + 1, $this_vertical_start + 1, $this_horizontal_end - 1, $this_vertical_end - 1, $paint_color, $this->graph_color_body_light);
$this->graph_image->write_text_center($this_identifier, $this->graph_font, $font_size, $this->graph_color_body_text, $this_horizontal_start, $this_vertical_start + (($this_vertical_end - $this_vertical_start) / 2) - ($this->text_string_height($this_identifier, $this->graph_font, $font_size) / 2), $this_horizontal_end, $this_vertical_start + (($this_vertical_end - $this_vertical_start) / 2) - ($this->text_string_height($this_identifier, $this->graph_font, $font_size) / 2));
}
}
}
protected function render_graph_result()
{
$this->render_graph_passfail();
}
}
?>
|