using QueryPerformanceCounter in a logger class?

J

Jim

Hi

I have existing code that uses a simple timer to profile time spent in
various methods and log it to a file. I would like to replace the
simple timer with high performance counters "QueryPerformanceCounter"

Are there any drawbacks to using high performance timers in a logger
class?

This actually brings up another point. Can logging information to a
file slow the application down significantly? Should production
applications have logging turned off? What type of routines are bad
candidates for logging data to a file. I.e. paint routines.

Should logging paint routines be turned off in production code?

Maybe I should change the subject to "Best Practices for logging data
in production applications". Sounds like a good book or at least a good
white paper.

Sorry for the morning ramble.

Quote for the day -- "Maybe i should blog this before I get flogged"

[DllImport("coredll.dll")]
extern static int QueryPerformanceCounter(ref long perfCounter);

[DllImport("coredll.dll")]
extern static int QueryPerformanceFrequency(ref long frequency
 
D

Daniel Moth

Look at the Stopwatch (in SDF from OpenNETCF or my blog) for timing
functions.

For your logging/perf questions, only you know how much of it you are doing
and how long it takes. Spitting out INFO messages in production is obviously
not smart. Spitting out ERROR messages would be essential. When it comes to
WARNING messages the choice is yours as everybody's definition of them
varies.

Cheers
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top