Comments (4)
I noticed high CPU load as well (23%), but found it to be the CO_JOB_PERIODIC timer which fires every ms with the SIGEV_THREAD notification, i.e. spawning a new thread every ms. I get high CPU usage without ever receiving a CAN message so I doubt the repeated select() is the (only) culprit.
from c-open.
Verified that idle CPU consumption scales with the timer period, i.e. 2 ms gives me half the load.
It would be nice if the clients of the periodic job feature could say when they are expiring, so that the timer can be armed to the time required instead of periodically. Since all callees in co_handle_periodic()
seems to end up using co_is_expired()
to check now
against a timestamp and fixed period, this should be easily implemented by returning the time left from co_is_expired()
and propagating the minimum value up the call chain to co_main()
which can re-arm the timer.
Then also the CO_JOB_PERIODIC message must be force sent whenever any event causes a timer to be set, to recalculate the timeout. Maybe co_handle_periodic()
can be called every iteration of the co_main()
loop to cover all cases where the event passes trough the main thread? Are there others?
The main loop could probably even use the timeout feature of os_mbox_fetch()
to wake up at the right time instead of keeping a separate timer around.
from c-open.
The select() issue should be fixed now, by using epoll(). The timers were reworked to use SIGEV_THREAD_ID, this avoids creating a new thread whenever the timer fires and improves the cpu-usage somewhat. It still seems fairly expensive to do periodic work at 1000Hz though.
I like the idea of calculating the next timeout dynamically, assuming jitter can be avoided (for other platforms where the timers are more reliable). Could you create a new issue for that?
from c-open.
Closed, but see #6
from c-open.
Related Issues (17)
- Standard RPDO padding not possible HOT 2
- Using high PDO numbers is very inefficient HOT 4
- CiA 417 uses invalid PDO COB-ID HOT 1
- Dead code in co_handle_rx
- PDO size mismatch EMCY HOT 1
- MPDO support
- UNSIGNED48 is not working
- Automatic transition to NMT Pre-operational for non-critical errors HOT 2
- PDOs sent in Pre-operational
- How to support PDO COB-ID based on node ID after it has been changed by LSS? HOT 6
- Unable to override default TPDO CAN-ID HOT 4
- rt-kernel coal abstraction assumes DLC field is less or equal to 8
- More efficient timeout implementation
- test_sdo_server.cpp:207:30: error: storing the address of local variable ‘obj’ in ‘mock_co_obj_find_result’ HOT 1
- Event-based communication error handling
- SDO abort codes not exported HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c-open.