Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
streamPushPressure
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
李远洪
streamPushPressure
Commits
6b7e63bd
Commit
6b7e63bd
authored
Jan 12, 2021
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化了压力测试对内存的占用
parent
1ab9daaf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
lib/testCase/FlvPressureTest.py
lib/testCase/FlvPressureTest.py
+9
-3
run.py
run.py
+3
-3
No files found.
lib/testCase/FlvPressureTest.py
View file @
6b7e63bd
#coding: utf-8
#coding: utf-8
import
json
import
json
import
os
import
re
import
re
import
threading
import
threading
import
time
import
time
...
@@ -72,6 +73,7 @@ class FlvPressureTest():
...
@@ -72,6 +73,7 @@ class FlvPressureTest():
# 使用openvc去拉流
# 使用openvc去拉流
'''
def testServicePull(self, mobile,threadName):
def testServicePull(self, mobile,threadName):
pullUrl = self.getPlayUrl(mobile,self.channel)
pullUrl = self.getPlayUrl(mobile,self.channel)
# pullUrl = self.replaceHost(pullUrl, "video-test.vandyo.com:")
# pullUrl = self.replaceHost(pullUrl, "video-test.vandyo.com:")
...
@@ -93,21 +95,25 @@ class FlvPressureTest():
...
@@ -93,21 +95,25 @@ class FlvPressureTest():
self.threadInfoPull["threadObj"].pop(threadName)
self.threadInfoPull["threadObj"].pop(threadName)
return
return
self.threadInfoPull["threadObj"].pop(threadName)
self.threadInfoPull["threadObj"].pop(threadName)
'''
'''
# 使用requests去拉流
# 使用requests去拉流
def
testServicePull
(
self
,
mobile
,
threadName
):
def
testServicePull
(
self
,
mobile
,
threadName
):
pullUrl
=
self
.
getPlayUrl
(
mobile
,
self
.
channel
)
pullUrl
=
self
.
getPlayUrl
(
mobile
,
self
.
channel
)
# pullUrl = self.replaceHost(pullUrl, "video-test.vandyo.com:")
# pullUrl = self.replaceHost(pullUrl, "video-test.vandyo.com:")
try
:
try
:
requests.get(pullUrl)
r
=
requests
.
get
(
pullUrl
,
stream
=
True
)
with
open
(
os
.
devnull
,
'w'
)
as
f
:
for
chunk
in
r
.
iter_content
(
chunk_size
=
512
):
if
chunk
:
f
.
write
(
str
(
chunk
))
except
:
except
:
traceback
.
print_exc
()
traceback
.
print_exc
()
self
.
threadInfoPull
[
"threadObj"
]
.
pop
(
threadName
)
self
.
threadInfoPull
[
"threadObj"
]
.
pop
(
threadName
)
return
return
self
.
threadInfoPull
[
"threadObj"
]
.
pop
(
threadName
)
self
.
threadInfoPull
[
"threadObj"
]
.
pop
(
threadName
)
'''
################################################
################################################
# 启动推流线程
# 启动推流线程
...
...
run.py
View file @
6b7e63bd
...
@@ -34,13 +34,13 @@ def getPressTestObj():
...
@@ -34,13 +34,13 @@ def getPressTestObj():
test
=
FlvPressureTest
()
test
=
FlvPressureTest
()
test
.
setHost
(
"10.100.11.125"
)
test
.
setHost
(
"10.100.11.125"
)
test
.
setPort
(
1078
)
test
.
setPort
(
1078
)
test
.
setMobileStart
(
5
0000000000
)
# 开始的设备号 (累加)
test
.
setMobileStart
(
9
0000000000
)
# 开始的设备号 (累加)
test
.
setChannel
(
1
)
# 设置频道号
test
.
setChannel
(
1
)
# 设置频道号
test
.
setTerNum
(
30
)
# 要启动的推拉流线程
test
.
setTerNum
(
1
)
# 要启动的推拉流线程
test
.
setIsOpenPullStream
(
1
)
# 设置是否开启拉流
test
.
setIsOpenPullStream
(
1
)
# 设置是否开启拉流
test
.
setIsShowFrame
(
0
)
# 拉流是否显示预览画面 (压力测试都应该填:0)
test
.
setIsShowFrame
(
0
)
# 拉流是否显示预览画面 (压力测试都应该填:0)
test
.
setSendDur
(
0.007
)
# 设置socket 发送数据间隔
test
.
setSendDur
(
0.007
)
# 设置socket 发送数据间隔
test
.
setFlvPath
(
"flv/
aaa3
.flv"
)
# 设置视频路劲
test
.
setFlvPath
(
"flv/
yyy
.flv"
)
# 设置视频路劲
test
.
start
()
test
.
start
()
return
test
return
test
...
...
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