tools/performance/memtest/cgi/date_reflow_form.cgi

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/performance/memtest/cgi/date_reflow_form.cgi	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,106 @@
     1.4 +#!/usr/bin/perl
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +
     1.9 +
    1.10 +#______________________________________________________________________________________
    1.11 +# these variables will need to be changed to fit the host machine configuration/directories.
    1.12 +#
    1.13 +# this is where the linux.dat files live;  currently /home/usr/ftp/pub/data/memtests
    1.14 +    $directory_root = "/u/curt/reflow/results/";
    1.15 +#
    1.16 +    $host_server = "smoketest1";
    1.17 +#
    1.18 +# note: the /plots_tmp directory under $results_dir will need to be cleaned out periodically
    1.19 +# because this is where the .png files will be put on creation (it could become a memory hog)
    1.20 +    $results_dir = "/usr/local/apache/htdocs";
    1.21 +
    1.22 +# this is where gnuplot app lives
    1.23 +    $gnuplot = "/usr/bin/gnuplot";
    1.24 +#
    1.25 +#--------------------------------------------------------------------------------------
    1.26 +
    1.27 +# take in form info and convert it to usable variables --------------------------------
    1.28 +   
    1.29 +$query_string = $ENV{'QUERY_STRING'};
    1.30 +#$query_string = "first_date=04%2F17%2F01&compare_date=04%2F12%2F01";
    1.31 +
    1.32 +@key_value_pairs = split (/&/, $query_string);
    1.33 +
    1.34 +foreach $key_value (@key_value_pairs)
    1.35 +   {       
    1.36 +   ($key, $value) = split (/=/, $key_value);
    1.37 +   $value =~ tr/+/ /;
    1.38 +   $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
    1.39 +   $form_data{$key} = $value;
    1.40 +   @list_keys = keys(%form_data);
    1.41 +   @values_keys = values(%form_data);
    1.42 +   }
    1.43 +
    1.44 +# error check for user selecting both fields ------------------------------------
    1.45 +
    1.46 +$number_of_values = @key_value_pairs;
    1.47 + 
    1.48 +if ($number_of_values != 2) {
    1.49 +    print "Content-type: text/html", "\n\n";
    1.50 +
    1.51 +    print "<HTML>", "\n";
    1.52 +    print "<HEAD><TITLE>Plotting Error</TITLE><HEAD>", "\n";
    1.53 +    print "<BODY>", "\n";
    1.54 +    print "<H1>", "Plotting Error", "</H1>", "<HR>", "\n";
    1.55 +    print "Please make a selection from each of the date fields in the green form.", "\n";
    1.56 +    print "</BODY></HTML>", "\n";
    1.57 +    }
    1.58 +
    1.59 +# create variables to point to directories containg the reflow.dat files ---------------
    1.60 +
    1.61 +else {
    1.62 +    ($month, $day, $year) = split (/\//, $form_data{"first_date"});
    1.63 +    $first_date = "$year$month$day";
    1.64 +    ($month, $day, $year) = split (/\//, $form_data{"compare_date"});
    1.65 +    $compare_date = "$year$month$day";
    1.66 +    $first_date_dir = join ("/",$directory_root , $test_list, $first_date, "reflow.dat");
    1.67 +    $compare_date_dir = join ("/", $directory_root, $test_list, $compare_date, "reflow.dat");
    1.68 +    
    1.69 +
    1.70 +# generate gnuplot graph --------------------------------------------------------------
    1.71 +
    1.72 +    $process_id = $$;
    1.73 +    $output_file = join ("", $results_dir, "/plots_tmp/", $process_id, ".png");
    1.74 +    $output_location = join ("", "http://", $host_server, "/plots_tmp/", $process_id, ".png");
    1.75 +    open(GNUPLOT, "|$gnuplot");
    1.76 +    print GNUPLOT <<gnuplot_Commands_Done;
    1.77 +
    1.78 +    set term png color
    1.79 +    set output '$output_file'
    1.80 +    set title 'Reflow counts of selcted URL's on $test_list_in list on $form_data{"first_date"} and $form_data{"compare_date"}'
    1.81 +    set xlabel 'URLs'
    1.82 +    set ylabel 'Reflows'
    1.83 +    set key top left Right title 'Legend' box -1
    1.84 +    plot "$compare_date_dir" using 1:2 title "Reflows on $form_data{"compare_date"}" with line 1,"$first_date_dir" using 1:2 title "Reflows on $form_data{"first_date"}" with line 3
    1.85 +      
    1.86 +gnuplot_Commands_Done
    1.87 +
    1.88 +    close(GNUPLOT);
    1.89 +
    1.90 +# send graph to users browser----------------------------------------------------------
    1.91 +
    1.92 +    print "Location: $output_location", "\n\n";
    1.93 +
    1.94 +    }
    1.95 +#end if
    1.96 +
    1.97 +exit (0);
    1.98 +
    1.99 +
   1.100 +
   1.101 +
   1.102 +
   1.103 +
   1.104 +
   1.105 +
   1.106 +
   1.107 +
   1.108 +
   1.109 +

mercurial