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
49dba4c8
Commit
49dba4c8
authored
Aug 10, 2015
by
Deathcrow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
data aggregation script (calculates average + std deviation)
parent
fd070ae1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
112 additions
and
0 deletions
+112
-0
aggregate.py
aggregate.py
+112
-0
No files found.
aggregate.py
0 → 100644
View file @
49dba4c8
#!/usr/bin/env python3
# vim: expandtab shiftwidth=4 softtabstop=4
#iperf -V -Z cubic -t 30 -c fdb2:f689:4248:2bc8::3 -p 12345
import
argparse
import
copy
import
math
import
os
import
re
import
signal
import
subprocess
import
tempfile
#import threading
import
time
def
signal_handler
(
signum
,
frame
):
clean_up
()
raise
SystemExit
def
testy
(
a
,
b
):
print
(
a
)
print
(
b
)
print
(
sender
)
return
0
def
clean_up
():
# Clean up
if
args
.
legacy
:
tcpprobe
.
terminate
()
if
args
.
tcpdump
==
"1"
:
tcpdump
.
terminate
()
if
args
.
cpunetlog
!=
""
:
cpunetlog
.
terminate
()
for
i
in
sender
:
# if i['utility'].returncode == None:
try
:
i
[
'utility'
].
kill
()
except
ProcessLookupError
:
pass
# i['utility_file'].close()
time
.
sleep
(
1
)
#def parse_dir(directory):
signal
.
signal
(
signal
.
SIGINT
,
signal_handler
)
signal
.
signal
(
signal
.
SIGTERM
,
signal_handler
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Configure test environment.'
)
parser
.
add_argument
(
'folders'
,
nargs
=
"*"
,
default
=
"./"
,
help
=
"Folder to search for files"
)
parser
.
add_argument
(
'-m'
,
'--mask'
)
args
=
parser
.
parse_args
()
mypid
=
os
.
getpid
()
#print(args.folders)
#for key, folder in enumerate(args.folders):
# args.folders[key] = os.path.abspath(folder)
args
.
folders
=
[
os
.
path
.
abspath
(
folder
)
for
folder
in
args
.
folders
]
print
(
args
.
folders
)
rtt_values_file
=
tempfile
.
TemporaryFile
(
mode
=
'r+'
)
bw_values_file
=
tempfile
.
TemporaryFile
(
mode
=
'r+'
)
rtt_file_lines
=
0
bw_file_lines
=
0
for
folder
in
args
.
folders
:
for
path
,
dirs
,
files
in
os
.
walk
(
folder
):
for
file
in
files
:
if
file
[:
9
]
==
"tcpprobe_"
:
tcpprobe_file
=
open
(
path
+
"/"
+
file
)
for
line
in
tcpprobe_file
:
line
=
line
.
split
(
" "
)
#print(line[9])
rtt_values_file
.
write
(
line
[
9
]
+
'
\n
'
)
rtt_file_lines
+=
1
tcpprobe_file
.
close
()
elif
file
[:
3
]
==
"bw_"
:
bw_file
=
open
(
path
+
"/"
+
file
)
for
line
in
bw_file
:
line
=
line
.
split
(
" "
)
bw_values_file
.
write
(
line
[
3
])
bw_file_lines
+=
1
bw_file
.
close
()
bw_values_file
.
seek
(
0
)
rtt_values_file
.
seek
(
0
)
avg_bw
=
sum
(
[
float
(
line
)
for
line
in
bw_values_file
]
)
/
bw_file_lines
avg_rtt
=
sum
(
[
float
(
line
)
for
line
in
rtt_values_file
]
)
/
rtt_file_lines
print
(
"avg_bw: "
+
str
(
avg_bw
))
print
(
"avg_rtt: "
+
str
(
avg_rtt
))
bw_values_file
.
seek
(
0
)
rtt_values_file
.
seek
(
0
)
std_deviation_bw
=
math
.
sqrt
(
1
/
(
bw_file_lines
-
1
)
*
sum
(
[
(
float
(
line
)
-
avg_bw
)
**
2
for
line
in
bw_values_file
]
))
std_deviation_rtt
=
math
.
sqrt
(
1
/
(
rtt_file_lines
-
1
)
*
sum
(
[
(
float
(
line
)
-
avg_rtt
)
**
2
for
line
in
rtt_values_file
]
))
print
(
"std_deviation_bw: "
+
str
(
std_deviation_bw
))
print
(
"std_deviation_rtt: "
+
str
(
std_deviation_rtt
))
#print(bw_values_file.read())
#print(bw_file_lines)
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