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