# Useful functions
kilo(x) = x/1000
mega(x) = x/1000000

# Change terminal
set terminal jpeg 

# Nebulous Requests vs Time
# set output 'nebulousRequests_vs_Time.jpg'
# set xlabel 'Epoch'
# set ylabel 'Nebulous Requests'
# plot './results.gnuplot.fmt' using (mega($1)):2 title "Nebulous Requests vs Time" with lines

# # Apache Errors vs Time
# set output 'apacheErrors_vs_Time.jpg'
# set xlabel 'Epoch'
# set ylabel 'Apache Errors'
# plot './results.gnuplot.fmt' using (mega($1)):3 title "Apache Errors vs Time" with lines

# Nebulous Requests and Apache Errors vs Time
set xlabel 'Epoch (Ms)'
set ylabel 'Neb. Req. (/1000) --- Apache errors'
set output 'apacheErrors_and_nebulousRequests_vs_Time.jpg'
plot './results.gnuplot.fmt' using (mega($1)):(kilo($2)) title "Nebulous Requests vs Time" with lines, './results.gnuplot.fmt' using (mega($1)):3 title "Apache Errors vs Time" with lines

# Apache Errors vs Nebulous Requests
set output 'apacheErrors_vs_nebulousRequests.jpg'
set xlabel 'Nebulous Requests (/1000)'
set ylabel 'Apache Errors'
set yrange [0:]
set output 'apacheErrors_vs_nebulousRequests.jpg'
plot './results.gnuplot.fmt' using (kilo($2)):3 title "Apache Errors vs Nebulous Requests"

# Apache Errors vs Nebulous Requests local
set output 'apacheErrors_and_nebulousRequests_vs_time_local.jpg'
set xlabel 'Epoch'
set ylabel ''
set yrange [0:]
plot './results_extract.gnuplot.fmt' using (mega($1)):(kilo($2)) title "Nebulous Requests vs Time" with lines, './results_extract.gnuplot.fmt' using (mega($1)):3 title "Apache Errors vs Time" with lines

# Apache Errors vs Nebulous Requests local
set xlabel 'Epoch'
set ylabel ''
set yrange [0:]
set output 'apacheErrors_and_otherNebulousRequests_vs_time_local.jpg'
plot './results_extract.gnuplot.fmt' using (mega($1)):($9/50) title "Other Nebulous Requests (/50) vs Time" with lines, './results_extract.gnuplot.fmt' using (mega($1)):3 title "Apache Errors vs Time" with lines

# Apache Errors vs Non-Nebulous Requests local
set xlabel 'Epoch'
set ylabel ''
set yrange [0:]
set output 'apacheErrors_and_NonNebulousRequests_vs_time_local.jpg'
plot './results_extract.gnuplot.fmt' using (mega($1)):10 title "Non-Nebulous Requests vs Time" with lines, './results_extract.gnuplot.fmt' using (mega($1)):3 title "Apache Errors vs Time" with lines

# Apache Errors vs Non-Nebulous Requests
set output 'apacheErrors_vs_nebulousRequests.jpg'
set xlabel 'Non-Nebulous Requests'
set ylabel 'Apache Errors'
set yrange [0:]
set output 'apacheErrors_vs_nebulousRequests.jpg'
plot './results_extract.gnuplot.fmt' using (mega($1)):8 title "Non-Nebulous Requests vs Time" with lines, './results_extract.gnuplot.fmt' using (mega($1)):3 title "Apache Errors vs Time" with lines
