Esempio n. 1
0
def GetProdU():
    pdq.Init("")

    pdq.streams = pdq.CreateClosed("Production", pdq.TERM, 20.0, 20.0)
    pdq.nodes = pdq.CreateNode("CPU", pdq.CEN, pdq.FCFS)
    pdq.nodes = pdq.CreateNode("DK1", pdq.CEN, pdq.FCFS)
    pdq.nodes = pdq.CreateNode("DK2", pdq.CEN, pdq.FCFS)

    pdq.SetDemand("CPU", "Production", 0.30)
    pdq.SetDemand("DK1", "Production", 0.08)
    pdq.SetDemand("DK2", "Production", 0.10)

    pdq.Solve(pdq.APPROX)

    return (pdq.GetUtilization("CPU", "Production", pdq.TERM))
Esempio n. 2
0
def multiserver(m, stime):
    work = "reqs"
    node = "bus"

    x = 0.0

    for i in range(1, CPUS + 1):
        if (i <= m):
            pdq.Init("multibus")

            streams = pdq.CreateClosed(work, pdq.TERM, i, 0.0)
            nodes = pdq.CreateNode(node, pdq.CEN, pdq.ISRV)

            pdq.SetDemand(node, work, stime)
            pdq.Solve(pdq.EXACT)

            x = pdq.GetThruput(pdq.TERM, work)

            sm_x[i] = x
        else:
            sm_x[i] = x
Esempio n. 3
0
def mem_model(n, m):
    x = 0.0

    for i in range(1, n + 2):
        if (i <= m):
            pdq.Init("")

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

            pdq.streams = pdq.CreateClosed("work", pdq.TERM, i, 0.0)

            pdq.SetDemand("CPU", "work", 3.0)
            pdq.SetDemand("DK1", "work", 4.0)
            pdq.SetDemand("DK2", "work", 2.0)

            pdq.Solve(pdq.EXACT)

            x = pdq.GetThruput(pdq.TERM, "work")

            sm_x.append(x)
        else:
            sm_x.append(x)  # last computed value
Esempio n. 4
0
# 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
    pdq.SetDemand(name, "query", Sifp / Nifp)

for k in range(Namp):
    name = "AMP%d" % k
    pdq.SetDemand(name, "query", Samp / Namp)

for k in range(Ndsu):
    name = "DSU%d" % k
    pdq.SetDemand(name, "query", Sdsu / Ndsu)
Esempio n. 5
0
#---------------------------------------------------------------------

if (PRIORITY):
    Ucpu_prod = GetProdU()
    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)
Esempio n. 6
0
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()
Esempio n. 7
0
import pdq

#---------------------------------------------------------------------
#  Based on multiclass-test.c
#
#  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)
Esempio n. 8
0
#----- 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)

    streams = pdq.CreateClosed(wname, pdq.TERM, Nrwht, Zrwht)

    cname = "%s%d" % (L2C, i)

    pdq.SetDemand(cname, wname, 1.0)
    pdq.SetDemand(BUS, wname, 0.0)  # no bus activity

    print "i %2d  cname %10s  nodes %2d  streams %d" % (i, cname, nodes,
                                                        streams)

(no, Wrdop) = intwt(Nrdop)

print "no %d  Nrdop %d, Wrdop %d" % (no, Nrdop, Wrdop)

for i in range(no):
    wname = "%s%d" % (RDOP, i)
Esempio n. 9
0
##### Model specific variables #######################################

#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()