Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
new-socketemulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李远洪
new-socketemulator
Commits
629b8c84
Commit
629b8c84
authored
Mar 12, 2020
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了执行中日志写入
parent
c297e923
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
lib/multiThread/SendMultMsgThread_m500.py
lib/multiThread/SendMultMsgThread_m500.py
+16
-2
No files found.
lib/multiThread/SendMultMsgThread_m500.py
View file @
629b8c84
...
...
@@ -18,12 +18,12 @@ class SendMultMsgThread():
self
.
msg
=
msg
self
.
timeOut
=
30
#socket超时时间
self
.
BUF_SIZE
=
1024
#接收消息缓存
self
.
threadCount
=
100
00
#并发线程数
self
.
threadCount
=
100
#并发线程数
self
.
totalTime
=
0
#所有线程的运行总和
self
.
threadArr
=
{}
#保存每个线程的信息
self
.
failThreadCount
=
0
#失败线程数
self
.
durThreads
=
[]
#持续发送线程数组,当数组为空,表示所有线程已经结束
self
.
durTime
=
1
20
#线程持续时间
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment