Skip to main content

Java Virtual Machine Statistics Monitoring Tool on phoneME Advanced

16 replies [Last post]
stogawa
Offline
Joined: 2007-12-20
Points: 0

Hello.

I'm using phoneME Advanced MR1 (CDC) on Linux/sh3.

I want to monitor Java VM statistics (for example, capacity and utilization of heaps).
Are there tools that can monitor Java VM from outside of VM (like to jstat or jvmstat on J2SE) ?

I want to add a VM management function that can manage get capacity and utilization of heaps.
On J2SE, Java VM has class PerfCounter, and jstat generates return values from this class.
Has anyone made it yet?

When implementing this function, It seems to need to modify shared code.
Should I modify shared code for this function individually?
Do some developers have plan to support it?

I cannot use profiler on emulators on WTK.
Because I want to use CDC (not CLDC),
and my Java applications use JNI functions specialized to some I/O devices.

Thank you.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
billp
Offline
Joined: 2006-09-19
Points: 0

jvmtihprof is only supported via the -agentlib or -agentpath options, so the 1st script
you have is the correct one. To get the help printout run like so:
/cvm \
-agentpath:${LIBDIR}/libjvmtihprof.so=help \
-Xbootclasspath/a:${LIBDIR}/java_crw_demo.jar \
Hello

bill

stogawa
Offline
Joined: 2007-12-20
Points: 0

Hi, Bill.

I success it with "help" and "cpu=samples" options.
Thank you!

bherrera
Offline
Joined: 2005-04-28
Points: 0

Hi Guys,

Does anybody knows the status of Netbeans and phoneME profiling?
I tried to run it from Netbeans 6.8, but I got an error trying to attach :

[b]
Profiler Agent: Initializing...
Profiler Agent: Options: >/home/bmh/Desktop/profiler-server-linuxcvm/bin/../lib/,5140<
Profiler Agent: Initialized succesfully
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 9)
Profiler Agent: Established local connection with the tool
java.lang.NoSuchMethodError: java.io.RandomAccessFile: method getChannel()Ljava/nio/channels/FileChannel; not found
>at org.netbeans.lib.profiler.server.EventBufferManager.openBufferFile(I)V(EventBufferManager.java:161)
>at org.netbeans.lib.profiler.server.ProfilerInterface.initiateInstrumentation(Lorg/netbeans/lib/profiler/wireprotocol/InitiateInstrumentationCommand;Z)V(ProfilerInterface.java:548)
>at org.netbeans.lib.profiler.server.ProfilerServer.handleClientCommand(Lorg/netbeans/lib/profiler/wireprotocol/Command;)V(ProfilerServer.java:1409)
>at org.netbeans.lib.profiler.server.ProfilerServer.listenToClient()V(ProfilerServer.java:1714)
>at org.netbeans.lib.profiler.server.ProfilerServer.run()V(ProfilerServer.java:682)
>at java.lang.Thread.startup(Z)V(Thread.java:785)
[/b]

I check out the FileChannel and the getChannel methos is comment out with this note :
[i]
/* NOTE: No NIO in CDC
[/i]

Does anybody has any clue?

Thanks
Herrera

billp
Offline
Joined: 2006-09-19
Points: 0

When you attached from Netbeans did you use actual hostname or IP address of VM machine? If you use 'localhost' instead it will not work correctly. Try using the IP of the machine you are running the VM on, even if it is the same machine running Netbeans.

bill

stogawa
Offline
Joined: 2007-12-20
Points: 0

I tried to run jvmtihprof on Linux/x86.

1st, a script below success, and a profile file "java.hprof.txt" is outputted.
----
#!/bin/sh

LIBDIR=/home/togawa/work/phoneme/phoneme_advanced-mr2-dev-b53/cdc/build/linux-x86-generic/lib

./cvm \
-agentpath:${LIBDIR}/libjvmtihprof.so \
-Xbootclasspath/a:${LIBDIR}/java_crw_demo.jar \
Hello
----
2nd, a script below success, but a profile file is not outputted.
----
#!/bin/sh

LIBDIR=/home/togawa/work/phoneme/phoneme_advanced-mr2-dev-b53/cdc/build/linux-x86-generic/lib

./cvm \
-Xrunjvmtihprof \
-Xbootclasspath/a:${LIBDIR}/java_crw_demo.jar \
Hello
----
So I wonder that:
1. Can I add some hprof options (for example "help") in 1st sctipt?
2. 2nd script is correct?

Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> I tried to run jvmtihprof on Linux/x86.
>
> 1st, a script below success, and a profile file "java.hprof.txt" is outputted.
> ----
> #!/bin/sh
>
> LIBDIR=/home/togawa/work/phoneme/phoneme_advanced-mr2-dev-b53/cdc/build/linux-x86-generic/lib
>
> ./cvm \
> -agentpath:${LIBDIR}/libjvmtihprof.so \
> -Xbootclasspath/a:${LIBDIR}/java_crw_demo.jar \
> Hello
> ----
> 2nd, a script below success, but a profile file is not outputted.
> ----
> #!/bin/sh
>
> LIBDIR=/home/togawa/work/phoneme/phoneme_advanced-mr2-dev-b53/cdc/build/linux-x86-generic/lib
>
> ./cvm \
> -Xrunjvmtihprof \
> -Xbootclasspath/a:${LIBDIR}/java_crw_demo.jar \
> Hello
> ----
> So I wonder that:
> 1. Can I add some hprof options (for example "help") in 1st sctipt?
> 2. 2nd script is correct?
>

Hi stogawa,

Bill P. is the best person to help you with your questions. But, I'm
sending you links to JVMTI info in case you don't have it already:

http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html
http://java.sun.com/developer/technicalArticles/Programming/jvmti/

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

stogawa
Offline
Joined: 2007-12-20
Points: 0

Thank you, Bill!
I'll use jvmtihprof to test JVMTI.

billp
Offline
Joined: 2006-09-19
Points: 0

The current Netbeans profiler codebase does not support PhoneME Advanced "out of the box". We are working with the Netbeans team to address this. The VM itself does have JVMTI profiling support in it and you can use the jvmtihprof demo tool that is in the phoneMe advanced source tree. We will keep this forum posted on any progress with the Netbeans profiler

Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> The current Netbeans profiler codebase does not support PhoneME Advanced "out of the box". We are working with the Netbeans team to address this. The VM itself does have JVMTI profiling support in it and you can use the jvmtihprof demo tool that is in the phoneMe advanced source tree. We will keep this forum posted on any progress with the Netbeans profiler
>

Thanks, Bill! :-)

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

billp
Offline
Joined: 2006-09-19
Points: 0

The changes needed to run the Netbeans 6.x profiler against CVM did not make it in to the 6.0 branch. I've sent an email to the Netbeans team to see if the changes will be going into the 6.1 trunk. I'll keep you posted.

bill

bherrera
Offline
Joined: 2005-04-28
Points: 0

sorry for the late feedback...

Thanks bill it worked!

stogawa
Offline
Joined: 2007-12-20
Points: 0

Hi All,

I tried to use NetBeans profiler by phoneME Advanced MR2 b53 on Linux-x86-generic platform. I got netbeans-6.0.1-200801291616-ml-profiler.zip.
But I got some errors.

When I execute below, an error has occurred.
----
#!/bin/sh

NB_DIR="/home/togawa/work/netbeans/profiler2"
JAR_DIR=${NB_DIR}/lib

./cvm \
-classpath .:${JAR_DIR}/jfluid-server.jar:${JAR_DIR}/jfluid-server-15.jar \
-agentpath:"${NB_DIR}/lib/deployed/jdk15/linux/libprofilerinterface.so"="\"${NB_DIR}/lib\"",5140 \
Hello
----
And I executed this
----
$ cd /home/togawa/work/netbeans/profiler2/lib/deployed
$ ln -s jdk15 UNSUPPORTED_JDK
----
And another error occored.
----
[togawa@trece03 bin]$ ./netbeans
Profiler Agent: Initializing...
Profiler Agent: Options: >"/home/togawa/work/netbeans/profiler2/lib",5140<
Profiler Agent: Initialized succesfully
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 8)

(Executed NetBeans on another machine, and attached profiler)

Profiler Agent: Established remote connection with the tool
Profiler initialization failed due to:
java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory
at org.netbeans.lib.profiler.server.system.Timers.initialize(Timers.java:84)
at org.netbeans.lib.profiler.server.ProfilerInterface.initProfilerInterface(ProfilerInterface.java:459)
at org.netbeans.lib.profiler.server.ProfilerServer.initSupportingFunctionality(ProfilerServer.java:973)
at org.netbeans.lib.profiler.server.ProfilerServer.doActivate(ProfilerServer.java:904)
at org.netbeans.lib.profiler.server.ProfilerServer.activate(ProfilerServer.java:512)
----
I think that this error is different from Byungseon's one.

When I re-compile NetBeans remote profiler, can I refuse this error?

Regards,
Togawa

Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> Hi All,
>
> I tried to use NetBeans profiler by phoneME Advanced MR2 b53 on Linux-x86-generic platform. I got netbeans-6.0.1-200801291616-ml-profiler.zip.
> But I got some errors.
>
> When I execute below, an error has occurred.
> ----
> #!/bin/sh
>
> NB_DIR="/home/togawa/work/netbeans/profiler2"
> JAR_DIR=${NB_DIR}/lib
>
> ./cvm \
> -classpath .:${JAR_DIR}/jfluid-server.jar:${JAR_DIR}/jfluid-server-15.jar \
> -agentpath:"${NB_DIR}/lib/deployed/jdk15/linux/libprofilerinterface.so"="\"${NB_DIR}/lib\"",5140 \
> Hello
> ...
> And another error occored.
> ----
> [togawa@trece03 bin]$ ./netbeans
> ...
> Profiler Agent: Established remote connection with the tool
> Profiler initialization failed due to:
> java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory
> at org.netbeans.lib.profiler.server.system.Timers.initialize(Timers.java:84)
>
Hi Togawa

phoneME Advanced does not have java.lang.management.* as part of its
spec. So, this might be a question you have to ask someone from the
NetBeans project.

Does the NetBeans 6.0 Profiler run with Java ME CDC (phoneME Advanced)?

It looks like from the error message above that the NetBeans Profiler
does not run with Java ME CDC. But, there may be a NetBeans
configuration setting that I don't know about that someone from the
NetBeans side could answer for you.

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

mlam
Offline
Joined: 2006-10-13
Points: 0

Hi stogawa,

There isn't any plan to add jstat support yet. Just so you know, there is a CDC toolkit (i.e. WTK for CDC) that is powered by CVM as well. See http://java.sun.com/products/cdctoolkit/download-1_0.html.

Have you tried downloading the latest SVN development trunk of phoneME Advanced? The latest trunk includes support for JVMTI. With that, you should be able to run with the NetBeans profiler and many other JavaSE profiler tools that runs on JVMTI. You can also write your own JVMTI tool if that's what you want to do.

If you still think that you need to modify shared code (or any VM code), can you please provide some details on the nature of the modification? If it is really necessary, we can help you get signed up as a contributor and walk you through the process of becoming an open source contributor to this project. :) Of course, you can still do that even if you don't need to modify the VM code.

Mark

xingri
Offline
Joined: 2007-03-31
Points: 0

Hi Mark,

We are trying to use NetBeans IDE 6.0 for remote profiler with JVMTI supported by phoneME Advanced on Linux/MIPS platform.
The NetBeans's JVMTI agent was built successfully with only one modification: the "Agent_OnUnload()" function was added to the agent sources as phoneME Advanced(for MIPS) requires.
However, the "jfluid-server.jar" requires some classes, which are not present in phoneME Advanced; it requires "java.util.logging" and "java.util.concurrent" packages.

So, my questions are ;
1. Do we need to add some packages to phoneME Advanced? If then, what packages will be added exactly? Can we use these packages ("java.util.logging" and "java.util.concurrent") from of J2SE 1.6 or 1.5?
2. Or do we just we Netbeans mobility package with phoneME Advanced? If so, which version of Netbeans mobility pakage do we need to use?

Kind regards,
Byungseon.

mlam
Offline
Joined: 2006-10-13
Points: 0

Hi Byungseon,

To my knowledge, NetBeans should work with CVM without the addition of additional Java APIs to phoneME Advanced. However, I'm not the expert. I'll see if my colleague (who is the expert on JVMTI) can provide some details here on how to use NetBeans with CVM.

Regards,
Mark