Timing

B

Boris Gorjan

Is there a library available for purposes of timing?

I was thinking of something like timing4j (as in log4j) solving timing "issues"
in a "generic" way, initializable, like log4j, with a properties file
(specifying "registered" calling methods, threads, class loaders, how the data
is exported, etc.).

Example:

public void myMethod(Object myArg) {
try {
Timing.start();
// my code
}
finally {
Timing.end();
}
}

Timing would then accumulate timing data for this particular method: when the
method was called and how long the execution lasted. Timing would also be able
to export so gathered data in different ways: grouped by
1. Calling method (some method that calls myMethod)
2. Calling thread from within which the clling method calls myMethod.
3. Calling thread's ClassLoader.
4. ?

Averages, deviations and other statistical sugar would also be nice.

Does anyone know of (or uses) such a library?
 
O

Oliver Wong

Boris Gorjan said:
Is there a library available for purposes of timing?

I was thinking of something like timing4j (as in log4j) solving timing
"issues" in a "generic" way, initializable, like log4j, with a properties
file (specifying "registered" calling methods, threads, class loaders, how
the data is exported, etc.).

Example:

public void myMethod(Object myArg) {
try {
Timing.start();
// my code
}
finally {
Timing.end();
}
}

Timing would then accumulate timing data for this particular method: when
the method was called and how long the execution lasted. Timing would also
be able to export so gathered data in different ways: grouped by
1. Calling method (some method that calls myMethod)
2. Calling thread from within which the clling method calls myMethod.
3. Calling thread's ClassLoader.
4. ?

Averages, deviations and other statistical sugar would also be nice.

Does anyone know of (or uses) such a library?

If you're planning on using the properties file to turn timing on and
off, it sounds like what you really want is a profiler. A profiler, like a
debugger, wraps around your running program and inserts code to do all of
its timing stuff. As for getting data like averages, deviations etc. that
would be a feature that some profilers provide and other profilers don't.

- Oliver
 
B

Boris Gorjan

Oliver said:
If you're planning on using the properties file to turn timing on and
off, it sounds like what you really want is a profiler. A profiler, like
a debugger, wraps around your running program and inserts code to do all
of its timing stuff. As for getting data like averages, deviations etc.
that would be a feature that some profilers provide and other profilers
don't.

- Oliver

Profiler, yes. But...

I want to detect bottlenecks in a very large distributed web application without
profiler's overkill. Just timing particular methods (inside particular classes
inside particular VMs - not all of them) that have a potential of lasting long
for various reasons (like rmi, jdbc, smtp, etc.).
 
O

Oliver Wong

Boris Gorjan said:
Profiler, yes. But...

I want to detect bottlenecks in a very large distributed web application
without profiler's overkill. Just timing particular methods (inside
particular classes inside particular VMs - not all of them) that have a
potential of lasting long for various reasons (like rmi, jdbc, smtp,
etc.).

Some profilers allow you to specify rules or filters to allow you to
specify exactly which methods it is that you want to profile. See
http://www.eclipse.org/tptp/home/documents/tutorials/profilingtool/profilingexample_32.html#3_3

Some profilers allow you to switch between instrumentation mode (very
accurate, but high overhead) and sampling (less accurate, very low
overhead). See
http://www.ej-technologies.com/products/jprofiler/java-profiler-faq.html#faq2

- Oliver
 
B

Boris Gorjan

Oliver said:
Some profilers allow you to specify rules or filters to allow you to
specify exactly which methods it is that you want to profile. See
http://www.eclipse.org/tptp/home/documents/tutorials/profilingtool/profilingexample_32.html#3_3


Some profilers allow you to switch between instrumentation mode (very
accurate, but high overhead) and sampling (less accurate, very low
overhead). See
http://www.ej-technologies.com/products/jprofiler/java-profiler-faq.html#faq2


- Oliver

I'll look into that. Thanks.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top