Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
#170 some graphs into report
Browse files Browse the repository at this point in the history
  • Loading branch information
taivop committed Dec 6, 2016
1 parent 5ac211f commit dae2889
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
Binary file modified report/milestone3.pdf
Binary file not shown.
14 changes: 13 additions & 1 deletion report/milestone3.tex
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,26 @@ \section{System as One Unit}\label{sec:system-one-unit}

took service rate to be max of throughput and arrival rate as mean of throughput


\todo{Table of predicted vs actual numbers about the system}

Once I have parameters, calculate:
\begin{itemize}
\item mean number of jobs in system and queue, using Little's law (Ch30.2)
\item distribution of number of jobs in system and queue
\end{itemize}

\begin{figure}[h]
\includegraphics[width=\textwidth]{../results/analysis/part1_mm1/graphs/job_count_dist_actual_and_predicted.pdf}
\caption{ \todo{} }
\label{fig:part1:job_count_dist}
\end{figure}

\begin{figure}[h]
\includegraphics[width=\textwidth]{../results/analysis/part1_mm1/graphs/quantiles_actual_and_predicted.pdf}
\caption{ \todo{} note x scale huge difference}
\label{fig:part1:quantiles}
\end{figure}


\clearpage
% --------------------------------------------------------------------------------
Expand Down
52 changes: 50 additions & 2 deletions scripts/r/part1_mm1.r
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ print(paste0("Traffic intensity: ", round(traffic_intensity, digits=2)))
predicted = list()
predicted$type <- "predicted"
predicted$mean_num_jobs_in_system <- traffic_intensity / (1-traffic_intensity)
predicted$std_num_jobs_in_system <- traffic_intensity / (1-traffic_intensity)^2
predicted$mean_num_jobs_in_queue <- traffic_intensity^2 / (1-traffic_intensity)
predicted$utilisation <- 1 - traffic_intensity
predicted$mean_response_time <- 1 / (service_rate) / (1 - traffic_intensity) * 1000 # ms
predicted$response_time_q50 <- predicted$mean_response_time * log(100 / (100-50))
predicted$response_time_q95 <- predicted$mean_response_time * log(100 / (100-95))
predicted$response_time_q50 <- predicted$mean_response_time * log(1 / (1-0.5))
predicted$response_time_q95 <- predicted$mean_response_time * log(1 / (1-0.95))

# ---- Actual results ----
actual = list()
Expand All @@ -72,10 +73,57 @@ response_times <- requests$timeReturned - requests$timeEnqueued

actual$type <- "actual"
actual$mean_num_jobs_in_system <- means$total
actual$std_num_jobs_in_system <- sum(distributions$total * (distributions$num_elements-means$total)^2)
actual$mean_num_jobs_in_queue <- means$queue
actual$utilisation <- 1 - (distributions %>% filter(num_elements==0))$total
actual$mean_response_time <- mean(response_times)
actual$response_time_q50 <- quantile(response_times, probs=c(0.5))
actual$response_time_q95 <- quantile(response_times, probs=c(0.95))

comparison <- rbind(data.frame(predicted), data.frame(actual))





# ---- Plots ----
# Distribution of number of jobs in system
num_elements <- distributions$num_elements
actual_prob <- distributions$total
predicted_prob <- (1-traffic_intensity) * traffic_intensity^num_elements

data1 <- data.frame(num_elements, actual=actual_prob, predicted=predicted_prob) %>%
melt(id.vars=c("num_elements"))

ggplot(data1, aes(x=num_elements, y=value, color=variable, fill=variable)) +
geom_bar(stat="identity") +
facet_wrap(~variable, nrow=1) +
xlab("Number of jobs in the system") +
ylab("Probability") +
asl_theme
ggsave(paste0(output_dir, "/graphs/job_count_dist_actual_and_predicted.pdf"),
width=fig_width, height=fig_height/2)

# Quantiles of response time
quantiles <- c(0.01, 0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95, 0.99)
actual_response_times <- quantile(response_times, probs=quantiles)
predicted_response_times <- predicted$mean_response_time * log(100 / (100-quantiles))
predicted_response_times <- ifelse(quantiles > 1-traffic_intensity, predicted_response_times, 0)

data2 <- data.frame(quantiles, actual=actual_response_times,
predicted=predicted_response_times) %>%
melt(id.vars=c("quantiles"))
ggplot(data2, aes(x=value, y=quantiles, color=variable)) +
geom_line(size=1) +
geom_point(size=2) +
facet_wrap(~variable, scales="free_x") +
xlab("Response time") +
ylab("Quantile") +
asl_theme
ggsave(paste0(output_dir, "/graphs/quantiles_actual_and_predicted.pdf"),
width=fig_width, height=fig_height/2)





0 comments on commit dae2889

Please sign in to comment.