Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renice code for controlsd and boardd #611

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
4 participants
@ShaneSmiskol
Copy link

commented Apr 22, 2019

requested to re-open.
using a dictionary instead of individual if checks

@legonigel

This comment has been minimized.

Copy link
Contributor

commented Apr 22, 2019

We will do some testing on this internally to see the effect this has on packet timings, especially for live100, and live20.

@ShaneSmiskol

This comment has been minimized.

Copy link
Author

commented Apr 22, 2019

With a rudimentary test by @arne182, I believe he said it shaved off a few ms in controlsd when we were trying to figure out the cause of heavy lag caused by something unrelated at the time. Hope it helps you guys out.

@rbiasini

This comment has been minimized.

Copy link
Contributor

commented Apr 22, 2019

makes sense. On our end, we'll do some tests to evaluate benefits in controlsd/boardd timing consistency.
Have you done any tests on your end you can share?

@ShaneSmiskol

This comment has been minimized.

Copy link
Author

commented Apr 23, 2019

Yeah I do. Ran these tests last week to see if renicing would provide any benefit. One drive was about 4 minutes, while the other was 8 or so. Here are the times it takes to run through the main functions in controlsd.py:

Stock, without renice:

data_sample
30968 iterations
max time: 257.524967194 ms
average time: 3.481826073006764 ms

state_transition
30968 iterations
max time: 2.64310836792 ms
average time: 0.13941537961267417 ms

state_control
30968 iterations
max time: 5.637884140010001 ms
average time: 0.7742067403923821 ms

data_send
30968 iterations
max time: 67.3170089722 ms
average time: 2.8303837828536604 ms

controlsd_thread
1 iterations
max time: 2364.51196671 ms
average time: 2364.51196671 ms

while True loop in controlsd_thread
30968 iterations
max time: 261.04784011799995 ms
average time: 9.845619121899889 ms

With renice and no other changes:

data_sample
17931 iterations
max time: 43.2319641113 ms
average time: 3.159986112183014 ms

state_transition
17931 iterations
max time: 3.6580562591600003 ms
average time: 0.13241089232679795 ms

state_control
17931 iterations
max time: 13.5610103607 ms
average time: 0.7908351980737566 ms

data_send
17931 iterations
max time: 45.4490184784 ms
average time: 2.6563973682376756 ms

controlsd_thread
1 iterations
max time: 1675.24504662 ms
average time: 1675.24504662 ms

while True loop in controlsd_thread
17931 iterations
max time: 54.771184921300005 ms
average time: 9.89592040112331 ms

Note the different drive times, and it's not on stock openpilot either. So your own testing might be more accurate in results.

@arne182

This comment has been minimized.

Copy link
Contributor

commented Apr 23, 2019

On the Travis build it reports
selfdrive.controls.controlsd
renice: failed to set priority for 360 (process ID): Permission denied
starting python selfdrive.controls.plannerd
chrt: failed to set pid 359's policy: Operation not permitted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.