Re: Loop profiling



On Wed, 28 Mar 2007 05:20:23 -0500, Christian Christmann wrote
(in article <pan.2007.03.28.10.20.23.340890@xxxxxxxx>):

On Wed, 28 Mar 2007 00:34:57 +0000, Randy Howard wrote:


I suspect you're going to have to instrument it yourself, but with
something more friendly to your goal than printf statements.

Any ideas? Right now, I help myself out with C macros but the
instrumentation is still very tedious.

Well, easy answer would be to write the loop iteration count statistics
to a log file, in a well-defined format that included the function
name, a line number, etc., then have another tool (or even
a shell script using grep intelligently) to pull the data back out and
present it in a more nicely formatted way.

Or, you could get really serious about it and store the data in a
database, and perhaps that way even log multiple runs of the program
over time, with for example different command line parameters or
something. I'm guessing here, because I'm not totally sure what you
are after.

If you want to record the expected iteration count in a for loop, as
well as the actual number, you're going to have to do something on
each iteration, so that if it is terminated early somehow you know that
as well. Again, it all depends upon what you are really trying to
measure. Don't expect this to run fast if you get carried away...
:-)

The end answer is that if you are looking for a special tool, and one
doesn't exist already, perhaps you will write one and others will find
it useful as well.


--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw





.