Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Code Profilers?

  1. #1
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Question Code Profilers?

    I've been tasked with improving the performance of a piece of software at work, which means I need to find a profiler- not only to help track down problematic code, but maybe even more importantly, to measure how much I've actually improved the system.

    There are some basic things I could do, such as timing how long it takes for a method to run (or how long it takes to run 1000 times). However, the systems at work are not the most reliable machines, so that type of performance can depend on how many people are using a machine, what processes are running, which direction the wind is blowing at that moment, etc. So in a perfect world I'd find a profiler that will give me data that's more useful than raw times.

    I'm usually an opponent of optimization (unless things are unusable, and in this case they are), so I don't really know anything about profilers. I'm using a program called FindBugs that will point out potentially crappy pieces of code, but I'm still not quite sure how to actually measure the performance. I've looked into JProfiler, but that's apparently not free.

    I'm going to send out an email at work asking their opinion, but I thought I'd check here to see if you guys have any experience with something I haven't heard about. Thanks for your time.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!


  2. #2
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default Re: Code Profilers?

    I usually rely on the standard profiling information from java -X prof for profiling, System.nanoTime() statements inserted in code, and use visualvm and its excellent heap inspection facility. For me problems with performance are often flagged up by excessive object creation. Visualvm has some plugins with 'profile' in the name, though I haven't tried any of them - maybe they're worth a spin?

    Home — Java.net

  3. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Code Profilers?

    I'll definitely check that out. I'm not sure how much the System.nanoTime() will help me- on a predictable machine it absolutely would, but not so much on my highly variable work machines. But the VisualVM seems pretty handy. Thanks.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Code Profilers?

    My 0.02

    If you are required to provide some form of evidence that an improvement has been made for the benefit of the company then they should fork out the coin to provide you with the necessary tools to achieve your goals.
    Improving the world one idiot at a time!

  5. #5
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default Re: Code Profilers?

    I'm assuming they already have some metric for performance, since you've been asked to do some work. Is it a reliable, precise measure or are they looking at a screen and saying "ooh I don't like that"? Can you employ their metric?

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Code Profilers?

    Their metric is "this takes a godawful long time to complete". It's a huge company so I'd be surprised if we didn't have access to some kind of profiling tool, but to my knowledge none has been used on this piece of software yet. But since this is mostly a "figure out how to do this and then do it" type task, I figured I'd educate myself as much as possible before writing any emails.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Code Profilers?

    Eclipse has the TPTP plugin - which I never have the patience to install so I haven't tried it - that you might wish to check out. Another tool is jconsole, which lets you visualize what's going on in a running java app. Java VisualVM is another tool you might want to look at as well. Note I haven't used these extensively (I prefer the old fashioned currentTimeMillis approach)