diff --git a/DAS/observer.py b/DAS/observer.py index da912b0..9d03d9e 100644 --- a/DAS/observer.py +++ b/DAS/observer.py @@ -90,6 +90,7 @@ class Observer: arrived = 0 expected = 0 ready = 0 + ready1 = ready2 = ready3 = 0 nodes = 0 f1 = f2 = f3 = 0 @@ -102,10 +103,13 @@ class Observer: f3 += f[0] + f[1] + f[2] + f[3] arrived += a expected += e - if a == e: - ready += 1 + if a == e: ready += 1 + if f[0] + f[1] == e: ready1 += 1 + if f[0] + f[1] + f[2] == e: ready2 += 1 + if f[0] + f[1] + f[2] + f[3] == e: ready3 += 1 nodes += 1 - return (arrived / expected, f3/expected, f2/expected, f1/expected, ready / nodes) + return (arrived / expected, f3/expected, f2/expected, f1/expected, + ready / nodes, ready3 / nodes, ready2 / nodes, ready1 / nodes) def getTrafficStats(self, validators): """Summary statistics of traffic measurements in a timestep.""" diff --git a/DAS/simulator.py b/DAS/simulator.py index a395d17..9da8d7f 100644 --- a/DAS/simulator.py +++ b/DAS/simulator.py @@ -297,7 +297,8 @@ class Simulator: self.validators[i].send() self.logger.debug("PHASE PROGRESS STATS %d" % steps, extra=self.format) missingSamples, sampleProgress, nodeProgress, validatorAllProgress, validatorProgress = self.glob.getProgress(self.validators) - samplingProgressAll, samplingProgress3, samplingProgress2, samplingProgress1, _ = self.glob.getSamplingProgress(self.validators) + (samplingProgressAll, samplingProgress3, samplingProgress2, samplingProgress1, + samplingReadyAll, samplingReady3, samplingReady2, samplingReady1) = self.glob.getSamplingProgress(self.validators) self.logger.debug("PHASE RECEIVE %d" % steps, extra=self.format) for i in range(1,self.shape.numberNodes): self.validators[i].receiveRowsColumns() @@ -320,17 +321,24 @@ class Simulator: self.validators[i].updateStats() trafficStatsVector.append(trafficStats) - self.logger.info("step %d, arrived %0.02f %%, ready %0.02f %%, validatedall %0.02f %%, validated %0.02f %%, sampled %0.02f %%" + self.logger.info(("step %d, arrived %0.02f %%, ready %0.02f %%, validatedall %0.02f %%, validated %0.02f %%," + + " sampled %0.02f/%0.02f/%0.02f/%0.02f %%, samplingReady %0.02f/%0.02f/%0.02f/%0.02f %%") % (steps, sampleProgress*100, nodeProgress*100, validatorAllProgress*100, validatorProgress*100, - samplingProgressAll*100), extra=self.format) + samplingProgressAll*100, samplingProgress3*100, samplingProgress2*100, samplingProgress1*100, + samplingReadyAll*100, samplingReady3*100, samplingReady2*100, samplingReady1*100 + ), extra=self.format) cnS = "samples received" cnN = "nodes ready" cnV = "validators ready" - cnDASall = "DASampling ready (query all)" - cnDAS3 = "DASampling ready (query 3)" - cnDAS2 = "DASampling ready (query 2)" - cnDAS1 = "DASampling ready (query 1)" + cnDASall = "DASampling progress (query all)" + cnDAS3 = "DASampling progress (query 3)" + cnDAS2 = "DASampling progress (query 2)" + cnDAS1 = "DASampling progress (query 1)" + cnDASReadyall = "DASampling ready (query all)" + cnDASReady3 = "DASampling ready (query 3)" + cnDASReady2 = "DASampling ready (query 2)" + cnDASReady1 = "DASampling ready (query 1)" cnT0 = "TX builder mean" cnT1 = "TX class1 mean" cnT2 = "TX class2 mean" @@ -347,6 +355,10 @@ class Simulator: cnDAS3:samplingProgress3, cnDAS2:samplingProgress2, cnDAS1:samplingProgress1, + cnDASReadyall:samplingReadyAll, + cnDASReady3:samplingReady3, + cnDASReady2:samplingReady2, + cnDASReady1:samplingReady1, cnT0: trafficStats[0]["Tx"]["mean"], cnT1: trafficStats[1]["Tx"]["mean"], cnT2: trafficStats[2]["Tx"]["mean"], diff --git a/DAS/visualizor.py b/DAS/visualizor.py index bcb4898..80cb4af 100644 --- a/DAS/visualizor.py +++ b/DAS/visualizor.py @@ -112,10 +112,14 @@ class Visualizor: vector1 = result.metrics["progress"]["nodes ready"] vector2 = result.metrics["progress"]["validators ready"] vector3 = result.metrics["progress"]["samples received"] - vector4 = result.metrics["progress"]["DASampling ready (query all)"] - vector5 = result.metrics["progress"]["DASampling ready (query 3)"] - vector6 = result.metrics["progress"]["DASampling ready (query 2)"] - vector7 = result.metrics["progress"]["DASampling ready (query 1)"] + vector4 = result.metrics["progress"]["DASampling progress (query all)"] + vector5 = result.metrics["progress"]["DASampling progress (query 3)"] + vector6 = result.metrics["progress"]["DASampling progress (query 2)"] + vector7 = result.metrics["progress"]["DASampling progress (query 1)"] + vector8 = result.metrics["progress"]["DASampling ready (query all)"] + vector9 = result.metrics["progress"]["DASampling ready (query 3)"] + vector10 = result.metrics["progress"]["DASampling ready (query 2)"] + vector11 = result.metrics["progress"]["DASampling ready (query 1)"] conf = {} attrbs = self.__get_attrbs__(result) conf["textBox"] = "Block Size R: "+attrbs['bsrn']+"\nBlock Size C: "+attrbs['bscn']\ @@ -124,12 +128,13 @@ class Visualizor: conf["type"] = "plot" conf["legLoc"] = 2 conf["desLoc"] = 2 - conf["colors"] = ["g-", "b-", "r-", "m-", "m--", "m-.", "m:"] + conf["colors"] = ["g-", "b-", "r-", "m-", "m--", "m-.", "m:", "c-", "c--", "c-.", "c:"] conf["labels"] = ["Nodes", "Validators", "Custody samples", - "DASampling (query all)", "DASampling (query 3)", "DASampling (query 2)", "DASampling (query 1)"] + "DASampling progress (query all)", "DASampling progress (query 3)", "DASampling progress (query 2)", "DASampling progress (query 1)", + "DASampling ready (query all)", "DASampling ready (query 3)", "DASampling ready (query 2)", "DASampling ready (query 1)"] conf["xlabel"] = "Time (ms)" conf["ylabel"] = "Ratio of all (0..1)" - conf["data"] = [vector1, vector2, vector3, vector4, vector5, vector6, vector7] + conf["data"] = [vector1, vector2, vector3, vector4, vector5, vector6, vector7, vector8, vector9, vector10, vector11 ] conf["xdots"] = [x*self.config.stepDuration for x in range(len(vector1))] conf["path"] = plotPath+"/nodesReady.png" maxi = 0