| View previous topic :: View next topic |
| Author |
Message |
Corruptor Advanced Cheater
Reputation: 3
Joined: 10 Aug 2011 Posts: 84
|
Posted: Wed Jun 06, 2012 12:16 pm Post subject: Count instructions / clock cycles between breakpoints |
|
|
| Well, headline sums it up pretty well i guess, is there any way to count them? (like, except for step-by-steping manually, which usually takes a lot of time)
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 474
Joined: 09 May 2003 Posts: 25949 Location: The netherlands
|
Posted: Wed Jun 06, 2012 12:50 pm Post subject: |
|
|
Breakpoints take way to long:
Bp interrupt fires, windows checks where to pass it off to. Wait till the debugger thread gets a cpu slice, handle the breakpoint, do stuff...
Mark process as executable again and wait
Then finally the process that the breakpoint happened in gets to continue
In short the breakpoint itself would most likely take up more time than the number of cpu ticks the code would have taken normally
Go with small code injections instead. Do a code injection at point 1 and a code injection at point 2
in code injection 1 do a rdtsc to store the current timestamp
in code injection 2 call rdtsc again, take the difference, and you'll have something that resembles the clock cycles between the two points
Note though that this can be variable due to task-switches occurring between the two spots
The only perfect way to count all instructions is to single step every single one of them, including kernelmode
_________________
Tools give you results. Knowledge gives you control.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Corruptor Advanced Cheater
Reputation: 3
Joined: 10 Aug 2011 Posts: 84
|
Posted: Thu Jun 07, 2012 9:34 am Post subject: |
|
|
thx, worked perfectly again
|
|
| Back to top |
|
 |
|