Commit 629b8c84 authored by liyuanhong's avatar liyuanhong

修改了执行中日志写入

parent c297e923
......@@ -18,12 +18,12 @@ class SendMultMsgThread():
self.msg = msg
self.timeOut = 30 #socket超时时间
self.BUF_SIZE = 1024 #接收消息缓存
self.threadCount = 10000 #并发线程数
self.threadCount = 100 #并发线程数
self.totalTime = 0 #所有线程的运行总和
self.threadArr = {} #保存每个线程的信息
self.failThreadCount = 0 #失败线程数
self.durThreads = [] #持续发送线程数组,当数组为空,表示所有线程已经结束
self.durTime = 120 #线程持续时间
self.durTime = 20 #线程持续时间
self.connectTimeoutNum = 0 #连接超时线程数
self.sendTimeoutNum = 0 #发送超时线程数
self.reviceTimeoutNum = 0 #接收超时线程数
......@@ -203,6 +203,20 @@ class SendMultMsgThread():
time.sleep(0.5) #防止启动的时候溜掉某些启动比较慢的线程
while len(self.durThreads) != 0:
print("剩余线程数:" + str(len(self.durThreads)))
timeArray = time.localtime(timeStart / 1000)
testStart = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
info_0 = "-------------------------- 统计信息(pre) --------------------------"
info_1 = "耗时:" + str(timeExpend) + " 毫秒产生了" + str(self.threadCount) + "线程"
info_2 = "开始测试时间:" + testStart
info_4 = "设置socket超时时间:" + str(self.timeOut)
info_5 = "设置线程持续时间:" + str(self.durTime)
info_6 = "剩余线程数:" + str(len(self.durThreads))
info_8 = "连接失败:" + str(self.connectTimeoutNum)
info_9 = "发送失败:" + str(self.sendTimeoutNum)
info_10 = "接收失败:" + str(self.reviceTimeoutNum)
result = info_0 + "\n" + info_1 + "\n" + info_2 + "\n" + info_4 + "\n" + info_5 + "\n" + info_6 + "\n"
result = result + info_8 + "\n" + info_9 + "\n" + info_10 + "\n"
self.writeToFile("./result_pre.txt",result)
time.sleep(5)
timeArray = time.localtime(timeStart / 1000)
testStart = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment