This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Performance and the fly likes Java code analysis tools.    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Java code analysis tools.    " Watch "Java code analysis tools.    " New topic
Author

Java code analysis tools.

Piyush Tripathi
Greenhorn

Joined: Jan 28, 2009
Posts: 16
Hi,
I'm looking for some java code analysis tools to analyze the java code from performance point of view.The specific feature that i'm looking for is the ability of the tool to recognize a specific pattern in the code and point it out.For example if I want to search whether there is a use of nested for or while loop in the code then the tool should be able to recognize it.This was one example ,similarly the tool should be able to recognize a pattern in the code.

Please point out the appropriate tool for the purpose.Also point out the tools which can be used as plugins to Eclipse for the above mentioned purpose.

Thanks in advance,
Piyush
Balagopal Kannampallil
Ranch Hand

Joined: Oct 18, 2004
Posts: 136

You can use JProfiler


SCJP 5.0 and now fighting with ExtJS
Piyush Tripathi
Greenhorn

Joined: Jan 28, 2009
Posts: 16
Thanks for the information.
What i read about Jprofiler is that it can give views on memory usage ,finding instances which are on the heap,shows call sequences and shows list of most time consuming methods.
What i wanted was a tool that could find a particular pattern in the code and list the ocurrence of it , if there is any such tool.

Piyush

Piyush Tripathi
Greenhorn

Joined: Jan 28, 2009
Posts: 16
Hi,
I was reading about a tool called PMD on the net.Has anyone worked on it .I read it can check for unused try/catch block.Can it find whether there is use of nested for or while loop in the code.

Thanks,
Piyush
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42371
    
  64
It's possible to extend PMD with new rules to check. See "Customizing PMD" on the PMD site, especially "How to write a rule" and "Writing XPath rules".


Ping & DNS - my free Android networking tools app
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Piyush Tripathi wrote:Hi,
I was reading about a tool called PMD on the net.Has anyone worked on it .I read it can check for unused try/catch block.Can it find whether there is use of nested for or while loop in the code.

Yes it can find any Java construct. Keeping in mind nested loops aren't always a performance problem.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hi Ranchers,
One of the Ranchers has suggested using JProfiler,Can you tell me from where to download this tool.

My requirement is to to "independently" test java application.

Note:JDK used is 1.5

--
Deepak Lal


When The Going Gets Tougher,The Tougher gets Going
Prashant Saraf
Ranch Hand

Joined: Sep 25, 2006
Posts: 52

Hi, i use two tools for Java code analysis. PDM and findbugs, both of them are available as plug-in for eclipse. They are best tool to review your code.

Piyush Tripathi wrote:Hi,
I was reading about a tool called PMD on the net.Has anyone worked on it .I read it can check for unused try/catch block.Can it find whether there is use of nested for or while loop in the code.


PDM does that even Findbugs does it for your

Thanks
Prashant Saraf
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Hi,
I'm new to using plugin(PDM and findbugs) in an Eclipse IDE. Can you tell me the steps for using these plugin in eclipse IDE.
--
Deepak Lal
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Deepak Lal wrote:Hi,
I'm new to using plugin(PDM and findbugs) in an Eclipse IDE. Can you tell me the steps for using these plugin in eclipse IDE.
--
Deepak Lal

PMD and FindBugs.

Do you remember in your thread about EJBs where I asked you to show you made an effort? It took me less than a minute to find these two links. Did you spend any time trying to search for an answer before asking here? If so, please post an indication of what you tried next time you have a question. If not, why not? Are you less able to use Google than others?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java code analysis tools.