diff --git a/DAS/simulator.py b/DAS/simulator.py index c8d621a..4ead52b 100644 --- a/DAS/simulator.py +++ b/DAS/simulator.py @@ -9,6 +9,7 @@ from DAS.tools import * from DAS.results import * from DAS.observer import * from DAS.validator import * +from time import time class Simulator: """This class implements the main DAS simulator.""" @@ -239,7 +240,9 @@ class Simulator: progressVector = [] trafficStatsVector = [] steps = 0 + # stepsLapses = [] while(True): + # tic = time() missingVector.append(missingSamples) oldMissingSamples = missingSamples self.logger.debug("PHASE SEND %d" % steps, extra=self.format) @@ -264,10 +267,12 @@ class Simulator: for i in range(0,self.shape.numberNodes): self.validators[i].updateStats() trafficStatsVector.append(trafficStats) + # toc = time() missingSamples, sampleProgress, nodeProgress, validatorAllProgress, validatorProgress = self.glob.getProgress(self.validators) self.logger.info("step %d, arrived %0.02f %%, ready %0.02f %%, validatedall %0.02f %%, , validated %0.02f %%" % (steps, sampleProgress*100, nodeProgress*100, validatorAllProgress*100, validatorProgress*100), extra=self.format) + # stepsLapses.append(toc - tic) cnS = "samples received" cnN = "nodes ready" @@ -306,6 +311,8 @@ class Simulator: missingVector.append(missingSamples) break steps += 1 + + # print(f"(send: {self.shape.sendDqSize}, receive: {self.shape.receivedDqSize}) => {stepsLapses}") progress = pd.DataFrame(progressVector) if self.config.saveRCdist: diff --git a/dqPerformancePlot.py b/dqPerformancePlot.py new file mode 100644 index 0000000..aef0584 --- /dev/null +++ b/dqPerformancePlot.py @@ -0,0 +1,371 @@ +import matplotlib.pyplot as plt +import os + + +def plotData(conf): + plt.clf() + plt.grid(True) + props = dict(boxstyle="round", facecolor="wheat", alpha=0.5) + plt.text( + 0.05, + 0.05, + conf["textBox"], + fontsize=10, + verticalalignment="bottom", + transform=plt.gca().transAxes, + bbox=props, + ) + plt.plot(conf["data"]) + + plt.title(conf["title"]) + plt.ylabel(conf["ylabel"]) + plt.xlabel(conf["xlabel"]) + plt.xticks(fontsize=10) + plt.yticks(fontsize=10) + plt.savefig(conf["path"], bbox_inches="tight") + + +plot_dir = "plotts/" +os.makedirs(plot_dir, exist_ok=True) + +# 5k Nodes +sizes = [ + (39, 395, 103.05640840530396), + (32, 395, 103.86710143089294), + (25, 315, 104.80244779586792), + (18, 115, 142.61494040489197), + (10, 31, 171.9263310432434), + (7, 10, 191.59916806221008), +] +stepsLapses = [ + [ + 0.6611301898956299, + 0.78688645362854, + 1.5642898082733154, + 5.431450366973877, + 13.975221633911133, + 14.78571629524231, + 14.83137059211731, + 14.895769596099854, + 14.69313931465149, + 13.231345176696777, + 4.99576997756958, + 0.702993631362915, + 0.650822639465332, + 0.6674363613128662, + ], + [ + 0.663672685623169, + 0.7919363975524902, + 1.5719895362854004, + 5.482329845428467, + 14.163940191268921, + 14.958719730377197, + 14.957429647445679, + 14.9972825050354, + 14.719813108444214, + 13.26242971420288, + 5.092689514160156, + 0.7198760509490967, + 0.6541843414306641, + 0.6386010646820068, + ], + [ + 0.6593191623687744, + 0.7860581874847412, + 1.5643928050994873, + 5.462092399597168, + 14.010809421539307, + 14.780933380126953, + 14.842840433120728, + 14.740232229232788, + 14.375006914138794, + 10.070922613143921, + 4.714495897293091, + 4.901551246643066, + 2.7569775581359863, + ], + [ + 0.6627669334411621, + 0.787919282913208, + 1.5623910427093506, + 5.312994956970215, + 20.968046188354492, + 21.576714515686035, + 21.61891222000122, + 21.66746997833252, + 21.8339524269104, + 18.25313925743103, + 4.994597673416138, + 0.7638595104217529, + 0.7524452209472656, + 0.6783268451690674, + ], + [ + 0.6688904762268066, + 0.7927229404449463, + 1.5365099906921387, + 8.011052370071411, + 24.87508773803711, + 25.503795862197876, + 25.52624750137329, + 25.243642568588257, + 22.462859630584717, + 15.084798574447632, + 5.83056640625, + 7.130087852478027, + 6.6575610637664795, + 1.4069156646728516, + ], + [ + 0.656153678894043, + 0.7790679931640625, + 1.944002389907837, + 9.286311388015747, + 28.338233470916748, + 28.87402057647705, + 29.03240132331848, + 28.941983222961426, + 28.813721656799316, + 25.514888048171997, + 8.469764709472656, + ], +] + +# 10k Nodes +sizes = [ + (50, 400, 213.62911701202393), + (39, 395, 214.84202361106873), + (32, 395, 213.54416799545288), + (25, 315, 217.63313937187195), + (18, 115, 283.82231521606445), + (10, 31, 343.50494503974915), + (7, 10, 394.94820404052734), +] +stepsLapses = [ + [ + 1.3518695831298828, + 1.4894051551818848, + 2.389191150665283, + 6.95463490486145, + 24.005772352218628, + 30.02708649635315, + 30.45380449295044, + 30.695934772491455, + 30.31646728515625, + 29.054046869277954, + 17.703431129455566, + 2.720566511154175, + 2.1709277629852295, + 1.8627982139587402, + ], + [ + 1.3505363464355469, + 1.5087687969207764, + 2.369961738586426, + 6.896838426589966, + 23.798224210739136, + 30.069722414016724, + 30.176551342010498, + 30.49890446662903, + 30.29648232460022, + 28.97600030899048, + 17.854567766189575, + 2.9478790760040283, + 2.149484634399414, + 1.9988489151000977, + 1.4238512516021729, + ], + [ + 1.3641128540039062, + 1.505706548690796, + 2.412487506866455, + 6.97865104675293, + 24.048677921295166, + 29.876856565475464, + 30.403212785720825, + 30.607238054275513, + 30.24274516105652, + 28.874801635742188, + 17.851038694381714, + 2.970747947692871, + 2.152620792388916, + 1.8637866973876953, + ], + [ + 1.3612470626831055, + 1.506117820739746, + 2.3963406085968018, + 6.987675666809082, + 24.04241633415222, + 29.937008142471313, + 30.254473447799683, + 30.574475288391113, + 30.222501516342163, + 23.64164447784424, + 10.550750732421875, + 10.036490678787231, + 10.066076755523682, + 3.668154001235962, + ], + [ + 1.348376750946045, + 1.485114336013794, + 2.3588476181030273, + 6.822790622711182, + 31.541237592697144, + 42.21662974357605, + 43.31953692436218, + 43.17806601524353, + 43.284963846206665, + 40.89579677581787, + 20.15466809272766, + 2.0757288932800293, + 1.4337825775146484, + 1.3437645435333252, + ], + [ + 1.3447542190551758, + 1.4888508319854736, + 2.3689799308776855, + 8.266894340515137, + 40.54838562011719, + 50.60444140434265, + 51.81586265563965, + 51.774033308029175, + 51.12255573272705, + 40.330037355422974, + 16.446475982666016, + 6.193348169326782, + 8.187717914581299, + 8.416587591171265, + 1.9950587749481201, + ], + [ + 1.3593223094940186, + 1.518049955368042, + 2.4925811290740967, + 10.969608068466187, + 47.84677600860596, + 57.691601276397705, + 60.105135917663574, + 59.38239240646362, + 58.89372801780701, + 56.152278423309326, + 33.62856864929199, + 2.8102831840515137, + ], +] + +# 1k Nodes +sizes = [ + (39, 395, 19.518831253051758), + (32, 395, 19.62859344482422), + (25, 315, 20.106651306152344), + (18, 115, 27.49130392074585), + (10, 31, 33.48099613189697), + (7, 10, 37.46962857246399), +] +stepsLapses = [ + [ + 0.15041708946228027, + 0.2558310031890869, + 0.834219217300415, + 2.6229143142700195, + 2.849874258041382, + 2.8211777210235596, + 2.8509232997894287, + 2.8175060749053955, + 2.620945453643799, + 1.1062071323394775, + 0.20065641403198242, + 0.1831526756286621, + ], + [ + 0.15043163299560547, + 0.2549173831939697, + 0.8331425189971924, + 2.64731502532959, + 2.850823163986206, + 2.8487398624420166, + 2.8656344413757324, + 2.8288016319274902, + 2.630406379699707, + 1.1487407684326172, + 0.19384264945983887, + 0.171234130859375, + ], + [ + 0.15032672882080078, + 0.2573871612548828, + 0.8333590030670166, + 2.5946173667907715, + 2.809241771697998, + 2.805994749069214, + 2.911816120147705, + 2.610478401184082, + 2.333618402481079, + 1.8721530437469482, + 0.5945620536804199, + 0.1285545825958252, + ], + [ + 0.14538335800170898, + 0.24220609664916992, + 0.813441276550293, + 3.965632200241089, + 4.187340497970581, + 4.174125909805298, + 4.213524580001831, + 4.212984561920166, + 3.867766857147217, + 1.1342151165008545, + 0.17552900314331055, + 0.1555778980255127, + ], + [ + 0.145188570022583, + 0.23859691619873047, + 1.1786553859710693, + 4.681736469268799, + 4.848631381988525, + 4.949578285217285, + 4.779291391372681, + 4.404498338699341, + 3.221503734588623, + 1.7988455295562744, + 1.9808762073516846, + 1.0439932346343994, + ], + [ + 0.14494824409484863, + 0.24969959259033203, + 1.4229578971862793, + 5.471708059310913, + 5.621778964996338, + 5.7769739627838135, + 5.7460150718688965, + 5.6701459884643555, + 5.270337104797363, + 1.9179344177246094, + ], +] + +for size, lapses in zip(sizes, stepsLapses): + fname = f"{size[0]}_{size[1]}.png" + + conf = {} + conf["textBox"] = ( + f"Max Send Deque Size: {size[0]}\nMax Received Deque Size: {size[1]}\nTotal Time Taken: {size[2]:.2f}s" + ) + conf["title"] = "Step Duration" + conf["type"] = "plot" + conf["legLoc"] = 1 + conf["desLoc"] = 1 + conf["colors"] = ["m-"] + conf["labels"] = ["Step Duration"] + conf["xlabel"] = "Step" + conf["ylabel"] = "Time Taken (sec)" + conf["data"] = lapses + conf["path"] = plot_dir + fname + plotData(conf)