def plotMwDistribution(threadCount, clientCount): g = defaultPlot() g.title("Middleware Time Distribution with " + str(clientCount) + " Total Clients") g.xlabel("Time (s)") g.ylabel("Occurrences") g("set key inside top right") g("unset xrange") g("unset yrange") g("set logscale x") g("set logscale y") logs = [ str(base / expdir.format(client=clientCount, thread=threadCount, run=r) / "middleware.log") for r in range(0, runs) ] data = middleware.process(logs) # create one line for each field fields = ["Tqueue", "Tserver", "Tmw"] for (i, f) in enumerate(fields): g._add_to_queue([ Gnuplot.Data(data["get" + f + "Distribution"], title=f, with_="lp lt " + str(i + 1)) ]) g.hardcopy(filename="mw-opt-distribution.png", terminal="png")
def plotMwPercentile(threadCount, clientCount): g = defaultPlot() g.title("Middleware Percentiles with " + str(threadCount) + " Read Threads and " + str(clientCount) + " Total Clients") g.xlabel("Percentile") g.ylabel("Time (s)") g("set key inside top left") g("set logscale y") g("unset yrange") g("set format y \"10^{%L}\"") g("set xtics 25") # read data from logs only once logs = [ str(base / expdir.format(client=clientCount, thread=threadCount, run=r) / "middleware.log") for r in range(0, runs) ] data = middleware.process(logs) fields = ["Tqueue", "Tserver", "Tmw"] for (i, f) in enumerate(fields): g._add_to_queue([ Gnuplot.Data(data["get" + f + "Percentile"], title=f, with_="lp ls " + str(i + 1), using="1:2") ]) g.hardcopy(filename="mw-opt-percentile.png", terminal="png")
def getData(source, field): global memaResults, middResults, data if source not in data: data[source] = {} if field not in data[source]: if source == "memaslap": if memaResults is None: memaResults = memaslap.process([[str(l) for l in (base / "trace").glob("mema*.log")]]) data[source][field] = memaResults[field] elif source == "middleware": if middResults is None: middResults = middleware.process([str(base / "trace" / "middleware.log")]) data[source][field] = middResults[field] return data[source][field]
def plotMwBreakdownBarsByClient(threadCount): g = Gnuplot.Gnuplot() g.title("Middleware Time Breakdown with " + str(threadCount) + " Read Threads") g.xlabel("Total Clients") g.ylabel("Time (s)") g("set key top left") g("set grid ytics") g("set style data histogram") g("set style histogram errorbars gap 1") g("set style fill pattern 0 border") g("set auto x") g("set xrange [-0.5:6.5]") g("set xtics ('120' 0, '160' 1, '200' 2, '240' 3, '280' 4, '320' 5, '360' 6)" ) # get data for all clients data = {} fields = ["Tqueue", "Tserver", "Tmw"] for f in fields: data[f] = [] for c in clients: # create a list of logs from the runs logs = [ str(base / expdir.format(client=c, thread=threadCount, run=r) / "middleware.log") for r in range(0, runs) if (base / expdir.format(client=c, thread=threadCount, run=r)).exists() ] results = middleware.process(logs) for f in fields: data[f].append((c, results["get" + f + "MeanExp"][0], results["get" + f + "MeanExp"][1])) for f in fields: g._add_to_queue([Gnuplot.Data(data[f], title=f, using="2:3")]) g.hardcopy(filename="mw-time-clients.png", terminal="png")
def getData(self, dirName, source, field): key = dirName + field if source not in self.data: self.data[source] = {} if key not in self.data[source]: if source == "memaslap": self.memaResults = memaslap.process([[ str(l) for l in (self.base / (dirName + "-r" + str(r))).glob("mema*.log") ] for r in range(0, self.runs)]) self.data[source][key] = self.memaResults[field] elif source == "middleware": self.middResults = middleware.process([ str(self.base / (dirName + "-r" + str(r)) / "middleware.log") for r in range(0, self.runs) ]) self.data[source][key] = self.middResults[field] return self.data[source][key]