Re: using QueryPerformanceCounter in a logger class?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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
--
http://www.danielmoth.com/Blog/

"Jim" <jimpierce@xxxxxxxxxxxxxxxx> wrote in message
news:1140706957.705123.111400@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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




.



Relevant Pages

  • Re: UNREF DIR and LINK COUNT
    ... > the power down/up in order to place it in a rack. ... Put logging on the filesystem. ... > unfavorable messages, and cycled the power successfully without ... as far as possible, and if you cannot cluster it for Production, then ...
    (comp.unix.solaris)
  • RE: Informix 7.30 (I know!)
    ... If you are logging (and of course you are, 'cause it's production) and you don't have raw tables or blobs, then try this. ... New Box - answer 'Y' to log restore. ... New Box - use the first log tape and apply logs ...
    (comp.databases.informix)
  • Re: Student Banking Problem
    ... ready to help track down any future problems. ... even in production to help locate the ... Real logging is easy to turn on and off, and adjust the detail level, ...
    (comp.lang.java.programmer)
  • using QueryPerformanceCounter in a logger class?
    ... simple timer with high performance counters "QueryPerformanceCounter" ... applications have logging turned off? ... Should logging paint routines be turned off in production code? ...
    (microsoft.public.dotnet.framework.compactframework)
  • =?UTF-8?B?UmU6IFN5c3RlbS5vdXQucHJpbnRsbigpIHZzIExvZ2dpbmcsIHdhcyA=?= =?UTF-8?B?UmU6IEpDb21ib
    ... One trouble with System.out.println is that they have to be removed for production. ... The conditions add complexity to your code, instead of being hidden inside the logging aspect. ... Which is a source code change, much harder than not changing source code. ... half dozen logging classes and choosing one then using it. ...
    (comp.lang.java.gui)