flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > code profiling/debug trap

Thread Post new topic Reply to topic

Joined: 01 Mar 2004
Posts: 35
Location: London
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.
Post 18 May 2006, 01:51
View user's profile Send private message Visit poster's website Reply with quote

Joined: 26 Oct 2003
Posts: 108
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).
Post 20 May 2006, 04:07
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.