[llvm-commits] CVS: nightlytest-serverside/individualfilesizegraph.php drawfilesizegraph.php NightlyTester.php
Patrick Jenkins
pjenkins at apple.com
Tue Aug 1 16:20:00 PDT 2006
Changes in directory nightlytest-serverside:
individualfilesizegraph.php added (r1.1)
drawfilesizegraph.php updated: 1.1 -> 1.2
NightlyTester.php updated: 1.9 -> 1.10
---
Log message:
Adding support for drawing graphs of an arbitrary number of file sizes over time.
---
Diffs of the changes: (+485 -38)
NightlyTester.php | 13 -
drawfilesizegraph.php | 83 +++++---
individualfilesizegraph.php | 427 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 485 insertions(+), 38 deletions(-)
Index: nightlytest-serverside/individualfilesizegraph.php
diff -c /dev/null nightlytest-serverside/individualfilesizegraph.php:1.1
*** /dev/null Tue Aug 1 18:19:55 2006
--- nightlytest-serverside/individualfilesizegraph.php Tue Aug 1 18:19:44 2006
***************
*** 0 ****
--- 1,427 ----
+ <?php
+ /*if(!(include "jpgraph.php")){
+ die("Error: could not load necessary files!\n");
+ }
+ if(!(include "jpgraph_line.php")){
+ die("Error: could not load necessary files!\n");
+ }
+ if(!(include "jpgraph_utils.inc")){
+ die("Error: could not load necessary files!\n");
+ }
+ if(!(include "jpgraph_date.php")){
+ die("Error: could not load necessary files!\n");
+ }*/
+ if(!(include "NightlyTester2.php")){
+ die("Error: could not load necessary files!\n");
+ }
+
+ $DEBUG=0;
+
+ /********************************
+ *
+ * printing the appropriate error
+ * image if necessary
+ *
+ ********************************/
+ function printErrorMsg( $error_string, $DEBUG=0 ){
+ if($DEBUG){
+ print "$error_string";
+ }
+ $xsize=500;
+ $ysize=300;
+
+ if(!$DEBUG){
+ $error_image = ImageCreate($xsize, $ysize);
+ $white = imagecolorallocate($error_image, 255, 255, 255);
+ $black = imagecolorallocate($error_image, 0,0,0);
+ ImageFill($error_image, 0, 0, $white);
+ imagerectangle($error_image,0,0,$xsize-1,$ysize-1,$black);
+ imagestring($error_image, 14, 5, 5, $error_string, $black);
+ header("Content-type: image/png");
+ imagepng($error_image);
+ imagedestroy($error_image);
+ }
+ exit(0);
+ }
+
+ /********************************
+ *
+ * gathering url information and creating query
+ * If url is invalid an error image will be
+ * returned.
+ *
+ ********************************/
+ $URL_ERROR=0;
+ $error_msg="";
+
+ $mysql_link = mysql_connect("127.0.0.1","llvm","ll2002vm") or die("Error: could not connect to database!\n");
+ mysql_select_db("nightlytestresults");
+
+ if($mysql_link==FALSE){
+ $URL_ERROR=1;
+ $error_msg="Could not connect to database $!\n";
+ }
+
+ if(isset($HTTP_GET_VARS['files'])){
+ $files_arr=$HTTP_GET_VARS["files"];
+ $files_url="";
+ foreach ($files_arr as $f){
+ $files_url.="&files[]=$f";
+ }
+ }
+ else{$URL_ERROR=1;$error_msg="no value for measure";}
+
+ if(isset($HTTP_GET_VARS['xsize'])){
+ $xsize=$HTTP_GET_VARS['xsize'];
+ }
+ else{$xsize=800;}
+
+ if(isset($HTTP_GET_VARS['ysize'])){
+ $ysize = $HTTP_GET_VARS['ysize'];
+ }else{$ysize=500;}
+
+ if(isset($HTTP_GET_VARS['name'])){
+ $name = $HTTP_GET_VARS['name'];
+ }
+ else{$name = "Results Graph";}
+
+ if(isset($HTTP_GET_VARS['machine'])){
+ $machine_id=$HTTP_GET_VARS['machine'];
+ $machine=$machine_id;
+ }
+ else{$URL_ERROR=1;$error_msg="no value for machine";}
+
+ if(isset($HTTP_GET_VARS['start'])){
+ if(preg_match("/\d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d/", "{$HTTP_GET_VARS['start']}")>0){
+ $start = $HTTP_GET_VARS['start'];
+ $start_query = "and added >= \"$start\"";
+ $start_url = "&start=$start";
+ }
+ else{
+ print "Error: Incorrect URL!\n";
+ die();
+ }
+ }
+ else{
+ $result = mysql_query("SELECT * FROM night WHERE machine=$machine ORDER BY added ASC") or die (mysql_error());
+ $recent=mysql_fetch_array($result);
+ $start = $recent['added'];
+ mysql_free_result($result);
+
+ $start_url="&start=$start";
+ $start_query = " and added >= \"$start\"";
+ }
+
+ if(isset($HTTP_GET_VARS['end'])){
+ if(preg_match("/\d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d/", "{$HTTP_GET_VARS['end']}")>0){
+ $end = $HTTP_GET_VARS['end'];
+ $end_query = "and added <= \"$end\"";
+ }
+ else{
+ print "Error: Incorrect URL!\n";
+ die();
+ }
+ }
+ else{
+ $result = mysql_query("SELECT * FROM night WHERE machine=$machine ORDER BY added DESC") or die (mysql_error());
+ $recent=mysql_fetch_array($result);
+ $end = $recent['added'];
+ mysql_free_result($result);
+
+ $end_url = "&end=$end";
+ $end_query = " and added <= \"$end\"";
+ }
+
+ if(isset($HTTP_GET_VARS['normalize'])){
+ if(strcmp($HTTP_GET_VARS['normalize'],"true")==0){
+ $NORMALIZE=1;
+ $normalize_url = "&normalize=true";
+ $def_normalize="CHECKED";
+ $def_unnormalize="";
+ }
+ else{
+ $normalize_url="";
+ $NORMALIZE=0;
+ $def_normalize="";
+ $def_unnormalize="CHECKED";
+ }
+ }
+ else{
+ $NORMALIZE=0;
+ $normalize_url="";
+ $def_normalize="";
+ $def_unnormalize="CHECKED";
+ }
+ if(isset($HTTP_GET_VARS['showdata'])){
+ if(strcmp($HTTP_GET_VARS['showdata'],"true")==0){
+ $SHOWDATA=1;
+ $showdata="&showdata=true";
+ }
+ else{
+ $SHOWDATA=0;
+ $showdata="";
+ }
+ }
+ else{
+ $SHOWDATA=0;
+ $showdata="";
+ }
+
+ if(isset($HTTP_GET_VARS['showpoints'])){
+ if(strcmp($HTTP_GET_VARS['showpoints'],"true")==0){
+ $SHOWPOINTS=1;
+ $showpoints="&showpoints=true";
+ }
+ else{
+ $SHOWPOINTS=0;
+ $showpoints="";
+ }
+ }
+ else{
+ $SHOWPOINTS=0;
+ $showpoints="";
+ }
+
+ /********************************
+ *
+ * printing error image if necessary
+ *
+ ********************************/
+ if($URL_ERROR==1){
+ printErrorMsg("URL Error: $error_msg. Could not draw graph.");
+ }
+
+ /********************************
+ *
+ * creating the page
+ *
+ ********************************/
+
+ ?>
+
+ <html>
+ <head>
+ <title>LLVM Nightly Test Results Machine Graph</title>
+ <script language="javascript">
+ function toggleLayer(whichLayer)
+ {
+ if (document.getElementById)
+ {
+ // this is the way the standards work
+ var style2 = document.getElementById(whichLayer).style;
+ style2.display = style2.display? "":"none";
+ var link = document.getElementById(whichLayer+"_").innerHTML;
+ if(link.indexOf("(+)") >= 0){
+ document.getElementById(whichLayer+"_").innerHTML="(-)"+link.substring(3,link.length);
+ }
+ else{
+ document.getElementById(whichLayer+"_").innerHTML="(+)"+link.substring(3,link.length);
+ }
+
+ }//end if
+ else if (document.all)
+ {
+ // this is the way old msie versions work
+ var style2 = document.all[whichLayer].style;
+ style2.display = style2.display? "":"none";
+ var link = document.all[wwhichLayer+"_"].innerHTML;
+ if(link.indexOf("(+)") >= 0){
+ document.all[whichLayer+"_"].innerHTML="(-)"+link.substring(3,link.length);
+ }
+ else{
+ document.all[whichLayer+"_"].innerHTML="(+)"+link.substring(3,link.length);
+ }
+
+ }
+ else if (document.layers)
+ {
+ // this is the way nn4 works
+ var style2 = document.layers[whichLayer].style;
+ style2.display = style2.display? "":"none";
+ var link = document.layers[whichLayer+"_"].innerHTML;
+ if(link.indexOf("(+)") >= 0){
+ document.layers[whichLayer+"_"].innerHTML="(-)"+link.substring(3,link.length);
+ }
+ else{
+ document.layers[whichLayer+"_"].innerHTML="(+)"+link.substring(3,link.length);
+ }
+
+ }
+
+ }//end function
+ </script>
+
+ </head>
+ <body>
+
+ <center><font size=+3 face=Verdana><b>LLVM Nightly Test Results File Size Graph</b></font></cen\
+ ter><br>
+
+ <table cellspacing=4 cellpadding=4 border=0>
+ <tr align=left>
+ <td valign=top>
+ <?
+ $machine = $HTTP_GET_VARS['machine'];
+ $night=-1;
+ include 'sidebar.php';
+ ?>
+ </td>
+ <td>
+ <?php
+
+
+ print "\t<img src=\"drawfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine_id$files_url&end=$end$normalize_url$start_url$showdata$showpoints\" alt=\"File Size Graph\" height=$ysize width=$xsize><br>\n";
+
+ /********************************
+ *
+ * creating resize links
+ *
+ ********************************/
+ $new_x = 1.25 * $xsize;
+ $new_y = 1.25 * $ysize;
+ print "Resize: <a href=\"individualfilesizegraph.php?name=File Size&xsize=$new_x&ysize=$new_y&machine=$machine$files_url&end=$end$normalize_url&start=$start\">Bigger</a> |\n";
+
+ $new_x = .8 * $xsize;
+ $new_y = .8 * $ysize;
+ print "<a href=\"individualfilesizegraph.php?name=File Size&xsize=$new_x&ysize=$new_y&machine=$machine$files_url&end=$end$normalize_url&start=$start\">Smaller</a><br>\n";
+
+
+
+ /********************************
+ *
+ * creating links to other time frames
+ *
+ ********************************/
+
+ $result = mysql_query("SELECT * FROM night WHERE machine=$machine ORDER BY added ASC") or die (mysql_error());
+ $recent=mysql_fetch_array($result);
+ $all_tests = $recent['added'];
+ mysql_free_result($result);
+
+
+ $length_statement="\"$end\" - INTERVAL 1 YEAR";
+ $length_query=mysql_query("SELECT $length_statement") or die(mysql_error());
+ $row = mysql_fetch_array($length_query);
+ mysql_free_result($length_query);
+ $one_year = $row[0];
+
+ $length_statement="\"$end\" - INTERVAL 6 MONTH";
+ $length_query=mysql_query("SELECT $length_statement") or die(mysql_error());
+ $row = mysql_fetch_array($length_query);
+ mysql_free_result($length_query);
+ $six_month = $row[0];
+
+ $length_statement="\"$end\" - INTERVAL 3 MONTH";
+ $length_query=mysql_query("SELECT $length_statement") or die(mysql_error());
+ $row = mysql_fetch_array($length_query);
+ mysql_free_result($length_query);
+ $three_month = $row[0];
+
+ $length_statement="\"$end\" - INTERVAL 1 MONTH";
+ $length_query=mysql_query("SELECT $length_statement") or die(mysql_error());
+ $row = mysql_fetch_array($length_query);
+ mysql_free_result($length_query);
+ $one_month = $row[0];
+
+ $length_statement="\"$end\" - INTERVAL 7 DAY";
+ $length_query=mysql_query("SELECT $length_statement") or die(mysql_error());
+ $row = mysql_fetch_array($length_query);
+ mysql_free_result($length_query);
+ $one_week = $row[0];
+
+ if(strcmp($start, $all_tests)!=0){
+ print "Time: <a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end&$normalize_url$showpoints$showdata&start=$all_tests\">All</a> |\n";
+ }
+ else{ print "Time: <b>All</b> |";}
+
+ if(strcmp($start, $one_year)!=0){
+ print "<a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end$normalize_url$showpoints$showdata&start=$one_year\">1 year</a> | \n";
+ }
+ else { print " <b>1 year</b> |";}
+
+ if(strcmp($start, $six_month)!=0){
+ print "<a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end$normalize_url$showpoints$showdata&start=$six_month\">6 months</a> | \n";
+ }
+ else { print " <b>6 months</b> |";}
+
+ if(strcmp($start, $three_month)!=0){
+ print "<a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end$normalize_url$showpoints$showdata&start=$three_month\">3 months</a> | \n";
+ }
+ else { print " <b>3 months</b> |";}
+
+ if(strcmp($start, $one_month)!=0){
+ print "<a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end$normalize_url$showpoints$showdata&start=$one_month\">1 month</a> | \n";
+ }
+ else { print " <b>1 month</b> |";}
+
+ if(strcmp($start, $one_week)!=0){
+ print "<a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end$normalize_url$showpoints$showdata&start=$one_week&showdata=true&showpoints=true\">1 week</a><br> \n";
+ }
+ else { print " <b>1 week</b><br>";}
+
+ if($NORMALIZE==1){
+ print "Data normalization: <b>On</b> |\n";
+ print "<a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end&normalize=false&start=$start$showdata$showpoints\">Off</a><br>\n";
+ }
+ else{
+ print "Data normalization: <a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end&normalize=true&start=$start\">On</a> |\n";
+ print "<b>Off</b><br>\n";
+ }
+
+ if($SHOWDATA==1){
+ print "Show data on graph: <b>On</b> |\n";
+ print "<a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end$normalize_url&start=$start$showpoints\">Off</a><br>\n";
+ }
+ else{
+ print "Show data on graph: <a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end$normalize_url&start=$start&$showpoints&showdata=true\">On</a> |\n";
+ print "<b>Off</b><br>\n";
+ }
+
+ if($SHOWPOINTS==1){
+ print "Show points on graph: <b>On</b> |\n";
+ print "<a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end$normalize_url&start=$start$showdata\">Off</a><br>\n";
+ }
+ else{
+ print "Show points on graph: <a href=\"individualfilesizegraph.php?name=File Size&xsize=$xsize&ysize=$ysize&machine=$machine&night=$night$files_url&end=$end$normalize_url&start=$start&$showdata&showpoints=true\">On</a> |\n";
+ print "<b>Off</b><br>\n";
+ }
+
+
+ /*
+ * Printing out data table
+ *
+ */
+ print "<br><font size=\"-1\"><a href=\"javascript://\"onclick=\"toggleLayer('dataTable');\", id=\"dataTable_\">(-) Data table</a></font>\n";
+ print "<div id=\"dataTable\" style=\"display: none;\">\n";
+
+ $all_data=array();
+ print "<table border=1 cellspacing=0 cellpadding=6>\n";
+ print "\t<tr>\n";
+ print "\t\t<td>Date</td>\n";
+ foreach ($files_arr as $m){
+ print "\t\t<td>$m</td>\n";
+ $file_data=get_file_history($mysql_link, $machine_id, $m);
+ array_push($all_data, $file_data);
+ }
+ print "\t</tr>\n";
+
+ foreach (array_keys($all_data[0]) as $d){
+ print "\t<tr>\n";
+ print "\t\t<td>$d</td>\n";
+ foreach ($all_data as $data){
+ print "\t\t<td align=center>{$data[$d][1]}</td>\n";
+ }
+ print "\t</tr>\n";
+ }
+ mysql_free_result($night_table_query);
+
+ print "</table></div>\n";
+
+ ?>
+ </td></tr></table>
+ </body></html>
+
+
+
+
+
Index: nightlytest-serverside/drawfilesizegraph.php
diff -u nightlytest-serverside/drawfilesizegraph.php:1.1 nightlytest-serverside/drawfilesizegraph.php:1.2
--- nightlytest-serverside/drawfilesizegraph.php:1.1 Wed Jul 26 18:22:54 2006
+++ nightlytest-serverside/drawfilesizegraph.php Tue Aug 1 18:19:44 2006
@@ -3,7 +3,7 @@
include("jpgraph/jpgraph_line.php");
include("jpgraph/jpgraph_utils.inc");
include("jpgraph/jpgraph_date.php");
-include("ProgramResults.php");
+include("NightlyTester2.php");
$DEBUG=0;
@@ -41,7 +41,7 @@
*
********************************/
-$resultsgraphlink=mysql_connect("localhost","llvm","ll2002vm");
+$mysql_link=mysql_connect("localhost","llvm","ll2002vm");
mysql_select_db("nightlytestresults");
/********************************
@@ -57,7 +57,7 @@
if(isset($HTTP_GET_VARS['files'])){
$files=$HTTP_GET_VARS['files'];
}
-else{$URL_ERROR=1;$error_msg="no value for program";}
+else{$URL_ERROR=1;$error_msg="no value for files";}
if(isset($HTTP_GET_VARS['xsize'])){
$xsize=$HTTP_GET_VARS['xsize'];
@@ -185,39 +185,54 @@
$index=0;
foreach ($files as $file){
- $data = get_file_history($mysql_link, $machine_id, $file)
+ $data = get_file_history($mysql_link, $machine_id, $file);
- $xdata=array();
- $values=array();
- $data_max=-1;
-
- foreach ($data as $d){
- push_array($xdata, $d[0]);
- if($d[2] > $data_max){ $data_max=$d[2]; }
- push_array($values, $d[2]);
- }
-
- if($NORMALIZE){
- for($i=0; $i<sizeof($values); $i++){
- if(is_numeric($values[$i])){
- $values[$i]=$values[$i]/$data_max;
- }#end if
- }#end for
- }#end if
+ if($DEBUG){
+ print "get_file_history($mysql_link, $machine_id, $file) returned...<br>\n";
+ foreach (array_keys($data) as $x){
+ print "$x {$data["$x"][0]} {$data["$x"][1]} {$data["$x"][2]}<br>\n";
+ }
+ }
+
+ $xdata=array();
+ $values=array();
+ $data_max=-1;
-
- $line_arr[$index] = new LinePlot($values, $xdata);
- $line_arr[$index]->SetLegend("$file");
- if($SHOWDATA==1){
- $line_arr[$index]->value->Show();
- }
- if($SHOWPOINTS==1){
- $line_arr[$index]->mark->SetType(MARK_UTRIANGLE);
- }
- $color_index=$index % sizeof($color_arr);
- $line_arr[$index]->SetColor($color_arr[$color_index]);
- $graph->Add($line_arr[$index]);
- $index++;
+ foreach (array_keys($data) as $d){
+ if($data["$d"][1]>0){
+ preg_match("/(\d\d\d\d)\-(\d\d)\-(\d\d)\s(\d\d)\:(\d\d)\:(\d\d)/", $d, $pjs);
+ $seconds = mktime($pjs[4], $pjs[5], $pjs[6], $pjs[2], $pjs[3],$pjs[1]);
+ array_push($xdata, $seconds);
+ if($data["$d"][1] > $data_max){ $data_max=$data["$d"][1]; }
+ if($DEBUG){
+ print "adding $seconds => {$data["$d"][1]}<br>\n";
+ }
+ array_push($values, $data["$d"][1]);
+ $RELEVANT_DATA++;
+ }
+ }
+
+ if($NORMALIZE){
+ for($i=0; $i<sizeof($values); $i++){
+ if(is_numeric($values[$i])){
+ $values[$i] = $values[$i] / $data_max;
+ }#end if
+}#end for
+}#end if
+
+
+ $line_arr[$index] = new LinePlot($values, $xdata);
+ $line_arr[$index]->SetLegend("$file");
+ if($SHOWDATA==1){
+ $line_arr[$index]->value->Show();
+ }
+ if($SHOWPOINTS==1){
+ $line_arr[$index]->mark->SetType(MARK_UTRIANGLE);
+ }
+ $color_index=$index % sizeof($color_arr);
+ $line_arr[$index]->SetColor($color_arr[$color_index]);
+ $graph->Add($line_arr[$index]);
+ $index++;
}#end foreach
if($RELEVANT_DATA==0){
Index: nightlytest-serverside/NightlyTester.php
diff -u nightlytest-serverside/NightlyTester.php:1.9 nightlytest-serverside/NightlyTester.php:1.10
--- nightlytest-serverside/NightlyTester.php:1.9 Tue Aug 1 15:41:37 2006
+++ nightlytest-serverside/NightlyTester.php Tue Aug 1 18:19:44 2006
@@ -168,7 +168,7 @@
* particular machine for a specific file
* Returns: an array with the key being the date and
* the value being an array containing file name, size
- * and build type
+ * night, and build type
*
*****************************************************/
function get_file_history($mysql_link, $machine_id, $file_name){
@@ -183,10 +183,15 @@
$file_query = mysql_query($file_select);
$file_array = mysql_fetch_array($file_query);
if(isset($file_array['file'])){
- $result["{$file_array['night']}"]=array("{$file_array[['file']}",
- "{$file_array[['size']}",
- "{$file_array[['type']}"));
+ $result["{$row['added']}"]=array("{$file_array['file']}",
+ "{$file_array['size']}",
+ "{$file_array['type']}");
}//end if
+ else {
+ $result["{$row['added']}"]=array("-",
+ "-",
+ "-");
+ }
mysql_free_result($file_query);
}//end while
mysql_free_result($nights_query);
More information about the llvm-commits
mailing list