solettaproject / soletta

Soletta Project is a framework for making IoT devices. With Soletta Project's libraries developers can easily write software for devices that control actuators/sensors and communicate using standard technologies. It enables adding smartness even on the smallest edge devices.
http://solettaproject.org
Apache License 2.0
225 stars 108 forks source link

How to measure interrupt latency using soletta #2360

Open friend117 opened 7 years ago

friend117 commented 7 years ago

Task Description

Measure interrupt latency using soletta

Dependencies

Hello, I'm trying to measure the interrupt latency when running the application that turn on the light using http or oic.(this is shown as tutorial at wiki(https://github.com/solettaproject/soletta/blob/master/doc/tutorials/ostro-oic-tutorial/step6/tutorial.md)) there are only fbp files so I have no idea how to check the interrupt latency.(especially communication interrupt) Could you please share if you have any idea?

Board information

Host OS and architecture: linux - 64bit, soletta(v1.0) Target OS and platform: linux, zephyr on Galileo board

barbieri commented 7 years ago

@friend117 this is not something you should be doing with soletta for a simple reason: in order to simplify application development we abstract interruptions from user, queuing events to be dispatched outside of the ISR, from a clean context.

Then, whenever your GPIO triggers an interrupt, we handle that by appending an event to a list. Once the main thread resumes from ISR, we check the event list and callback the user... one after the other, thus latency is introduced.

Some OS offers ways to time interruption handlers, another option is to patch soletta itself and check your platform where your timing should be placed.

Also note that in such high level protocols, the hardware interruptions are very far from the actual package being usable, like in OIC you need your radio driver to create 802.15.4 packet (that may be fragmented) that will contain IPv6 packet that will contain UDP packet that will contain CoAP encapsulation that contains CBOR payload. HTTP is not implemented by any Small OS at this time and would be worse, since TCP is a windowing protocol that handles reorder and ACK, then HTTP will need to parse the textual headers looking for \n\r...