Timing

Discussion in 'Java' started by Boris Gorjan, May 25, 2006.

  1. Boris Gorjan

    Boris Gorjan Guest

    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?
     
    Boris Gorjan, May 25, 2006
    #1
    1. Advertising

  2. Boris Gorjan

    Oliver Wong Guest

    "Boris Gorjan" <> wrote in message
    news:Gsedg.3369$...
    > 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
     
    Oliver Wong, May 25, 2006
    #2
    1. Advertising

  3. Boris Gorjan

    Boris Gorjan Guest

    Oliver Wong wrote:
    >
    > "Boris Gorjan" <> wrote in message
    > news:Gsedg.3369$...
    >> 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


    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.).
     
    Boris Gorjan, May 26, 2006
    #3
  4. Boris Gorjan

    Oliver Wong Guest

    "Boris Gorjan" <> wrote in message
    news:nTBdg.3388$...
    >
    > 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
     
    Oliver Wong, May 26, 2006
    #4
  5. Boris Gorjan

    Boris Gorjan Guest

    Oliver Wong wrote:
    > "Boris Gorjan" <> wrote in message
    > news:nTBdg.3388$...
    >>
    >> 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


    I'll look into that. Thanks.
     
    Boris Gorjan, May 26, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kieran Francisco

    Timing Diagram to HDL Translation

    Kieran Francisco, Sep 8, 2003, in forum: VHDL
    Replies:
    9
    Views:
    1,313
    VhdlCohen
    Sep 17, 2003
  2. Kload

    Strange Timing Problem

    Kload, Oct 23, 2003, in forum: VHDL
    Replies:
    2
    Views:
    602
    Kload
    Oct 23, 2003
  3. Kload
    Replies:
    1
    Views:
    561
    John_H
    Oct 23, 2003
  4. ramzi
    Replies:
    0
    Views:
    526
    ramzi
    Nov 1, 2003
  5. guille
    Replies:
    0
    Views:
    577
    guille
    Dec 19, 2003
Loading...

Share This Page