-
Notifications
You must be signed in to change notification settings - Fork 7.7k
net: latmon: latency monitor service and sample #85154
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
Conversation
This sample uses networking APIs but does not seem to be a networking sample but testing gpio latency. Perhaps this should be located somewhere under |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not believe this qualifies as a sample. From what I see reading the code, its an application used to calculate the latency of GPIO propagation between two systems, using a timer. For testing embedded systems, latencies are usually measured using digital analyzers to isolate the device under test, to avoid the propagated delays this application is seemingly introducing.
Samples are meant to show how to use zephyr, focusing on a specific feature like RTIO. I do not think anyone seeing this code will learn anything new about zephyr.
Why not keep this application downstream with the project it is designed for? I do not see what the zephyr project gains from adding and maintaining this application.
As I tried to explain in the README.rst, this program is designed for real-time Linux systems, assisting in the evaluation of their interrupt latencies. The client code, latmus, runs on the system under test (SUT) and has been a part of the Xenomai project for over 20 years, spanning multiple iterations. However, since it can run with minimal modifications on various systems, the goal is to extract it into a standalone project or potentially integrate it into the Linux kernel tree - maybe under linux/tools. The ultimate objective is to develop an affordable, open-source, hardware-backed solution for measuring interrupt latency in a clear and reliable manner. It also offers an objective method for comparing PREEMPT_RT with Xenomai: Benchmark Scenarios. I understand your concern but I was hoping we could have a discussion about this. In my opinion, given its simplicity, the code serves as a real-world example of pinctrl, GPIO, and networking usage. Additionally, it contributes to the Linux community by supporting discussions on real-time performance data. If it would be helpful, I’d be happy to be added as a maintainer for this sample code. |
@jukkar @bjarki-andreasen should I add it to samples/boards instead? It seems to focus more on demonstrating functionality and hardware features. I'd like to unblock this discussion |
Could you address the main alternative to adding this as a sample, which is to maintain it as a normal application within the project it is a part of? There are an effectively never ending number of applications built to run on zephyr, projects like https://github.com/jakkra/ZSWatch and https://github.com/zmkfirmware/zmk are rather popular ones. Should we add those applications to samples as well? One could argue they demonstrate how to use many parts of zephyr as well, but that does not make them samples... In short, samples demo and document a feature, applications solve a problem. The code in this PR is part of a larger project, solving a problem. |
@bjarki-andreasen I believe I have provided some sort of justification to what you are asking; I have provided links and data backing my request and offered my support as a maintainer. You are pointing me to some neat repositories though quite frankly I fail to see their industry relevance beyond their own individuality - the problem they are trying to solve doesn't extend beyond their single use case. I also doubt they will be active in 20 years from now. I have pointed you to a project/framework that is a quarter of a century old and supporting many industrial applications (and companies). The latmus tool - used to measure performance deviation - will help a wide range of products and markets. So with that in mind, I am still not sure why this Zephyr code can not be integrated as sample code. Is as generic as any, but it will help many. Now, please, could you help me understand the criteria to merge code to sample/boards? what does an application need to do be be accepted there? |
I do not have big issues with this sample, we have other samples that do somewhat similar things like zperf in networking. If this PR is accepted, then I suggest it is not placed under |
Yes, "some sort of justification" has been provided, I do not find said justification sufficient.
@jukkar Just like this sample does not demo any specific networking feature, its not demoing any specific zephyr feature either. Its not a sample... The "sample" in this PR is an endpoint/client for a completely independent project, it has no utility for zephyr. @kartben What do you think? Is this a sample in your opinion? Should it be part of the zephyr codebase somewhere in any case? |
If we look into samples/boards/expressif/ethernet or the rpi_pico sample it does seem relevant to me (nothing of interest from the zephyr side, just hardware validation AFAICS). But you are clearly better informed - I stopped contributing zephyr code over 8 years ago so I cant say I am up to date. Anyway, sure please let me know if I should drop the PR. |
Have you considered contributing latmon as a network protocol, similar to how protocols like ptp are implemented? Then the sample could demo the usage of said protocol, which would be a zephyr feature :) The protocol being part of the sample is what I believe makes this an application, rather than demoing a zephyr feature. something like:
in The sample would then be a demo of how to use the protocol. |
ah, that is a neat idea. ok let me have a look and thanks a lot for pointing it out! |
keep alive. |
@bjarki-andreasen I still have to address issues from the original code so please do not dive into a formal review yet - could you however comment on the partitioning as a network service? is this what you had in mind when you suggested it? |
Yes, this looks very much like what I envisioned :) |
ff44fd9
to
db7f7e8
Compare
|
AFAICS all actions have been done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
ping @kartben :) |
@kartben ping |
Maybe someone else can take over the missing reviewed by? |
Sorry for the delay. I will make sure to come back to this within a couple days |
Cool thanks, yeah enough for me to know is being reviewed and moving along, didn't want it to stall. |
@kartben when I accepted your recommendations, a Co-author tag was generated. Do these need to go into the two commits or shall I just add your Reviewed-by tags? going to fold the commits and update the PR so please let me know |
Oh I didn't know it does that. No tag at all is fine as far as I'm concerned :) thanks for checking! |
5c0ea53
to
32ed18d
Compare
@kartben any other changes? |
@bjarki-andreasen ping? |
Latmon service to interface with Xenomai's Latmus. Link: https://evlproject.org/core/benchmarks/#latmus-gpio-response-time Signed-off-by: Jorge Ramirez-Ortiz <[email protected]>
Supports the EVL/Xenomai4 benchmarking tool as described in the documentation. The benchmarking tool is accessed via the latmon service. This code uses the J2 socket on FRDMk64-F: PIN_20: tx pulse to SUT PIN_18: rx ack from SUT The client code running on the SUT shall monitor the falling edge of PIN_20. Example usage from the latmus client running Xenomai4: $ latmus -I gpiochip2,23,falling-edge \ -O gpiochip2,21 -g"histogram" \ -z broadcast Signed-off-by: Jorge Ramirez-Ortiz <[email protected]>
sorry @bjarki-andreasen I had to remove a section of the documents (I hadnt noticed @kartben last request). I hope this is all :) |
|
Supports the EVL/Xenomai4 gpio benchmarking tool as described in the Xenomai Latmus documentation.
The sample code for the Latmon service uses the FRDM_K64F J2 socket as follows:
The client code running on the SUT shall monitor the falling edge of PIN_20.
Example usage from the latmus client running Xenomai4:
$ latmus -I gpiochip2,23,falling-edge -O gpiochip2,21 ....
Running snapshot:
A sample histogram plot:

Running Sample:
