I am writing a maze solver of sorts and experimenting with adding parallelism to make it run faster. I would like to know exactly how much parallelism I am achieving by counting how many clock ticks the program takes to run. The regular system timing has not been working out for me, as it changes by over 10% on different runs of the same program. Manually calculating parallelism is not an option for me either, as I do multiple recursive calls as I branch out in the search, and the order of such calls depends on the input maze. How can I count clock ticks?
Asked
Active
Viewed 114 times
0
-
1If regular system timing changes by over 10%, why would you expect clock ticks to be any different? Perhaps you should read: [How do I write a correct micro-benchmark in Java?](https://stackoverflow.com/q/504103/5221149) – Andreas Dec 04 '20 at 01:59
-
Does this answer your question? [How do I write a correct micro-benchmark in Java?](https://stackoverflow.com/questions/504103/how-do-i-write-a-correct-micro-benchmark-in-java) – Robert Dec 04 '20 at 02:01
-
@Andreas I assumed that the 10%+ changes in run time is associated with my computer's variable clock speed. I would expect that ticks would vary by much less on the same input, given that my program is deterministic. Am I wrong? – disillusioneddeath Dec 04 '20 at 02:29
-
Are you looking to measure how long it takes to run a block of your code? – MehranB Dec 05 '20 at 09:20