View Single Post
Old 14 October 2015, 14:47   #13
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 48
Posts: 1,143
Quote:
Originally Posted by Leffmann View Post
But IMO skip the timers and the interrupts, and definitely skip membership in the "Cycle Counter Party", and just run your code multiple times and use the TOD clocks instead. You'll never have an error greater than about 64 ┬Ás, which means your result will be accurate within 0.01% even if you only measure over a single second.

EDIT: Example. Divide the result by the horizontal scan frequency if you want the time in seconds:
Code:
    (make sure the system interrupts are disabled while you run this)
    [...]
.1  (result in D0)
Nice. This has about the same overhead as dumping VHPOSR and VPOSR and requires a simpler conversion but is less precise (for one measurement).

I guess which of these methods to use really boils down to what the end usage is:
- If you want to profile many functions in an existing interactive program: use VHPOSR/VPOSR.
- If you want to time a specific function in isolation and does not need ultra precision: use Meynaf's VBL counter.
- If you want to time a specific function in isolation and *do* require high precision and do not want to wait: use Leffmann's time of day suggestion.

ReadOnlyCat is offline  
 
Page generated in 0.04258 seconds with 11 queries