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
sbws
Commits
b010d1b5
Commit
b010d1b5
authored
Apr 03, 2018
by
Matt Traudt
Browse files
Make outputting raw values the default
parent
42aa29ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/commands/generate.py
View file @
b010d1b5
...
...
@@ -52,14 +52,15 @@ def warn_if_not_accurate_enough(lines, constant):
def
scale_lines
(
args
,
v3bw_lines
):
total
=
sum
([
l
.
bw
for
l
in
v3bw_lines
])
if
not
args
.
raw
:
if
args
.
scale
:
scale
=
len
(
v3bw_lines
)
*
args
.
scale_constant
else
:
scale
=
total
ratio
=
scale
/
total
for
line
in
v3bw_lines
:
line
.
bw
=
round
(
line
.
bw
*
ratio
)
+
1
warn_if_not_accurate_enough
(
v3bw_lines
,
args
.
scale_constant
)
if
args
.
scale
:
warn_if_not_accurate_enough
(
v3bw_lines
,
args
.
scale_constant
)
return
v3bw_lines
...
...
@@ -74,9 +75,11 @@ def gen_parser(sub):
p
.
add_argument
(
'--scale-constant'
,
default
=
7500
,
type
=
int
,
help
=
'When scaling bw weights, scale them using this const '
'multiplied by the number of measured relays'
)
p
.
add_argument
(
'--raw'
,
'--no-scale'
,
action
=
'store_true'
,
help
=
'If specified, use bandwidth values as they are, with '
'no scaling'
)
p
.
add_argument
(
'--scale'
,
action
=
'store_true'
,
help
=
'If specified, do not use bandwidth values as they '
'are, but scale them such that we have a budget of '
'scale_constant * num_measured_relays = bandwidth to give '
'out, and we do so proportionally'
)
def
main
(
args
,
conf
,
log_
):
...
...
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