??? 07/28/05 00:47 Read: times |
#98311 - Counting machine cycles Responding to: ???'s previous message |
Counting machine cycles gets a little difficult with 'c' as the compiler makes the decisions. You can read the assembler output from the compiler and manually lookup how many cycles each instruction takes and count them for each execution path. A technique I use is to set/reset a port pin at the start and end of the particular routine I want to measure and observe it with an oscilloscope (you may be able to use some software and your sound card at a pinch - I don't know how accurate it would be). That should give you a reasonable idea of the execution time. Another technique is if you have a spare timer is to start/stop it in the routine in question. This adds a little overhead, but again it will give you some hard numbers to work from. |