Skip to content

WIP: Add method to calculate load on a bus #1105

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

Closed
wants to merge 6 commits into from

Conversation

wbarnha
Copy link
Contributor

@wbarnha wbarnha commented Jul 9, 2021

PR created to address Issue #972. WIP since I'm not done testing this.

I also preemptively opened a PR because I'm having some difficulty determining what the bitrate of a particular CAN interface is configured to be. If anyone could point me in the right direction, I'd be grateful. I saw that some custom interfaces have bitrates hard-coded in their respective constants.py files.

@mergify mergify bot requested a review from hardbyte July 9, 2021 22:47
@hartkopp
Copy link
Collaborator

You should take a look into canbusload from SocketCAN CAN utils:
https://github.com/linux-can/can-utils/blob/master/canbusload.c

At least when you are working on Linux (Debian/Ubuntu) apt install can-utils should work for you as it installs canbusload too.

@codecov
Copy link

codecov bot commented Jul 14, 2021

Codecov Report

Merging #1105 (681dbf8) into develop (fe18a34) will decrease coverage by 0.08%.
The diff coverage is 13.33%.

❗ Current head 681dbf8 differs from pull request most recent head fd43fb9. Consider uploading reports for the commit fd43fb9 to get more accurate results

@@             Coverage Diff             @@
##           develop    #1105      +/-   ##
===========================================
- Coverage    66.03%   65.94%   -0.09%     
===========================================
  Files           86       86              
  Lines         8917     8932      +15     
===========================================
+ Hits          5888     5890       +2     
- Misses        3029     3042      +13     

@wbarnha wbarnha marked this pull request as draft July 14, 2021 13:24
@wbarnha wbarnha changed the title WIP: Add method to calculate load on a bus Add method to calculate load on a bus Jul 16, 2021
@wbarnha wbarnha marked this pull request as ready for review July 16, 2021 21:00
@wbarnha
Copy link
Contributor Author

wbarnha commented Jul 16, 2021

You should take a look into canbusload from SocketCAN CAN utils:
https://github.com/linux-can/can-utils/blob/master/canbusload.c

At least when you are working on Linux (Debian/Ubuntu) apt install can-utils should work for you as it installs canbusload too.

Thank you for the suggestion. It seems the method I implemented is somewhat different since it's intended to be used as a method of an object such as ThreadSafeBus, rather than continuously polling multiple channels. I have tested my code but have not hardcoded test cases.

@wbarnha wbarnha changed the title Add method to calculate load on a bus WIP: Add method to calculate load on a bus Apr 22, 2022
@wbarnha
Copy link
Contributor Author

wbarnha commented Apr 22, 2022

Going to give this some more attention- I'd like to add additional functionality so that a thread is spawned to track CAN traffic in the background.

@wbarnha
Copy link
Contributor Author

wbarnha commented Nov 3, 2022

No longer need this feature.

@wbarnha wbarnha closed this Nov 3, 2022
@JayTeeBat
Copy link

Hi @wbarnha,
I was interested in this feature, do you mind explaining why it is not needed anymore?

Thx

@wbarnha
Copy link
Contributor Author

wbarnha commented Jul 18, 2023

Long story short, this was written when I was not aware of all tools in can-utils. I believe there's an application that tracks bitrate for you, but unfortunately I cannot remember its name.

Plus there's definitely more efficient ways of calculating this rather than my slow implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants