Message board for the users of flat assembler.
> High Level Languages > code profiling/debug trap
Posetf 18 May 2006, 01:51
This is actually a very simple Yes/No question, see below.
I want to do two things: profile by time and by execution count.
Right at the start I have two simple fields:
line dd ?
file dd ?
For execution count profiling I can just set a simple debug trap on [line] which I know exactly how to do, no fuss. (Though I can think of a simpler and probably faster way which I may end up using)
After a (long!) day spent in google, where the answer seems to be
timeGetDevCaps / timeBeginPeriod / timeSetEvent / timeKillEvent,
I thought I would ask here anyway.
What I really want to do is invoke a bit of code on a periodic basis and
record what I've left in [line] and [file]. (What I probably really do not want to do is check the time every time I set line, as that will skew things)
As above, I now think the only way to do this (under Win98+) is via the
above api routines (which seems alot simpler than either the CreateWaitableTimer/SetWaitableTimer functions which need a separate
(sleeping) thread or mess with IRQ0/int 70h which seriously confused me.
Maybe I just don't know what to type into google but I cannot seem to find any decent/understandable examples of this, and it seems I am not alone.
Hopefully that will take care of time_profiling, but still not as simple as a
plain debug trap (for me, anyway).
So my question is this: Does Windows keep a time field anywhere in memory that I can also set a simple debug trap on?
PS at some point I will want to do similar on Linux, so any pointers would be handy for future reference.
|18 May 2006, 01:51||
Kain 20 May 2006, 04:07
Your CPU has a timing mechanism built in which would also work with Linux, though you may have to write some algos to get meaningful results. Take a look at RDTSC instruction (and CPUID for serialization).
|20 May 2006, 04:07||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.