-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Implement Stopwatch #12623
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 Stopwatch #12623
Conversation
This comment has been minimized.
This comment has been minimized.
AUTOMERGE: (FAIL)
|
@ledvinap Thanks for the ideas, I like it much better now. Anything else you can spot? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@KarateBrot : Nice and clean. |
This comment has been minimized.
This comment has been minimized.
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.
As this is for development instrumentation we should isolate with USE_STOPWATCH
like we do with USE_TIMER_MAP_PRINT
It is not isolated to development purposes. My example only highlights a debug use case. My intention behind this PR was to provide this as a tool for the BF firmware in general. You can also use it for looptime measurements or any other short-time measurements which need precise timing in BF. |
Do you want to test this code? Here you have an automated build: |
@KarateBrot, Just to know, how to activate this, future in lua or another smart features ? |
@HThuren I'm not completely sure if I understand your question but this is a programmer's tool, not really interesting to BF end users. Now it's just a bit easier or more convenient to very precisely measure short time durations. I don't think it's useful as a "stopwatch for humans" (not yet), as the variable for CPU cycles rolls over in about 15-30 seconds, depending on the clock speed of the CPU. |
You just gave the answer, a programmers tool, not intended for end users, thank you. |
* Implement stopwatch to measure time periods * Add float version of stopwatchGetMicros()
This PR implements a stopwatch for convenient time duration measurements (for example as a debugging tool).
Example code