Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
asteriskperf-python-wrapper
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
s_doering
asteriskperf-python-wrapper
Commits
531c9167
Commit
531c9167
authored
Jul 30, 2015
by
Deathcrow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor fixes
+ start_time was incorrect + Popen.wait() buggy with multiprocessing
parent
0215cf7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
wrapper.py
wrapper.py
+12
-8
No files found.
wrapper.py
View file @
531c9167
...
@@ -148,7 +148,8 @@ def clean_up():
...
@@ -148,7 +148,8 @@ def clean_up():
tcpprobe
.
terminate
()
tcpprobe
.
terminate
()
if
args
.
tcpdump
==
"1"
:
if
args
.
tcpdump
==
"1"
:
tcpdump
.
terminate
()
tcpdump
.
terminate
()
# cpunetlog.terminate()
if
args
.
cpunetlog
!=
""
:
cpunetlog
.
terminate
()
for
i
in
sender
:
for
i
in
sender
:
if
i
[
'utility'
].
returncode
==
None
:
if
i
[
'utility'
].
returncode
==
None
:
i
[
'utility'
].
kill
()
i
[
'utility'
].
kill
()
...
@@ -265,11 +266,10 @@ for key, i in enumerate(sender):
...
@@ -265,11 +266,10 @@ for key, i in enumerate(sender):
i
[
'utility_file'
]
=
open
(
args
.
tmp_folder
+
"/"
+
args
.
utility
+
"_"
+
i
[
'congestion'
]
+
"_"
+
str
(
key
),
'w+'
)
i
[
'utility_file'
]
=
open
(
args
.
tmp_folder
+
"/"
+
args
.
utility
+
"_"
+
i
[
'congestion'
]
+
"_"
+
str
(
key
),
'w+'
)
# print(i['src']+":"+i['src_port']+" "+i['dst']+":"+i['port'])
# print(i['src']+":"+i['src_port']+" "+i['dst']+":"+i['port'])
#setup done, run tests
#setup done, run tests
in 5 seconds
start_time
=
time
.
perf_counter
()
start_time
=
time
.
perf_counter
()
+
5
with
multiprocessing
.
Pool
(
min
(
multiprocessing
.
cpu_count
(),
len
(
sender
)))
as
pool
:
with
multiprocessing
.
Pool
(
len
(
sender
))
as
pool
:
scheduled_time
=
time
.
perf_counter
()
+
5
# for key, i in enumerate(sender):
# for key, i in enumerate(sender):
# i['utility'] = subprocess.Popen(i['utility_command'], stdout=i['utility_file'])
# i['utility'] = subprocess.Popen(i['utility_command'], stdout=i['utility_file'])
...
@@ -277,7 +277,7 @@ with multiprocessing.Pool(min(multiprocessing.cpu_count(), len(sender))) as pool
...
@@ -277,7 +277,7 @@ with multiprocessing.Pool(min(multiprocessing.cpu_count(), len(sender))) as pool
# StartUtilityThread(i, scheduled_time).start()
# StartUtilityThread(i, scheduled_time).start()
# i['utility'] = pool.apply(start_utility, [key, scheduled_time])
# i['utility'] = pool.apply(start_utility, [key, scheduled_time])
# i['utility'] = pool.apply(testy, [start_time, 0])
# i['utility'] = pool.apply(testy, [start_time, 0])
pool_results
=
[
pool
.
apply_async
(
start_utility
,
[
key
,
s
cheduled
_time
])
for
key
,
i
in
enumerate
(
sender
)]
pool_results
=
[
pool
.
apply_async
(
start_utility
,
[
key
,
s
tart
_time
])
for
key
,
i
in
enumerate
(
sender
)]
# print(pool_results[0].get())
# print(pool_results[0].get())
# i['thread'] = multiprocessing.Process(target=start_utility, args=(key, scheduled_time))
# i['thread'] = multiprocessing.Process(target=start_utility, args=(key, scheduled_time))
# i['thread'].start()
# i['thread'].start()
...
@@ -346,8 +346,12 @@ if not args.legacy:
...
@@ -346,8 +346,12 @@ if not args.legacy:
else
:
else
:
time
.
sleep
(
float
(
args
.
time
))
time
.
sleep
(
float
(
args
.
time
))
for
i
in
sender
:
#for i in sender:
i
[
'utility'
].
wait
()
# i['utility'].wait()
# wait doesn't work with multiprocessing (?! returncode always 0, even when netperf still running)
time
.
sleep
(
5
)
# sleep 5 more seconds to allow netperf processes to finish
clean_up
()
clean_up
()
...
...
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