PoorManProfiler 

HOME INDEX SEARCH GO  

 <<O>>  Difference Topic PoorManProfiler (r1.7 - 31 Dec 2004 - AlainRavet)

 <<O>>  Difference Topic PoorManProfiler (r1.6 - 31 Dec 2004 - TWikiGuest)

 <<O>>  Difference Topic PoorManProfiler (r1.5 - 07 Dec 2004 - AlainRavet)
Added:
>
>

{

Added:
>
>

}

Changed:
<
<

  1. Add the live template in your IDEA session.
    (suggested name : timer)
  2. Add the tools.HashTimer class to your project.
>
>

  1. Add the live template above in your IDEA config.
    (suggested name : timer, or pmp)
  2. Add the tools.HashTimer class to your project.
    (hint: turn it into a File Template)
Deleted:
<
<


 <<O>>  Difference Topic PoorManProfiler (r1.4 - 28 Sep 2002 - AlainRavet)
Changed:
<
<

The PoorManProfiler is a very simple way to know the time spent in some chosen parts of your code.

>
>

The Poor Man's Profiler is a very simple way to know the time spent in some chosen parts of your code.


 <<O>>  Difference Topic PoorManProfiler (r1.3 - 27 Sep 2002 - AlainRavet)
Changed:
<
<

Accuracy is as good as System.currentTimeMillis().

>
>

Accuracy is as good as System.currentTimeMillis() is accurate.

Added:
>
>

How it works :

Changed:
<
<

    

>
>

    

Changed:
<
<

HashTimer.addTimeFor("$text$", timeTaken);

>
>

HashTimer.addTimeFor("$timerId$", timeTaken);

Deleted:
<
<

What does the result look like :

Added:
>
>

What does the result look like :

Added:
>
>

(Tip : select methodName() as the template variable $timerId$ default value)

Added:
>
>

    • enter a timer id
      ex. new UI(), method(), properties loading, ..

 <<O>>  Difference Topic PoorManProfiler (r1.2 - 27 Sep 2002 - AlainRavet)
Added:
>
>

What does the result look like :

    
              new UI()    : 7 calls - 2624 ms
              new Model() : 7 calls - 120 ms
              point 2     : 10 calls - 100 ms


 <<O>>  Difference Topic PoorManProfiler (r1.1 - 27 Sep 2002 - AlainRavet)
Added:
>
>

%META:TOPICINFO{author="AlainRavet" date="1033126800" format="1.0" version="1.1"}% %META:TOPICPARENT{name="AlainRavet"}%
What it is :

The PoorManProfiler is a very simple way to know the time spent in some chosen parts of your code.
Accuracy is as good as System.currentTimeMillis().

  1. A wrapping live template is used to easily wrap the code to watch.
    
             final long before = System.currentTimeMillis();
                  $SELECTION$
             final long timeTaken = System.currentTimeMillis()-before;
             HashTimer.addTimeFor("$text$", timeTaken);
  1. A class - tools.HashTimer - is used to accumulate the data.
  2. Results are obtained by printing the accumulated data :
    
             System.out.println( "\n" + HashTimer.results () );

How to install :

  1. Add the live template in your IDEA session.
    (suggested name : timer)
  2. Add the tools.HashTimer class to your project.

How to use :

  1. Wrap the code to watch with timing code :
    • select the area to watch,
    • [Shift-Ctrl-J]
    • select the timer live template
  2. Print the result, when main() exits :
    public static void main ( String[] args )
    {
        ...        
        System.out.println( "\n" + HashTimer.results () );        
    }

Limitations

  • The accuracy depends 100% on System.currentTimeMillis().

%META:FILEATTACHMENT{name="HashTimer.java" attr="" comment="HashTimer.java" date="1033126190" path="C:\dev\Projects\work on groupOfN@19Sept2002\test-src\tools\HashTimer.java" size="3105" user="AlainRavet" version="1.1"}% %META:FILEATTACHMENT{name="TESTC_HashTimer.java" attr="" comment="" date="1033126269" path="C:\dev\Projects\work on groupOfN@19Sept2002\test-src\tools\TESTC_HashTimer.java" size="1623" user="AlainRavet" version="1.1"}%


View | Diffs | r1.7 | > | r1.6 | > | r1.5 | More

e d i t a t t a c h r e f - b y d i f f s
Ideas,requests,problems regarding this site? Send feedback.
Copyright @ 2000-2003 by the contribution authors. All material on this collaboration tool is the property of the contributing authors.

Revision r1.1 - 27 Sep 2002 - 11:40 GMT - AlainRavet
Revision r1.7 - 31 Dec 2004 - 17:42 GMT - AlainRavet
Copyright © 2001 by the contributing authors. All material on this collaboration tool is the property of the contributing authors.
Ideas, requests, problems regarding this site? Send feedback.