-
Notifications
You must be signed in to change notification settings - Fork 24
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
Plugin API for tracing #342
Conversation
There are corresponding changes in main lingua-franca repo.
This is cheating because it assumes that the compiled binary is on the classpath.
Much code cleanup to come.
Not completely librarify it because the headers are all intermingled :( But at least tracing HelloWorld compiles!
f009a26
to
6eea01b
Compare
Errors which only show up in CI...?
48461fa
to
706f721
Compare
I want the metadata available as early as possible. The start time we cannot do much about, but with fed id, we can know as soon as we want.
78f300c
to
ef3077a
Compare
ef3077a
to
98b7df0
Compare
5f4ef6b
to
f5c780e
Compare
I think that this PR is once again ready for review. Changes since it was last reviewed are in the spirit of Christian's comment above. Because the platform directory had already had to be librarified earlier in the development of this branch, and because the logging API was already separate, I found it to be easiest to put those in their own directories already. I also decided to set a precedent of keeping separate Of course this directory structure does not need to be final. We can keep iterating on it later, ideally using an RFC, when this issue rises back to the top of our priority list. |
This is compile-time facts that do not change as the program runs, so mutating it will only reduce debuggability.
The purpose of the prefix is to prevent name collisions.
The idea was that in order to be thread safe we needed to use a thread id in order to access memory that is not shared with other threads. If there are multiple environments than what was being done before this commit had a race condition.
The no-arguments way of calling fedsd makes an assumption about the name of the RTI trace file. This change makes that assumption correct again.
This is only a problem when the user calls LF API functions from a thread that was not created by the runtime.
e27cf26
to
bc192e3
Compare
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.
Great! This is quite a significant refactoring, and I am amazed and glad to see that this has an immediate positive effect on the tooling.
I left a bunch of comments. Most of them are about known issues that I have documented in #360 or that we should still document as issues (but I am lacking the details). I also made a few small requests for changes, which I think should be addressable rather quickly. If not, feel free to ignore them. None of them are crucial.
Personally, I am not a fan of the build scripts that this PR adds, but I'll leave it to the main devs of this repo to decide. I think it is more important to try to educate people on how to interact with cmake than to provide simple scripts. In the case where you have to frequently switch between cmake configurations (like you probably did), I would recommend creating multiple build directories with descriptive names, initializing them once with the configuration that you want. Then you just cd into the build directory with the intended configuration and run make
or cmake --build
to (re)compile this configuration. This should work flawlessly, even if you update cmake scripts in your changes.
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.
Looks like commenting does not override a prior "Request changes", so here is my approval.
Looks like this PR has 2 approvals, so I don't think more people are obligated to give another in-depth review. I'm going to leave this open for at least 24 hours in case anyone else has comments, and also to give time for the companion PR lf-lang/lingua-franca#2192 to get approved, and then I'll merge this. |
Great work Peter! I am curious to understand the need for the two-level platform API. This should not block the merging, I am just interested to hear your thoughts. It seems that the "higher-level" platform API does not really provide any functionality, and just calls the lower-level platform API. Is the problem you are solving the fact that we have these Another solution,which I think is more elegant, could be to define them in
And so on, Then each particular platform implementation can use the *priv field for their private data, which would be dynamically created at creation. This would make it so that we cannot just define This is the sort of inheritance they do in the Linux device driver implementations which I have just started learning about. |
Correct. This is how I intended the "higher-level" platform API to remain for the foreseeable future -- just a wrapper around the lower-level platform API.
Yes, exactly.
Really I was fixated on getting an interface where you know what it will compile to, regardless of compilation options, without having to understand any preprocessor code. This "leaking" is not exactly the problem that I was trying to solve. However, now that you mention it I think you're right, this is an important added benefit; furthermore, it is solved both by what you describe and by what I have done with
I see this proposal as being very similar to what I have done with
Item 2 is obviously a generally good idea to do, in those cases where it makes sense. I would argue that item 2 is compatible with the route that I have already taken and is not dependent on item 1; we can always create structs in Item 1, however, does represent an important tradeoff. Last Monday I discussed this with Edward and Christian and I promised that my attempts to create this The tradeoff is as follows. If the preprocessor-independent Are these disadvantages practically significant? I haven't measured the memory footprint or the performance differences, but I also don't want to have to make those measurements, and I don't want to have to engage in a time-consuming discussion about those measurements. If we set the precedent that anything that could conceivably have overhead is provided with some sort of escape hatch that isn't constrained to have the |
This PR turns tracing into a separately-compiled library instead of a part of the core runtime.
core
and APIs provided by pluginslingo
(EDIT: This will be a separate effort and should not block this PR)[ ] improvelingo
test framework[ ] write a failing test[ ] pass the failing testUpdate: I have decided that there is no reason not to review the internal RFC for the tracing plugin before reviewing this PR. The internal RFC is short and probably quick to read and provides explanation about what is going on in this PR.