tools/performance/memtest/cgi/date_reflow_form.cgi

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 #!/usr/bin/perl
     2 # This Source Code Form is subject to the terms of the Mozilla Public
     3 # License, v. 2.0. If a copy of the MPL was not distributed with this
     4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     7 #______________________________________________________________________________________
     8 # these variables will need to be changed to fit the host machine configuration/directories.
     9 #
    10 # this is where the linux.dat files live;  currently /home/usr/ftp/pub/data/memtests
    11     $directory_root = "/u/curt/reflow/results/";
    12 #
    13     $host_server = "smoketest1";
    14 #
    15 # note: the /plots_tmp directory under $results_dir will need to be cleaned out periodically
    16 # because this is where the .png files will be put on creation (it could become a memory hog)
    17     $results_dir = "/usr/local/apache/htdocs";
    19 # this is where gnuplot app lives
    20     $gnuplot = "/usr/bin/gnuplot";
    21 #
    22 #--------------------------------------------------------------------------------------
    24 # take in form info and convert it to usable variables --------------------------------
    26 $query_string = $ENV{'QUERY_STRING'};
    27 #$query_string = "first_date=04%2F17%2F01&compare_date=04%2F12%2F01";
    29 @key_value_pairs = split (/&/, $query_string);
    31 foreach $key_value (@key_value_pairs)
    32    {       
    33    ($key, $value) = split (/=/, $key_value);
    34    $value =~ tr/+/ /;
    35    $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
    36    $form_data{$key} = $value;
    37    @list_keys = keys(%form_data);
    38    @values_keys = values(%form_data);
    39    }
    41 # error check for user selecting both fields ------------------------------------
    43 $number_of_values = @key_value_pairs;
    45 if ($number_of_values != 2) {
    46     print "Content-type: text/html", "\n\n";
    48     print "<HTML>", "\n";
    49     print "<HEAD><TITLE>Plotting Error</TITLE><HEAD>", "\n";
    50     print "<BODY>", "\n";
    51     print "<H1>", "Plotting Error", "</H1>", "<HR>", "\n";
    52     print "Please make a selection from each of the date fields in the green form.", "\n";
    53     print "</BODY></HTML>", "\n";
    54     }
    56 # create variables to point to directories containg the reflow.dat files ---------------
    58 else {
    59     ($month, $day, $year) = split (/\//, $form_data{"first_date"});
    60     $first_date = "$year$month$day";
    61     ($month, $day, $year) = split (/\//, $form_data{"compare_date"});
    62     $compare_date = "$year$month$day";
    63     $first_date_dir = join ("/",$directory_root , $test_list, $first_date, "reflow.dat");
    64     $compare_date_dir = join ("/", $directory_root, $test_list, $compare_date, "reflow.dat");
    67 # generate gnuplot graph --------------------------------------------------------------
    69     $process_id = $$;
    70     $output_file = join ("", $results_dir, "/plots_tmp/", $process_id, ".png");
    71     $output_location = join ("", "http://", $host_server, "/plots_tmp/", $process_id, ".png");
    72     open(GNUPLOT, "|$gnuplot");
    73     print GNUPLOT <<gnuplot_Commands_Done;
    75     set term png color
    76     set output '$output_file'
    77     set title 'Reflow counts of selcted URL's on $test_list_in list on $form_data{"first_date"} and $form_data{"compare_date"}'
    78     set xlabel 'URLs'
    79     set ylabel 'Reflows'
    80     set key top left Right title 'Legend' box -1
    81     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
    83 gnuplot_Commands_Done
    85     close(GNUPLOT);
    87 # send graph to users browser----------------------------------------------------------
    89     print "Location: $output_location", "\n\n";
    91     }
    92 #end if
    94 exit (0);

mercurial