From ac1b62459cceb18484804949da631ba959b13978 Mon Sep 17 00:00:00 2001 From: Quentin De Coninck Date: Fri, 24 Feb 2017 16:12:50 +0100 Subject: [PATCH] msg: add parameters --- src/mpExperienceMsg.py | 19 +++++++++++-------- src/msg_client.py | 3 ++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/mpExperienceMsg.py b/src/mpExperienceMsg.py index 6c78ec7..ae32ca8 100644 --- a/src/mpExperienceMsg.py +++ b/src/mpExperienceMsg.py @@ -33,7 +33,9 @@ class MpExperienceMsg(MpExperience): """ todo : param LD_PRELOAD ?? """ - pass + self.client_sleep = self.xpParam.getParam(MpParamXp.MSGCLIENTSLEEP) + self.server_sleep = self.xpParam.getParam(MpParamXp.MSGSERVERSLEEP) + self.nb_requests = self.xpParam.getParam(MpParamXp.MSGNBREQUESTS) def prepare(self): MpExperience.prepare(self) @@ -42,15 +44,16 @@ class MpExperienceMsg(MpExperience): self.mpTopo.commandTo(self.mpConfig.server, "rm " + \ MpExperienceMsg.SERVER_LOG) - def getSiriServerCmd(self): + def getMsgServerCmd(self): s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \ - "/msg_server.py &>" + MpExperienceMsg.SERVER_LOG + "&" + "/msg_server.py --sleep " + self.server_sleep + " &>" + MpExperienceMsg.SERVER_LOG + "&" print(s) return s - def getSiriClientCmd(self): + def getMsgClientCmd(self): s = "python3 " + os.path.dirname(os.path.abspath(__file__)) + \ - "/msg_client.py &>" + MpExperienceMsg.CLIENT_LOG + "/msg_client.py --sleep " + self.client_sleep + " --nb " + self.nb_requests + \ + " >" + MpExperienceMsg.CLIENT_LOG + " 2>" + MpExperienceSiriMsg.CLIENT_ERR + "&" print(s) return s @@ -59,15 +62,15 @@ class MpExperienceMsg(MpExperience): def run(self): - cmd = self.getSiriServerCmd() + cmd = self.getMsgServerCmd() self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_before") self.mpTopo.commandTo(self.mpConfig.server, cmd) self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") - cmd = self.getSiriClientCmd() + cmd = self.getMsgClientCmd() self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_before") self.mpTopo.commandTo(self.mpConfig.client, cmd) self.mpTopo.commandTo(self.mpConfig.server, "netstat -sn > netstat_server_after") self.mpTopo.commandTo(self.mpConfig.client, "netstat -sn > netstat_client_after") - self.mpTopo.commandTo(self.mpConfig.server, "pkill -f siri_server.py") + self.mpTopo.commandTo(self.mpConfig.server, "pkill -f msg_server.py") self.mpTopo.commandTo(self.mpConfig.client, "sleep 2") diff --git a/src/msg_client.py b/src/msg_client.py index 822c32d..b4ba020 100644 --- a/src/msg_client.py +++ b/src/msg_client.py @@ -68,4 +68,5 @@ finally: # Clean up the connection print("Closing connection") sock.close() - print(delays) + for delay in delays: + print(delay)