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
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
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 print "Mean delay: %7.4f %11s" % (pdq.GetResponse(pdq.TRANS, jNet.work), \ "(Little's law Q = X R holds!)") print "Mean stime: %7.4f %11s" % (0, "(Not in this version of PyDQ)") print "Mean rate: %7.4f" % pdq.GetThruput(pdq.TRANS, jNet.work) #print "Max rate: %5.4f" % pdq.GetThruMax(pdq.TRANS, work) print "Max rate: %7.4f %11s" % (0, "(Not in this version of PyDQ)")
(no, Wwthr) = intwt(Nwthr) for i in range(no): wname = "%s%d" % (WROP, i) Ubwr += pdq.GetUtilization(BUS, wname, pdq.TERM) Ubwr *= Wwthr #----- Cache measures at CPU[0] only --------------------------------- i = 0 cname = "%s%d" % (L2C, i) wname = "%s%d" % (RWHT, i) Xcpu = pdq.GetThruput(pdq.TERM, wname) * Wrwht Pcpu += Xcpu * Zrwht Ucht = pdq.GetUtilization(cname, wname, pdq.TERM) * Wrwht wname = "%s%d" % (RDOP, i) Xcpu = pdq.GetThruput(pdq.TERM, wname) * Wrdop Pcpu += Xcpu * Zrdop Ucrd = pdq.GetUtilization(cname, wname, pdq.TERM) * Wrdop Pcpu *= 1.88 if (WBACK): wname = "%s%d" % (WROP, i) Ucwr = pdq.GetUtilization(cname, wname, pdq.TERM) * Wwbop