Permalink
Browse files

More R scripts

  • Loading branch information...
1 parent e55115f commit 97a28a401fd9fde3d3df2a64c4970b3cc9af6ecf Brendan Gregg committed Oct 21, 2012
Showing with 55 additions and 3 deletions.
  1. +3 −1 README
  2. BIN r-scale.pdf
  3. +2 −2 r-scale.r
  4. BIN r-util-md1.pdf
  5. +50 −0 r-util-md1.r
View
4 README
@@ -5,7 +5,9 @@ This is some software to aid performance scalability analysis. It includes:
gnuplot-linear Linear scalability model
gnuplot-amdahl Amdahl's law scalability
gnuplot-usl Universal Scalabitily Law
- data.txt sample input file
+ r-scale.r Scalability Models (Amdahl, USL)
+ r-util-md1.r Queueing Theory M/D/1 mean response time vs util
+ data.txt Sample input file for scalability modeling
There are more projects rather than stand-alone tools; expect to customize them
for each system you are modeling, and these assume you already understand
View
Binary file not shown.
View
@@ -4,7 +4,7 @@
# Universal Scalability Law to the input data set. It uses regression
# analysis to determine the constants.
#
-# USAGE: R --save < r-scale.r
+# USAGE: R --save < r-scale.r # generates r-scale.pdf
#
# See the "Tunables" section for defining the input data file, and the number
# of rows to include as model input. The remainder of rows are drawn as
@@ -49,7 +49,7 @@
filename <- "data.txt" # data file (see top comment for format)
inputN <- 10 # rows to include as model input
padding <- 1.1 # chart padding
-#pdf("r-scale.pdf", w=10, h=6) # uncomment for PDF output
+pdf("r-scale.pdf", w=10, h=6) # comment for interactive
# Input
input_full <- read.table(filename, header=TRUE)
View
Binary file not shown.
View
@@ -0,0 +1,50 @@
+# r-util-md1.r Queueing Theory M/D/1 mean response time vs utilization
+#
+# USAGE: R --save < r-util-md1.r # generates r-util-md1.pdf
+#
+# See the "Tunables" section for defining the mean service time.
+#
+# Copyright 2012 Brendan Gregg. All rights reserved.
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# 20-Oct-2012 Brendan Gregg Created this.
+
+# Tunables
+svc_ms <- 1 # average disk I/O service time
+pdf("r-util-md1.pdf", w=10, h=6) # comment for interactive
+util_min <- 0
+util_max <- 100
+ms_min <- 0
+ms_max <- 10
+
+# Plot mean response time vs utilization (M/D/1)
+plot(x <- c(util_min:util_max), svc_ms * (2 - x/100) / (2 * (1 - x/100)),
+ type="l", lty=1, lwd=1,
+ xlim=c(util_min, util_max), ylim=c(ms_min, ms_max),
+ xlab="Utilization %", ylab="Mean Response Time (ms)")
+
+# Grids
+abline(v=(seq(util_min, util_max, (util_max - util_min) / 10)),
+ col="lightgray", lty="dotted")
+abline(h=(seq(ms_min, ms_max, (ms_max - ms_min) / 10)),
+ col="lightgray", lty="dotted")
+
+title("Single Service Queue, Constant Service Times (M/D/1)")

0 comments on commit 97a28a4

Please sign in to comment.