示例#1
0
文件: mmm.py 项目: weddingjuma/PDQ
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# mmm.py
#
# Created by NJG on Fri, Apr 13, 2007
#

import pdq

# Parameters taken from mmm_sim.py file
arrivalRate = 2.0
serviceTime = 1.0

pdq.Init("M/M/m in PyDQ")
pdq.SetComment("Cf. SimPy Results.")

pdq.streams = pdq.CreateOpen("work", arrivalRate)
pdq.SetWUnit("Customers")
pdq.SetTUnit("Seconds")

pdq.nodes = pdq.CreateNode("server", 3, pdq.MSQ)

pdq.SetDemand("server", "work", serviceTime)

pdq.Solve(pdq.CANON)

pdq.Report()
示例#2
0
#---- Model specific variables ---------------------------------------

pop = 3.0
think = 0.1

#---- Initialize the model -------------------------------------------
# Give model a name and initialize internal PDQ variables

pdq.Init("Closed Queue")

#print "**** %s ****:" % (solve_as == pdq.EXACT ? "EXACT" : "APPROX")

#--- Define the workload and circuit type ----------------------------

pdq.streams = pdq.CreateClosed("w1", pdq.TERM, 1.0 * pop, think)

#--- Define the queueing center --------------------------------------

pdq.nodes = pdq.CreateNode("node", pdq.CEN, pdq.FCFS)

#---- Define service demand ------------------------------------------

pdq.SetDemand("node", "w1", 0.10)

pdq.Solve(pdq.APPROX)

pdq.Report()

#---------------------------------------------------------------------
示例#3
0
    sys.stderr.write("*** Trace state *** \n%s\n***\n" % "".join(L))
    sys.exit(1)


# PDQ modeling code starts here ...
jNet = JackNet("SimPy Jackson Network", 1)  # create an instance
pdq.Init(jNet.name)
pdq.SetWUnit("Msgs")
pdq.SetTUnit("Time")

# Create PDQ context and workload for the network
streams = pdq.CreateOpen(jNet.work, jNet.arrivRate)

# Create PDQ queues
for i in range(len(jNet.router)):
    nodes = pdq.CreateNode(jNet.router[i], pdq.CEN, pdq.FCFS)
    pdq.SetVisits(jNet.router[i], jNet.work, jNet.visitRatio[i], \
       jNet.servTime[i])

# Solve the model and report the peformance measures
pdq.Solve(pdq.CANON)
pdq.Report()
# generic PDQ format

# Collect particular PDQ statistics
print "---------- Selected PDQ Metrics for SimPy Comparison ---------"
for i in range(len(jNet.router)):
    msgs = pdq.GetQueueLength(jNet.router[i], jNet.work, pdq.TRANS)
    print "Mean queue%d: %7.4f (%s)" % (i + 1, msgs, "Not in SimPy report")
    jNet.totalMsgs += msgs
print "Mean number: %7.4f" % jNet.totalMsgs
示例#4
0
for i in range(MF_DISKS):
   demand[(MF_CD, MDarray[i].id)] = (2.0 / 60.24) / MF_DISKS
   demand[(MF_RQ, MDarray[i].id)] = (4.0 / 60.24) / MF_DISKS
   demand[(MF_SU, MDarray[i].id)] = (1.0 / 60.24) / MF_DISKS

# demand.dump()


#----- Start building the PDQ model --------------------------------------------

pdq.Init(scenario)

#  Define physical resources as queues ...

no_nodes = pdq.CreateNode("PC", pdq.CEN, pdq.FCFS)
no_nodes = pdq.CreateNode("FS", pdq.CEN, pdq.FCFS)

for i in range(FS_DISKS):
   no_nodes = pdq.CreateNode(FDarray[i].label, pdq.CEN, pdq.FCFS)

no_nodes = pdq.CreateNode("GW", pdq.CEN, pdq.FCFS)
no_nodes = pdq.CreateNode("MF", pdq.CEN, pdq.FCFS)

for i in range(MF_DISKS):
   no_nodes = pdq.CreateNode(MDarray[i].label, pdq.CEN, pdq.FCFS)

no_nodes = pdq.CreateNode("TR", pdq.CEN, pdq.FCFS)

#  NOTE: Althought the Token Ring LAN is a passive computational device,
#  it is treated as a separate node so as to agree to the results
示例#5
0
#!/usr/bin/env python
###############################################################################
#  Copyright (C) 1994 - 2009, Performance Dynamics Company                    #
#                                                                             #
#  This software is licensed as described in the file COPYING, which          #
#  you should have received as part of this distribution. The terms           #
#  are also available at http://www.perfdynamics.com/Tools/copyright.html.    #
#                                                                             #
#  You may opt to use, copy, modify, merge, publish, distribute and/or sell   #
#  copies of the Software, and permit persons to whom the Software is         #
#  furnished to do so, under the terms of the COPYING file.                   #
#                                                                             #
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# M/M/1 in PyDQ

import pdq

pdq.Init("Python Test Script")
pdq.nodes = pdq.CreateNode("Deadhorse", pdq.CEN, pdq.FCFS)
pdq.streams = pdq.CreateOpen("Floggit", 0.75)
pdq.SetWUnit("Cust")
pdq.SetTUnit("Min")
pdq.SetDemand("Deadhorse", "Floggit", 1.0)
pdq.Solve(pdq.CANON)
pdq.Report()
示例#6
0
#---- Initialize -----------------------------------------------------

pdq.Init("OpenCenter")
pdq.SetComment("A simple M/M/1 queue")

#---- Define the workload and circuit type ---------------------------

pdq.streams = pdq.CreateOpen("work", arrivRate)

pdq.SetWUnit("Customers")
pdq.SetTUnit("Seconds")

#---- Define the queueing center -------------------------------------

pdq.nodes = pdq.CreateNode("server", pdq.CEN, pdq.FCFS)

#---- Define service demand due to workload on the queueing center ---

pdq.SetDemand("server", "work", service_time)

#---- Solve the model ------------------------------------------------
#  Must use the CANONical method for an open circuit

pdq.Solve(pdq.CANON)

#---- Generate a report ----------------------------------------------

pdq.Report()

#---------------------------------------------------------------------
示例#7
0
文件: orca.py 项目: weddingjuma/PDQ
#  copies of the Software, and permit persons to whom the Software is         #
#  furnished to do so, under the terms of the COPYING file.                   #
#                                                                             #
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# Created by NJG on Wed, Apr 18, 2007
#
#
# $Id: orca.py,v 1.2 2009/03/26 02:55:32 pfeller Exp $

import pdq

# Measured parameters
servers = 4
arivrate = 0.099  # per hr
servtime = 10.0  # hrs

pdq.Init("ORCA Batch")
nstreams = pdq.CreateOpen("Crunch", arivrate)
pdq.SetWUnit("Jobs")
pdq.SetTUnit("Hours")

nnodes = pdq.CreateNode("HPC", int(servers), pdq.MSQ)

pdq.SetDemand("HPC", "Crunch", servtime)
pdq.Solve(pdq.CANON)
pdq.Report()
示例#8
0
#pop   = 200.0
pop = 100.0
think = 300.0
servt = 0.63

##### Initialize the model giving it a name ##########################

pdq.Init("Time Share Computer")
pdq.SetComment("This is just a simple M/M/1 queue.")

##### Define the workload and circuit type ###########################

pdq.streams = pdq.CreateClosed("compile", pdq.TERM, pop, think)

##### Define the queueing center #####################################

pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)

##### Define service demand ##########################################

pdq.SetDemand("CPU", "compile", servt)

##### Solve the model ################################################

pdq.Solve(pdq.EXACT)

pdq.Report()

#---------------------------------------------------------------------
示例#9
0
文件: dbc.py 项目: weddingjuma/PDQ
importrs = 300

Sifp = 0.10
Samp = 0.60
Sdsu = 1.20
Nifp = 15
Namp = 50
Ndsu = 100

pdq.Init("Teradata DBC-10/12")

# Create parallel centers

for k in range(Nifp):
    name = "IFP%d" % k
    nodes = pdq.CreateNode(name, pdq.CEN, pdq.FCFS)

for k in range(Namp):
    name = "AMP%d" % k
    nodes = pdq.CreateNode(name, pdq.CEN, pdq.FCFS)

for k in range(Ndsu):
    name = "DSU%d" % k
    nodes = pdq.CreateNode(name, pdq.CEN, pdq.FCFS)

streams = pdq.CreateClosed("query", pdq.TERM, importrs, think)

# pdq.SetGraph("query", 100) - unsupported call

for k in range(Nifp):
    name = "IFP%d" % k
示例#10
0
from math import *

arrivalRate     = 40.0/60   # cust per min
browseTime      = 45.0      # mins 
buyingTime      = 4.0       # mins
cashiers        = 3
    
pdq.Init("Big Book Store Model")
    
# Create an open circuit Jackson network
streams = pdq.CreateOpen("Customers", arrivalRate)

pdq.SetWUnit("Cust")
pdq.SetTUnit("Min")     # timebase for PDQ report

#*** New MSQ flag tells PDQ the following are multiserver nodes ***

# M/M/inf queue defined as 100 times the number of Erlangs = lambda * S
nodes = pdq.CreateNode("Browsing", int(ceil(arrivalRate * browseTime)) * 100, pdq.MSQ) 

# M/M/m where m is the number of cashiers   
nodes = pdq.CreateNode("Checkout", cashiers, pdq.MSQ) 

# Set service times ...
pdq.SetDemand("Browsing", "Customers", browseTime)
pdq.SetDemand("Checkout", "Customers", buyingTime)

pdq.Solve(pdq.CANON)
pdq.Report()
示例#11
0
    msg = priOn
else:
    msg = noPri

#---------------------------------------------------------------------

pdq.Init(msg)

#---- Workloads ------------------------------------------------------

pdq.streams = pdq.CreateClosed("Production", pdq.TERM, 20.0, 20.0)
pdq.streams = pdq.CreateClosed("Developmnt", pdq.TERM, 15.0, 15.0)

#---- Nodes ----------------------------------------------------------

pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)

if (PRIORITY):
    pdq.nodes = pdq.CreateNode("shadCPU", pdq.CEN, pdq.FCFS)

pdq.nodes = pdq.CreateNode("DK1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("DK2", pdq.CEN, pdq.FCFS)

#---- Service demands at each node -----------------------------------

pdq.SetDemand("CPU", "Production", 0.30)

if (PRIORITY):
    pdq.SetDemand("shadCPU", "Developmnt", 1.00 / (1 - Ucpu_prod))
else:
    pdq.SetDemand("CPU", "Developmnt", 1.00)
示例#12
0
文件: ex7.py 项目: nmiculinic/rassus
import pdq

L = 50
S = 0.01
pdq.Init("example 7")

nodes = pdq.CreateNode("Kanal", pdq.CEN, pdq.FCFS)
stream = pdq.CreateOpen("Poruka", L)

pdq.SetVisits("Kanal", "Poruka", 1.0 / 0.7, S)
# pdq.SetDemand("Kanal", "Poruka", S)
pdq.Solve(pdq.CANON)
pdq.Report()
示例#13
0
###############################################################################

#
# Created by NJG on Thu, May 31, 2007
#
# Blair Zajac, author of Orca states:
# "If long term trends indicate increasing figures, more or faster CPUs
# will eventually be necessary unless load can be displaced. For ideal
# utilization of your CPU, the maximum value here should be equal to the
# number of CPUs in the box."
#
# Zajac's comment implies any waiting line is bad.
# PDQ steady-state model for HPC/batch workload with
# stretch factor == 1 (no waiting line).
# Very low arrival rate over 10 hour period.

import pdq

processors = 4
arrivalRate = 0.099  # jobs per hour (very low arrivals)
crunchTime = 10.0  # hours (very long service time)

pdq.Init("ORCA LA Model")
s = pdq.CreateOpen("Crunch", arrivalRate)
n = pdq.CreateNode("HPCnode", int(processors), pdq.MSQ)
pdq.SetDemand("HPCnode", "Crunch", crunchTime)
pdq.SetWUnit("Jobs")
pdq.SetTUnit("Hour")
pdq.Solve(pdq.CANON)
pdq.Report()
示例#14
0
# Service times in seconds
S = array([20, 600, 300, 60])

# Service demands in seconds
D = array([v[0] * S[0], v[1] * S[1], v[2] * S[2], v[3] * S[3]])
""" Use the service demands derived from the solved traffic equations 
    to parameterize and solve PyDQ queueing model of the passport office
"""

# Initialize and solve the model
pdq.Init("Passport Office")

numStreams = pdq.CreateOpen("Applicant", L[0])

numNodes = pdq.CreateNode("Window0", pdq.CEN, pdq.FCFS)
numNodes = pdq.CreateNode("Window1", pdq.CEN, pdq.FCFS)
numNodes = pdq.CreateNode("Window2", pdq.CEN, pdq.FCFS)
numNodes = pdq.CreateNode("Window3", pdq.CEN, pdq.FCFS)

pdq.SetDemand("Window0", "Applicant", D[0])
pdq.SetDemand("Window1", "Applicant", D[1])
pdq.SetDemand("Window2", "Applicant", D[2])
pdq.SetDemand("Window3", "Applicant", D[3])

pdq.Solve(pdq.CANON)
pdq.Report()

# Utilizations: L_0 * D_k
r = array([L[0] * D[0], L[0] * D[1], L[0] * D[2], L[0] * D[3]])
示例#15
0
#  Test Exact.c lib
#
#  From A.Allen Example 6.3.4, p.413
#---------------------------------------------------------------------

pdq.Init("Multiclass Test")

#---- Define the workload and circuit type ---------------------------

pdq.streams = pdq.CreateClosed("term1", pdq.TERM, 5.0, 20.0)
pdq.streams = pdq.CreateClosed("term2", pdq.TERM, 15.0, 30.0)
pdq.streams = pdq.CreateClosed("batch", pdq.BATCH, 5.0, 0.0)

#---- Define the queueing center -------------------------------------

pdq.nodes = pdq.CreateNode("node1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("node2", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("node3", pdq.CEN, pdq.FCFS)

#---- Define service demand ------------------------------------------

pdq.SetDemand("node1", "term1", 0.50)
pdq.SetDemand("node1", "term2", 0.04)
pdq.SetDemand("node1", "batch", 0.06)

pdq.SetDemand("node2", "term1", 0.40)
pdq.SetDemand("node2", "term2", 0.20)
pdq.SetDemand("node2", "batch", 0.30)

pdq.SetDemand("node3", "term1", 1.20)
pdq.SetDemand("node3", "term2", 0.05)
示例#16
0
Pcpu = 0.0
Ubrd = 0.0
Ubwr = 0.0
Ubin = 0.0
Ucht = 0.0
Ucrd = 0.0
Ucwr = 0.0
Ucin = 0.0

#---------------------------------------------------------------------

pdq.Init("ABC Model")

#----- Create single bus queueing center -----------------------------

nodes = pdq.CreateNode(BUS, pdq.CEN, pdq.FCFS)

#----- Create per CPU cache queueing centers -------------------------

for i in range(MAXCPU):
    cname = "%s%d" % (L2C, i)
    nodes = pdq.CreateNode(cname, pdq.CEN, pdq.FCFS)

#----- Create CPU nodes, workloads, and demands ----------------------

(no, Wrwht) = intwt(Nrwht)

print "no %d %f  Nrwht %d, Wrwht %d" % (no, no, Nrwht, Wrwht)

for i in range(no):
    wname = "%s%d" % (RWHT, i)
示例#17
0
#  This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY  #
#  KIND, either express or implied.                                           #
###############################################################################

#
# Created by NJG on Wed, Apr 18, 2007
#
# Queueing model of an email-spam analyzer system comprising a
# battery of SMP servers essentially running in batch mode.
# Each node was a 4-way SMP server.
# The performance metric of interest was the mean queue length.
#
# This simple M/M/4 model gave results that were in surprisingly
# good agreement with monitored queue lengths.
#
# $Id: spamcan.py,v 1.2 2009/03/26 02:55:32 pfeller Exp $

import pdq

# Measured parameters
servers = 4
arivrate = 0.66  # per min
servtime = 6.0  # seconds

pdq.Init("SPAM Analyzer")
nstreams = pdq.CreateOpen("Email", arivrate)
nnodes = pdq.CreateNode("spamCan", int(servers), pdq.MSQ)
pdq.SetDemand("spamCan", "Email", servtime)
pdq.Solve(pdq.CANON)
pdq.Report()
示例#18
0
p12 = 0.30
p13 = 0.70
p23 = 0.20
p32 = 0.10

w3 = (p13 + p23 * p12) / (1 - p23 * p32)
w2 = p12 + p32 * w3

#---- Initialize and solve the model ---------------------------------

pdq.Init("Passport Office")

pdq.streams = pdq.CreateOpen("Applicant", 0.00427)

pdq.nodes = pdq.CreateNode("Window1", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Window2", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Window3", pdq.CEN, pdq.FCFS)
pdq.nodes = pdq.CreateNode("Window4", pdq.CEN, pdq.FCFS)

pdq.SetDemand("Window1", "Applicant", 20.0)
pdq.SetDemand("Window2", "Applicant", 600.0 * w2)
pdq.SetDemand("Window3", "Applicant", 300.0 * w3)
pdq.SetDemand("Window4", "Applicant", 60.0)

pdq.Solve(pdq.CANON)

pdq.Report()

#---------------------------------------------------------------------
示例#19
0
#  KIND, either express or implied.                                           #
###############################################################################

#
# Created by NJG on Wed, Apr 18, 2007
#
# Queueing model of an email-spam analyzer system comprising a
# battery of SMP servers essentially running in batch mode.
# Each node was a 4-way SMP server.
# The performance metric of interest was the mean queue length.
#
# This simple M/M/4 model gave results that were in surprisingly
# good agreement with monitored queue lengths.
#
# $Id: spamcan1.py,v 1.2 2009/03/31 00:48:34 pfeller Exp $

import pdq

# Measured performance parameters
cpusPerServer = 4
emailThruput = 2376  # emails per hour
scannerTime = 6.0  # seconds per email

pdq.Init("Spam Farm Model")
# Timebase is SECONDS ...
nstreams = pdq.CreateOpen("Email", float(emailThruput) / 3600)
nnodes = pdq.CreateNode("spamCan", int(cpusPerServer), pdq.MSQ)
pdq.SetDemand("spamCan", "Email", scannerTime)
pdq.Solve(pdq.CANON)
pdq.Report()
示例#20
0
#---------------------------------------------------------------------
# Based on open_feedback

rx_prob = 0.30
inter_arriv_rate = 0.5
service_time = 0.75
mean_visits = 1.0 / (1.0 - rx_prob)

#----- Initialize the model ------------------------------------------

pdq.Init("Open Feedback")

#---- Define the queueing center -------------------------------------

pdq.nodes = pdq.CreateNode("channel", pdq.CEN, pdq.FCFS)

#---- Define the workload and circuit type ---------------------------

pdq.streams = pdq.CreateOpen("message", inter_arriv_rate)

#---- Define service demand due to workload on the queueing center ---

pdq.SetVisits("channel", "message", mean_visits, service_time)

#---- Must import the CANONical method for an open circuit -----------

pdq.Solve(pdq.CANON)

pdq.Report()