-
Notifications
You must be signed in to change notification settings - Fork 25
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
Implement most of chrono::high_resolution_clock #11
Implement most of chrono::high_resolution_clock #11
Conversation
Do you want to add a similiar |
Yes. That is a good idea. I need a few days to implement and test both, maybe throw in a couple of examples.
I like the idea of macro(s) for the clocks. I'll draft all these things out in this PR. |
Now that #12 is merged it would be good if you rebase your branch onto to the current master branch. Then the examples and the new code will get compiled by the CI. |
The standard mandates that "Objects of type |
Thx @rleh. Done. |
I am sort of in the middle of this. As an initial step, I think it is a good first progress to:
Thoughts ... ? The recent push of mine addresses 1,2,4. Point 3 is still open. Let's see how CI plays out... Cc: @chris-durand and @salkinium and @rleh |
Hi @rleh I can't really see where to add examples/chrono/chrono.cpp to the CI Makefile Any tips...? |
You can add your own Makefile to the examples/chrono subfolder and the CI job will run it. |
Note: I added CI runs to push in addition to pull-request. Anyway, this thing should be ready for further discussion/review. CI and chrono-example-build are running green in my fork's CI. |
Done. Thx @rleh |
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 believe this chrono example becomes more useful if we replace the mcal::gpt::*
and reinterpret_cast<>
stuff with the (well known) avr-libc syntax (DDRB |= (1<<5u)
/...).
Oh sure. I'll do that. Got to remember the name of that header at the moment... Thanks for reviewing. |
I was not aware of an error at this time. Did you detect one? |
Good question. How active is your project? How many cycles do you want to burn? It depends on the activity and quality-depth of your project. i work in some projects in which even the tinyest defect can lead to big problems. So we run tests on syntax, unit tests, etc. --- the whole CI on each and every push, branch push, PR and sometimes even scheduled builds. After a bit of thought, I might recommend:
On the other hand regarding points 1 and 2 (i.e., to run CI on pushes/or-not). Since CI on this project runs in about a minute, why not...? I would also recommend setting up a test matrix that tests a few C++ standards, maybe start with C++17 and C++20. It remains to be seen if a a significant number of tests might be added. i would, however, have a bunch of simple ideas if you'd like to pursue these. |
OK folks, Many, many thanks for the excellent, detailed and very thoughtful review comments. I believe the recent checkins address all review comments. if anything else is found in further review rounds, please don't hesitate to post mention of it. I added a test matrix to CI which tests on As a final comment, I retained the running of CI on pushes, as I really think this is best if/as/when we may add a few more tests/examples to this repo. I can, however, be convinced otherwise, but running a minute or so on CI, i would like that added security as a contributor to this/these repos. Cc: @chris-durand and @rleh and @salkinium |
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 feel like this is too convoluted an example, it focusses on things like namespacing to hint at a larger HAL library that isn't really there or auto main() -> int
that is just forced because C++ can do it, but really what value does it add?
I would focus on the chrono now function, and take out the WDT, remove the static_casts in favor of C-style access, move int main()
to the bottom with a visual //==== separator to find it easier.
This example should be very simple, to convince someone to integrate this into their C code without scaring them away with some unfortunate C++ bloat? What do you think?
@salkinium and guys. Decide which you want. The classic example is a 3-to-5 liner that measures the time of a code sequence. It might be better to go for that when showcasing only the functionality of This is a larger refactor/complete-re-design. Please decide. I'm happy to go either way. This post would basically render those above moot. Might be the easiest way to proceed... We could go that way and wrap up HJust provide me your feedback. I'm neutral on it... Cc: @salkinium and @rleh and @chris-durand |
Let's go with that. Simpler and easier is better. |
You bet. Coming right up. Compiling it on CI. Just for the sake of completion, here are a couple of those C++20 |
OK CI green. Pls review.... I'm happy to tune at your request(s)... I stubbed the clock here. Cc: @salkinium and @rleh and @chris-durand |
Ok, that's perhaps a little too minimal, I would still keep the TIMER0_OVF code, that was pretty cool with guarding the rollover via a double read. |
Ok. That was one of my open questions in my mind also... |
OK folks the next iteration of the This iteration of refactoring has/does:
Pls. take a look and comment as needed/felt. Cc: @salkinium and @rleh and @chris-durand |
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.
Awesome, thanks!
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! Thank you!
Hi guys, this one is, for the moment, done and good to go, in my opinion. Tabs as line indentations to be handled in #13. Or should I handle tabs as line indentations here in this PR? |
OK I decided to:
Sorry about the late changes. |
Squash? |
Hi Niklas (@salkinium), if this comment is for me, I'm not exactly sure how to do it... Could you please explain more details? |
The commits in this PR should be squashed into one commit, so that the git history is clean and understandable. |
Well Niklas (@salkinium) I think I did this, or something with essentially the same result. I do admit, though, that I'm not experienced with Git squashing methods. |
Please consider contributing this clock impl back upstream. Edit: Ah, on further inspection, it seems that this just adds a declaration, and leaves the |
Hi Jonathon (@jwakely) this is a good idea. We would need to negotiate on the resolution of the clock(s), as I believe this needs to be specified when laying out a concrete implementation. As time allows, we can/should discuss this matter. I can help where needed and if wanted. |
Fixes #9 via impl of
chrono::high_resolution_clock