How to disable interrupts on win32 with masm32 to use rdtsc instruction

Started by edkedk, August 16, 2006, 10:22:40 AM

Previous topic - Next topic

edkedk

Hi,

I want to check how many cpu-cycles certain routines i have coded consume, but i _must_ disable all interrupts during this moment, otherwise the rdtsc timestamps are not the real amount of cycles from the routine.

Windows does not like it when i use the "cli" instruction, it closes my win32 app.
What is the best option for me ?

ex.


mainloop:
...
...
<disable interrupts ?>

rdtsc
save dx:ax
call routine
rdtsc
sub dx:ax from saved dx:ax
rdtsc

<enable interrupts again?>

jmp mainloop if not keypressed



I hope someone can help me out.

Thanks for your time!


Bye,

Erik de Keijzer


Mark Jones

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08


Mark_Larson

BIOS programmers do it fastest, hehe.  ;)

My Optimization webpage
htttp://www.website.masmforum.com/mark/index.htm

dioxin

Erik,
   run your code in Windows 98, it may be scoffed at but it has a much more sensible approach to the user and doesn't try to stop you using CLI/STI.


Paul

Mark Jones

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

dioxin

Mark,
  MS may no longer support Win98 but Win98 doesn't stop working because of that.

Paul.

Mark Jones

So I wonder, is it more a financial push, the migration to newer versions of Windows?

Or are they trying to distance themselves from older code?
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08