Skip to content

Commit

Permalink
add comments from @Varriount regarding ARM, refs nim-lang/RFCs#411 (c…
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Aug 27, 2021
1 parent 228717c commit 94a3211
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/std/cputicks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ Experimental API, subject to change.
Future work:
* convert ticks to time; see some approaches here: https://quick-bench.com/q/WcbqUWBCoNBJvCP4n8h3kYfZDXU
* provide feature detection to test whether the CPU supports it (on linux, via /proc/cpuinfo)
* test on ARMv8-A, ARMv8-M, arm64
## js
* we use `window.performance.now()`
## nodejs
* we use `process.hrtime.bigint()`
## ARM
* The ARMv8-A architecture[1] manual explicitly states that two reads to the PMCCNTR_EL0 register may return the same value[1a].
There is also the CNTVCT_EL0[1b] register, however it's unclear whether that register is even monotonic (it's implied, but not stated explicitly).
The ARMv8-M architecture[2] has the CYCCNT register, however all that's mentioned is that it is an "optional free-running 32-bit cycle counter"[2a].
## references
[1] https://documentation-service.arm.com/static/611fa684674a052ae36c7c91
[1a] See [1], PDF page 2852
[2] https://documentation-service.arm.com/static/60e6f8573d73a34b640e0cee
[2a] See [2]. PDF page 367
## further links
* https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/ia-32-ia-64-benchmark-code-execution-paper.pdf
Expand Down

0 comments on commit 94a3211

Please sign in to comment.