Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
energy
bmon
Commits
f901a1bb
Commit
f901a1bb
authored
Feb 05, 2015
by
Alan Mitchell
Browse files
More accurate Post Rate Calc.
parent
aad6ab4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
bmsapp/scripts/performance_testing.py
bmsapp/scripts/performance_testing.py
+6
-4
No files found.
bmsapp/scripts/performance_testing.py
View file @
f901a1bb
...
...
@@ -112,20 +112,22 @@ if __name__ == '__main__':
thread_count
=
int
(
args
[
1
])
if
len
(
args
)
>=
2
else
5
rdg_delay
=
float
(
args
[
2
])
if
len
(
args
)
>=
3
else
0.0
TOT_
POST_
TIME
=
5.0
# seconds
POST_
SLEEP
=
5.0
# seconds
posters
=
[]
tstart
=
time
.
time
()
for
i
in
range
(
thread_count
):
sensor_id
=
'test_%03d'
%
i
poster
=
ReadingPoster
(
sensor_id
,
rdg_delay
)
posters
.
append
(
poster
)
poster
.
start
()
time
.
sleep
(
TOT_
POST_
TIME
)
time
.
sleep
(
POST_
SLEEP
)
t_elapsed
=
time
.
time
()
-
tstart
total_reads
=
0
for
p
in
posters
:
p
.
stop_posting
()
total_reads
+=
p
.
reading_count
print
'%.1f posts / second'
%
(
total_reads
/
TOT_POST_TIME
)
time
.
sleep
(
rdg_delay
*
1.
1
)
# wait for threads to exit cleanly?
print
'%.1f posts / second'
%
(
total_reads
/
t_elapsed
)
time
.
sleep
(
rdg_delay
*
1.
2
)
# wait for threads to exit cleanly?
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