How to connect a JProfiler session with the designed ID? - jprofiler

I 've started a Java application with the args :
"-agentpath:C:\Program Files\jprofiler7\bin\windows-x64\jprofilerti.dll=port=8849,id=134,nowait"
then the console showed:
JProfiler> Protocol version 37
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 64-bit library
JProfiler> Don't wait for frontend to connect.
JProfiler> Using config file C:\Users\user\.jprofiler7\config.xml (id: 134)
JProfiler> Listening on port: 8849.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
JProfiler> Hotspot compiler enabled
Then I could connect by JProfiler GUI now.
But I need connect that via another Java application with JProfiler API.
How could I connect that ? By any VM argument ?
I just know maybe I have to create a connection first , but I don't know how to choose the session ID.
Connection connection = ConnectionFactory.createRemoteConnection("localhost", 8849, 30);
If I ran the agent application then connect via JProfiler GUi firstly ,I could get the cpu information by my Java application , including then running my JProfiler API application .
Profiling data :
Hot spots:
Top 5 hot spots:
Hot spot 1: ProfilerTest.main(java.lang.String[ ]): 34 ms (100 %)
Backtraces:
ProfilerTest.main(java.lang.String[ ]): 34722 (0)
***: 34722 (0)
Cpu tree:
***: 34722 (0)
ProfilerTest.main(java.lang.String[ ]): 34722 (0)
java.util.Scanner.next(): 34722 (0)
But I'll get nothing if I ran the agent application then connect via my JProfiler API application firstly.
Profiling data :
Hot spots:
Top 5 hot spots:
Cpu tree:
***: 0 (0)

After ",nowait", add ",config=[path to config file],id=nnn" where "[path to config file]" is %USERPROFILE%.jprofiler8\config.xml and "nnn" is the session ID that is visible in the top-right corner of the application settings tab in the session settings dialog.

Related

error while running gem5 full system mode on arm

i installed gem5 simulator on ubuntu 14.04. then i used the youtube guide (https://www.youtube.com/watch?v=gd_DtxQD5kc) to run gem5 in full system mode in ARM architecture. first i downloaded arm-system-2011-08.tar.bz2 as mentioned in the video then i run below command:
build/ARM/gem5.opt configs/example/fs.py --disk-image=/home/morteza/full_system_images/disks/arm-ubuntu-natty-headless.img --kernel=/home/morteza/full_system_images/binaries/vmlinux.arm.smp.fb.2.6.38.8
but i encountered this output. can abybody please help me?
p.s: i added --kernel option and rename bootloader in /fulls_system_image/binaries from boot.arm to boot_emm.arm because of some errors about not finding bootloader and kernel. this is my final output which i brought hereunder. i' ll appreciate if anybody tell what is the problem.
OUTPUT:
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Jan 3 2020 05:49:20
gem5 started Jan 3 2020 17:16:17
gem5 executing on morteza-pc, pid 2499
command line: build/ARM/gem5.opt configs/example/fs.py --disk-image=/home/morteza/full_system_images/disks/arm-ubuntu-natty-headless.img --kernel=/home/morteza/full_system_images/binaries/vmlinux.arm.smp.fb.2.6.38.8
warn: Can only correctly generate a dtb for VExpress_GEM5_V1 platforms, unless custom hardware models have been equipped with generation functionality.
Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
info: kernel located at: /home/morteza/full_system_images/binaries/vmlinux.arm.smp.fb.2.6.38.8
warn: Bootloader entry point 0x80000000 overriding reset address 0
system.vncserver: Listening for connections on port 5900
system.terminal: Listening for connections on port 3456
0: system.remote_gdb: listening for remote gdb on port 7000
info: Using bootloader at address 0x80000000
info: Using kernel entry physical address at 0x80008000
warn: DTB file specified, but no device tree support in kernel
**** REAL SIMULATION ****
warn: Existing EnergyCtrl, but no enabled DVFSHandler found.
info: Entering event queue # 0. Starting simulation...
warn: Device system.membus.badaddr_responder accessed by read to address 0x10009018 size=4
gem5.opt: build/ARM/cpu/simple/atomic.cc:418: virtual Fault AtomicSimpleCPU::readMem(Addr, uint8_t*, unsigned int, Request::Flags, const std::vector<bool>&): Assertion `!pkt.isError()' failed.
Program aborted at tick 30500
--- BEGIN LIBC BACKTRACE ---
build/ARM/gem5.opt(_Z15print_backtracev+0x15)[0x1d505e5]
build/ARM/gem5.opt(_Z12abortHandleri+0x36)[0x1d5a796]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10330)[0x7f41e3962330]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37)[0x7f41e1eacc37]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7f41e1eb0028]
/lib/x86_64-linux-gnu/libc.so.6(+0x2fbf6)[0x7f41e1ea5bf6]
/lib/x86_64-linux-gnu/libc.so.6(+0x2fca2)[0x7f41e1ea5ca2]
build/ARM/gem5.opt(_ZN15AtomicSimpleCPU7readMemEmPhj5FlagsImERKSt6vectorIbSaIbEE+0x538)[0x1e4eca8]
build/ARM/gem5.opt(_ZN17SimpleExecContext7readMemEmPhj5FlagsImERKSt6vectorIbSaIbEE+0x21)[0x1e5c5b1]
build/ARM/gem5.opt(_Z13readMemAtomicI11ExecContextjESt10shared_ptrI9FaultBaseEPT_PN5Trace10InstRecordEmRT0_5FlagsImE+0x64)[0x1972e14]
build/ARM/gem5.opt(_ZNK10ArmISAInst27LOAD_IMM_AY_PN_SN_UN_WN_SZ47executeEP11ExecContextPN5Trace10InstRecordE+0x12d)[0x14f95cd]
build/ARM/gem5.opt(_ZN15AtomicSimpleCPU4tickEv+0x428)[0x1e4da58]
build/ARM/gem5.opt(_ZN10EventQueue10serviceOneEv+0xa1)[0x1d55f51]
build/ARM/gem5.opt(_Z9doSimLoopP10EventQueue+0x38)[0x1d65fc8]
build/ARM/gem5.opt(_Z8simulatem+0xaae)[0x1d66dfe]
build/ARM/gem5.opt[0x1dbbd3d]
build/ARM/gem5.opt[0xe08e85]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x45f7)[0x7f41e3579be7]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d)[0x7f41e357b63d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x48d8)[0x7f41e3579ec8]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d)[0x7f41e357b63d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x48d8)[0x7f41e3579ec8]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d)[0x7f41e357b63d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x48d8)[0x7f41e3579ec8]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d)[0x7f41e357b63d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCode+0x32)[0x7f41e357b772]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x563e)[0x7f41e357ac2e]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d)[0x7f41e357b63d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x48d8)[0x7f41e3579ec8]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x80d)[0x7f41e357b63d]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCode+0x32)[0x7f41e357b772]
/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyRun_StringFlags+0x79)[0x7f41e35755a9]
--- END LIBC BACKTRACE ---
Aborted (core dumped)

apache rockerMQ broker doesn't start

i try to star rockerMQ broker,but i got the error message:
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (mmap) failed to map 8589934592 bytes for committing reserved memory.
An error report file with more information is saved as:
/usr/local/soft/rocketMQ/incubator-rocketmq/distribution/target/apache-rocketmq/hs_err_pid6034.log
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000005c0000000, 8589934592, 0) failed; error='Cannot allocate memory' (errno=12)
and i got something from the error log file about message of memory:
Memory: 4k page, physical 4089840k(551832k free), swap 2621432k(2621432k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (25.144-b01) for linux-amd64 JRE (1.8.0_144-b01), built on Jul 21 2017 21:57:33 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)
how can i let the rockerMQ broker working for me
You can reduce the JVM heap size.
Open the distribution/bin/runbroker.sh file of your project and change the following line
JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g"
as
JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g"
now broker will only generate a 4G heap .I hope it will solve your problem.Now you can try to build and run.
Try modifying the start shell scripts to make a smaller JVM heap size in your dev/test env

Why does JProfiler log "ERROR: could not retransform class"?

I'm profiling (using instrumentation) a Java web app on Tomcat. When I attach a JProfiler session it first goes through a period of Retransforming Classes. During this period I am seeing numerous messages in the Tomcat log like these:
JProfiler> ERROR: could not retransform class Lcom/zaxxer/hikari/pool/HikariPool$HouseKeeper$$Lambda$36/1482601803; (62).
JProfiler> ERROR: could not retransform class Lcom/zaxxer/hikari/pool/HikariPool$HouseKeeper$$Lambda$35/545889432; (62).
JProfiler> ERROR: could not retransform class Lcom/sun/jersey/atom/rome/impl/provider/entity/AtomEntryProvider; (113).
JProfiler> ERROR: could not retransform class Lcom/sun/jersey/atom/rome/impl/provider/entity/AtomFeedProvider; (113).
What is the cause and implication of these errors?
I'm using:
Tomcat 7.0.55
Java 8
JProfiler 8.0.7
The used version of JProfiler is too old and does not fully support Java 8. Updating to 8.1.4 will fix this issue.

couldn't run the TestProgram of JProfiler offline sample

all
I met an error when I running the sample of JProfiler7 offline on my windows PC , the code is from "jprofiler7\api\samples\offline\src\TestProgram.java" ,and got the message as thus:
JProfiler> A different instance of the native library has been
JProfiler> loaded. Please check the appropriate environment
JProfiler> variable. (PATH, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH)
JProfiler> Exiting.
I'm sure there is no any JProfiler process running, and I've imported the referenced libraries by "agent.jar" and set my PATH of JProfiler:
C:\Users\user>echo %PATH%
C:\Program Files\Java\jdk1.6.0_33\bin;C:\Program Files\java\jdk1.6.0_33\jre\bin;C:\Program Files\jprofiler7\bin\windows-x64;C:\Program Files\jprofiler7\bin;
I wanna use the JProfiler API for remoting doing something ,could anybody know how to fix that?
JProfiler:7.2.3
Windows: Win7 Enterprise SP1
JDK:1.6.0_33
And if I use the arguments as following:
-agentlib:jprofilerti=offline,id=4321,config=C:\Program Files\jprofiler7\config\config.xml "-Xbootclasspath/a:C:\Program Files\jprofiler7\bin\agent.jar"
there will be another message:
Exception in thread "main" java.lang.NoClassDefFoundError: com/jprofiler/agent/ControllerImpl
at com.jprofiler.api.agent.Controller.startCPURecording(Controller.java:87)
at TestProgram.main(TestProgram.java:31)
Caused by: java.lang.ClassNotFoundException: com.jprofiler.agent.ControllerImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 2 more
____________edited 2014.05.08 17:04 CST__________________________________
I tried to run the demo of platform (jprofiler7\api\samples\platform\src-profiler\TestProfiler.java) , got the same message both without args and with args(-agentpath:C:\Program Files\jprofiler7\bin\windows\jprofilerti.dll=offline,id=112,config="C:\Program Files\jprofiler7\config\config.xml -Xbootclasspath/a:C:\Program Files\jprofiler7\bin\agent.jar):
JProfiler> A different instance of the native library has been
JProfiler> loaded. Please check the appropriate environment
JProfiler> variable. (PATH, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH)
JProfiler> Exiting.
———————————————————ending—————————————————————————————————————————————
solved that.
In my way, firstly, I start a Java application with VM args
"-agentpath:C:\Program Files\jprofiler7\bin\windows-x64\jprofilerti.dll=port=8849"
Then I run a JProfiler platfrom program with args :
-agentpath:C:\Program Files\jprofiler7\bin\windows\jprofilerti.dll=offline,id=112,config="C:\Program Files\jprofiler7\config\config.xml -Xbootclasspath/a:C:\Program Files\jprofiler7\bin\agent.jar
then I could catch some information , with null value.
Profiling data :
Memory data:
Exception in thread "main" java.lang.NullPointerException
at com.jprofiler.core.comm.d.a.getTotalHeapUsage(ejt:100)
at TestProfiler.dumpMemoryData(TestProfiler.java:82)
at TestProfiler.dumpProfilingData(TestProfiler.java:55)
at TestProfiler.main(TestProfiler.java:47)
In a word , it could run...so ending the question.
Replace the -agentlib VM parameter with
-agentpath:C:\Program Files\jprofiler7\bin\windows\jprofilerti.dll=offline,...
and remove the -Xbootclasspath VM parameter

Failed to start Glassfish after increasing heap size

I want to increase the heap size of my Glassfish. For that, I know that I can go up to 4GB:
java -Xmx4000M -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
I tried to set in domain.xml file the -Xmx to 2GB:
<jvm-options>-Xmx2000m</jvm-options>
But I am getting the following error:
asadmin> start-domain
Waiting for ... to start .Error starting domain ...
The server exited prematurely with exit code 1.
Before it died, it produced the following output:
Error occurred during initialization of VM
The size of the object heap + VM data exceeds the maximum representable size
launchctl bsexec failed: Inappropriate ioctl for device
Launching the command with -v option gives this:
12 oct. 2011 11:46:34 com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
-XX:+UnlockDiagnosticVMOptions
-XX:MaxPermSize=512m
-XX:NewRatio=2
-XX:+CMSClassUnloadingEnabled
-Xmx2000m
-Xms1000m
...
12 oct. 2011 11:46:35 com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: Successfully launched in 45 msec.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
Command start-domain failed.
I found the problem. For some reasons which I do not understand, the "-d32" argument was passed in the command, asking to start in 32 bits mode. When adding
<jvm-options>-d64</jvm-options>
to the domain.xml file, glassfish starts. Please note that this option is not present by default in the file.
you must be using a different Java install when doing the "-version" and from within GlassFish. I can reproduce the same error with the default "java" in Mac OS' path but not when using an absolute path :
% /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Xmx2300m -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)
% java -Xmx2300m -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
Could it be that you don't have enough disk space on your system? Reserving 4GB of RAM may require MAC OS to expand swap space, and you may not have the disk space to do this. Unfortunately, this has burned me before :-/