Results 1 to 11 of 11
Like Tree1Likes
  • 1 Post By Tolls

Thread: Java profiler explained

  1. #1
    heatblazer is offline Senior Member
    Join Date
    Nov 2012
    Posts
    137
    Rep Power
    0

    Default Java profiler explained

    Hello, I was profiling my application, but I need more competent analyze if everything is OK. I`ve attached the screenshots. The idea of the program is to repaint screens and populate either toggle buttons or slider. The app loads questions form an XML file. The user`s input is collected and a custom logic of the interaction is performed. It`s a quiz application for trials, so there are timers and other threads. But I need an evaluation if I did it OK.
    Attached Thumbnails Attached Thumbnails Java profiler explained-screenshot-06182014-09-01-11-pm.png   Java profiler explained-screenshot-06182014-09-04-34-pm.png   Java profiler explained-screenshot-06182014-09-05-11-pm.png   Java profiler explained-screenshot-06182014-09-06-54-pm.png  

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Java profiler explained

    Does it crash?
    If not you're probably OK.

    I find there's little point analysing an app like this if you haven't encountered an actual problem under load testing.
    That's why we have load testing.
    gimbal2 likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: Java profiler explained

    Highly agreed. Looking at a profiler without having a reason to do so is a surefire way to become extremely paranoid since you see all those nifty graphs bop up and down.

    There is no problem until there is a problem. The Java Virtual Machine is very good at its job, have faith in it.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    heatblazer is offline Senior Member
    Join Date
    Nov 2012
    Posts
    137
    Rep Power
    0

    Default Re: Java profiler explained

    Thanks, I was wondering specificly for the last screenshots, about the deadlock since no deadlock were detected. Is this possible? No I have no problems but I have plenty anonymous classes ...

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: Java profiler explained

    Quote Originally Posted by heatblazer View Post
    about the deadlock since no deadlock were detected. Is this possible?
    Are you asking that when the tool says "no deadlock" that there can still be a deadlock. In other words, can the tool lie to you?

    No I have no problems but I have plenty anonymous classes ...
    You have to finish that sentence.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    heatblazer is offline Senior Member
    Join Date
    Nov 2012
    Posts
    137
    Rep Power
    0

    Default Re: Java profiler explained

    Well, there are tons of cases where I`ve started threads and action listeners as well events too. I do clicks on some places to simulate a touch screen behavior. So I was just wondering could I wrote that program so good that there are no locks or errors. I think not, so can there be any pitfalls in the code. But as a matter of fact, besides the problem that I can`t load the DLL-s for Windows OpenCV (I havn`t put much effort btw), there are no other problems, even the screenshoter works fine.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Java profiler explained

    Just adding in multiple threads does not mean deadlocks will appear.
    It takes fairly specific conditions to create a deadlock, and it needs two resources that competing threads require. I doubt you have that with a Swing app.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: Java profiler explained

    Here is a fun example that pops into my head. Say you have a Swing application which does a heavy duty chore, like stream in live video data

    - the stream never stops producing data so you can streaming from it forever and ever
    - to work around that, the application has the usual play and stop buttons
    - you do the streaming work on the EDT, so you block it and the GUI becomes unresponsive

    Oops, you're not going to get out of that. You're blocking the EDT and the only way to stop that is pressing a button... which will never happen since the EDT is blocked. Sort of a user VS Swing deadlock that happens because you did in fact not add another thread :)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Java profiler explained

    Sadly that's not a deadlock that a profiler would spot. :)
    Some form of FindBugs-esque thing might, I suppose.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: Java profiler explained

    Your brain, arguably the best tool in the world, although Jos' rotating knives machine is also pretty nifty, would also spot it - by examining the thread list and seeing the state of the event dispatch thread.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  11. #11
    heatblazer is offline Senior Member
    Join Date
    Nov 2012
    Posts
    137
    Rep Power
    0

    Default Re: Java profiler explained

    Actually it does not stream anything right now. Just saves a buffered image on slickning the buttons usinge java`s Robot. As for now I am using a separate thread, that starts Process`s ffmpeg player and outputs a file. The termination is confirmed, but it`s Linux only :(

Similar Threads

  1. YourKit Java Profiler 12.0.5
    By java software in forum Java Software
    Replies: 0
    Last Post: 05-04-2013, 03:40 AM
  2. YourKit Java Profiler 12.0.4
    By java software in forum Java Software
    Replies: 0
    Last Post: 04-13-2013, 02:27 AM
  3. ++/--increments for (C/JAVA) explained!!
    By _ShivamKapoOr_ in forum New To Java
    Replies: 5
    Last Post: 09-24-2010, 03:02 PM
  4. Java Profiler?
    By senorbum in forum Threads and Synchronization
    Replies: 0
    Last Post: 05-17-2010, 08:51 PM
  5. Replies: 2
    Last Post: 03-16-2010, 08:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •