|
|
| Added: |
> > |
{
|
| Added: |
> > |
}
|
| Changed: |
< < |
- Add the live template in your IDEA session.
(suggested name : timer)
- Add the tools.HashTimer class to your project.
| > > |
- Add the live template above in your IDEA config.
(suggested name : timer, or pmp)
- Add the tools.HashTimer class to your project.
(hint: turn it into a File Template)
|
| Deleted: |
< < | |
|
|
| 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.
|
|
|
| Changed: |
< < |
Accuracy is as good as System.currentTimeMillis().
| > > |
Accuracy is as good as System.currentTimeMillis() is accurate.
|
| Added: |
> > |
|
| Changed: |
< < |
| > > |
|
| Changed: |
< < |
HashTimer.addTimeFor("$text$", timeTaken);
| > > |
HashTimer.addTimeFor("$timerId$", timeTaken);
|
| Deleted: |
< < |
|
| Added: |
> > |
|
| Added: |
> > |
(Tip : select methodName() as the template variable $timerId$ default value)
|
| Added: |
> > |
-
- enter a timer id
ex. new UI(), method(), properties loading, ..
|
|
|
| Added: |
> > |
new UI() : 7 calls - 2624 ms
new Model() : 7 calls - 120 ms
point 2 : 10 calls - 100 ms
|
|
|
|
| Added: |
> > |
%META:TOPICINFO{author="AlainRavet" date="1033126800" format="1.0" version="1.1"}%
%META:TOPICPARENT{name="AlainRavet"}%
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().
- 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);
|
- A class - tools.HashTimer - is used to accumulate the data.
- Results are obtained by printing the accumulated data :
System.out.println( "\n" + HashTimer.results () );
|
- Add the live template in your IDEA session.
(suggested name : timer)
- Add the tools.HashTimer class to your project.
- Wrap the code to watch with timing code :
- select the area to watch,
- [Shift-Ctrl-J]
- select the timer live template
- Print the result, when main() exits :
public static void main ( String[] args )
{
...
System.out.println( "\n" + HashTimer.results () );
}
- 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
|
|