File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes JProfiler Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "JProfiler Help" Watch "JProfiler Help" New topic
Author

JProfiler Help

vjy chin
Ranch Hand

Joined: Feb 17, 2005
Posts: 279
I have just installed JProfiler, evaluation version copy in my machine. I have made the initial configuration and settings.

Now I want to use that for testing my stand alone java program and not for web applications or anything. I just want to find how many objects are getting created and so on.

But I am not able to get the accurate results. for e.g if I have 3 objects of String and 2 of StringBuffer, it shows many values like byte[], int, class and all including the count of String and StringBuffer objects. But the no is wrong, like for String it shows 46 instead of 3 and so on. I am not sure if I did the configuration correctly.

Can anyone help me in this issue, I have tried reading the help documents, but couldnt help myself.

Thanks
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by vjy chin:

But I am not able to get the accurate results. for e.g if I have 3 objects of String and 2 of StringBuffer, it shows many values like byte[], int, class and all including the count of String and StringBuffer objects. But the no is wrong, like for String it shows 46 instead of 3 and so on. I am not sure if I did the configuration correctly.


JProfiler doesn't only show you the number of objects your code creates directly, but of *all* objects in the VM. It's likely that your code causes more objects to be created behind the curtain than you are aware of.

Can you show us the code you are profiling?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
vjy chin
Ranch Hand

Joined: Feb 17, 2005
Posts: 279
This is the code I am using


Also I used the Thread.sleep method, since the profiler jvm window closes immediately after the operation. So I just gave a delay.

Thanks
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Mhh, I don't see how your code creates any Strings at all - probably the VM does something in the background (try it with a program that *only* contains the sleep). If I remember correctly, JProfiler can show you from where objects are referenced, and thereby give you a good idea of why they exist at all.
vjy chin
Ranch Hand

Joined: Feb 17, 2005
Posts: 279
Thanks for the reply. Can you tell me where I can look for the objects and where they are being referenced from. What settings should I do?

Also do you want me to run only with the thread.sleep()?
Thanks again
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
I'm currently on vacation and don't have access to JProfiler, so I can't help you with the details, sorry...
vjy chin
Ranch Hand

Joined: Feb 17, 2005
Posts: 279
Thanks dude, You can let me know after you are back from your vacation.

BTW, have a nice vacation.
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JProfiler Help