Repository navigation
Improve aarch64 timing - #778
Open
nicolas-bouton wants to merge 5 commits into
Open
nicolas-bouton wants to merge 5 commits into
nicolas-bouton wants to merge 5 commits into
Conversation
The CPU-frequency lookup and `fixedFreq` initialization were commented out. Remove that dead code and the remaining code that uses `fixedFreq`. Signed-off-by: Nicolas Bouton <nicolas.bouton@sipearl.com>
x86 first retrieves the CPU frequency with CPUID and falls back to a software estimate using a loop and an N-nanosecond sleep. AArch64 has no userspace instruction for retrieving the frequency and uses a different, less optimal software estimate. Use the x86 fallback implementation as the shared software estimate for both architectures. Signed-off-by: Nicolas Bouton <nicolas.bouton@sipearl.com>
The return value of `gettimeofday()` was ignored on error. Terminate the program when the call fails. Signed-off-by: Nicolas Bouton <nicolas.bouton@sipearl.com>
The core logic in os_timer_start() and os_timer_stop() is the same. Remove these functions. Signed-off-by: Nicolas Bouton <nicolas.bouton@sipearl.com>
Timestamps are read from the `cntvct_el0` system register, and the counter frequency is read from `cntfrq_el0`. Since the counter frequency cannot be changed, it is read only during timer initialization. Runtime in seconds is then calculated by dividing the timestamp by the counter frequency. Signed-off-by: Nicolas Bouton <nicolas.bouton@sipearl.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following PR #776, this PR adds support for the ARMv8 hardware timer counter.
Timestamps are read from the
cntvct_el0system register, and the counter frequency is read fromcntfrq_el0. Since the counter frequency cannot be changed, it is read only during timer initialization. Runtime in seconds is then calculated by dividing the timestamp by the counter frequency.Before this change, several cleanup commits removed dead code, aligned the x86 and AArch64 CPU-frequency software estimates, handled gettimeofday() errors correctly, and removed redundant
os_timer_*()functions.