Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
Metrics
Onionperf
Commits
2eceb8c7
Commit
2eceb8c7
authored
Jul 12, 2020
by
Karsten Loesing
Browse files
Make a few whitespace fixes.
parent
120e425e
Changes
2
Hide whitespace changes
Inline
Side-by-side
onionperf/analysis.py
View file @
2eceb8c7
...
...
@@ -26,7 +26,7 @@ class OPAnalysis(Analysis):
def
__init__
(
self
,
nickname
=
None
,
ip_address
=
None
):
super
().
__init__
(
nickname
,
ip_address
)
self
.
json_db
=
{
'type'
:
'onionperf'
,
'version'
:
'3.0'
,
'data'
:
{}}
self
.
json_db
=
{
'type'
:
'onionperf'
,
'version'
:
'3.0'
,
'data'
:
{}}
self
.
torctl_filepaths
=
[]
def
add_torctl_file
(
self
,
filepath
):
...
...
@@ -64,7 +64,7 @@ class OPAnalysis(Analysis):
if
self
.
measurement_ip
is
None
:
self
.
measurement_ip
=
"unknown"
self
.
json_db
[
'data'
].
setdefault
(
self
.
nickname
,
{
'measurement_ip'
:
self
.
measurement_ip
}).
setdefault
(
json_db_key
,
parser
.
get_data
())
self
.
json_db
[
'data'
].
setdefault
(
self
.
nickname
,
{
'measurement_ip'
:
self
.
measurement_ip
}).
setdefault
(
json_db_key
,
parser
.
get_data
())
self
.
json_db
[
'data'
][
self
.
nickname
][
"tgen"
].
pop
(
"heartbeats"
)
self
.
json_db
[
'data'
][
self
.
nickname
][
"tgen"
].
pop
(
"init_ts"
)
self
.
json_db
[
'data'
][
self
.
nickname
][
"tgen"
].
pop
(
"stream_summary"
)
...
...
onionperf/visualization.py
View file @
2eceb8c7
...
...
@@ -68,7 +68,7 @@ class TGenVisualization(Visualization):
stream
[
"time_to_first_byte"
]
=
float
(
s
[
"usecs-to-first-byte-recv"
])
/
1000000
if
"usecs-to-last-byte-recv"
in
s
:
stream
[
"time_to_last_byte"
]
=
float
(
s
[
"usecs-to-last-byte-recv"
])
/
1000000
if
"elapsed_seconds"
in
stream_data
:
if
"elapsed_seconds"
in
stream_data
:
s
=
stream_data
[
"elapsed_seconds"
]
# Explanation of the math below for computing Mbps: From filesize_bytes
# and payload_progress fields we can compute the number of seconds that
...
...
@@ -93,11 +93,11 @@ class TGenVisualization(Visualization):
if
"elapsed_seconds"
in
transfer_data
:
s
=
transfer_data
[
"elapsed_seconds"
]
if
"payload_progress"
in
s
:
# Explanation of the math below for computing Mbps: From filesize_bytes
# and payload_progress fields we can compute the number of seconds that
# have elapsed between receiving bytes 524,288 and 1,048,576, which is a
# total amount of 524,288 bytes or 4,194,304 bits or 4.194304 megabits.
# We want the reciprocal of that value with unit megabits per second.
# Explanation of the math below for computing Mbps: From filesize_bytes
# and payload_progress fields we can compute the number of seconds that
# have elapsed between receiving bytes 524,288 and 1,048,576, which is a
# total amount of 524,288 bytes or 4,194,304 bits or 4.194304 megabits.
# We want the reciprocal of that value with unit megabits per second.
if
transfer_data
[
"filesize_bytes"
]
==
1048576
and
"1.0"
in
s
[
"payload_progress"
]:
stream
[
"mbps"
]
=
4.194304
/
(
s
[
"payload_progress"
][
"1.0"
]
-
s
[
"payload_progress"
][
"0.5"
])
if
transfer_data
[
"filesize_bytes"
]
==
5242880
and
"0.2"
in
s
[
"payload_progress"
]:
...
...
Write
Preview
Supports
Markdown
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