As an alternative, you could create a server1.bat file to use with startserver, such as:
/Websphere/AppServer/profiles/default/bin/startserver server1 -script server1.batThus, you can modify this file to include the appropriate JVMTI or JVMPI commands you want to use whenever you start the server.
The main100 method calls two methods, mainA30 and mainB70, with a cumulative execution time of 30 and 70 percent, respectively. The mainA30 method calls mainAA10 and mainAB20, while mainB70 calls mainBA30 and mainBB40. The number at the end of each method name indicates the percentage of the execution time it uses by looping 1000, 2000, 3000, or 4000 times, respectively.Usage: treetest iterations [idle] [verbose] [itrace|rtdcmds=xxxx] This is the call tree with percentages: main100 --> mainA30 --> mainAA10 --> mainAB20 --> mainB70 --> mainBA30 --> mainBB40
The examples at the end of this section will demonstrate how you can you can verify that Performance Inspector is working properly by examining the relative amount of time or events associated with each of these mainXXnn methods.
If PTT is supported on your platform and JPerf.jar is in your class path, the simplest test of Performance Inspector is:
java -agentlib:jprof=callflow,nopidx treetest 100000 verbose rtdcmds=start,endThis executes the main100 method 100000 times to guarantee that all of the mainXXnn methods have been compiled, then it executes it one more time between start and end RTDriver commands. The log-rt.1 output file contains the information collected between those commands. The information we want can be extracted using:
grep treetest.main log-rt.1On Windows, which does not provide a grep command, use find instead:
find treetest.main log-rt.1
The fourth column of data will be the number of instructions executed by each method, the ptt_insts metric. If everything is working properly, the percentage of total instructions associated with each of the mainXXnn methods should be close to nn percent.
The next column in log-rt.1 represents the number of machine cycles associated with each method, the ptt_cycles metric. Because ptt_cycles is not a stable metric like ptt_insts, the percentages will not be as accurate.
Note that you may not see all of the methods in log-rt.1. This is because the Java compiler may convert them to inline methods, which do not usually generate the method entry and exit events used by JPROF to perform the profiling. To see them, you have to disable inlining by specifying the appropriate option for your version of Java.
For JVMTI only, you can also test callstack sampling of idle threads with the following test:
java -agentlib:jprof=scs=idle,start,nopidx treetest 10 idle verboseThis test does not require JPerf.jar to be in your class path because the rtdcmds=xxxx parameter was not specified.
You may not be able to simply use grep to view the number of samples associated with each idleXXnn method. Although the samples are associated with the idleXXnn methods on Windows, on AIX the samples are associated with the java/lang/Thread.sleep method which each idleXXnn method calls. Thus, you may need to view log-rt.1 with an editor to verify the results. If everything is working properly, the percentage of total samples associated with each of the idleXXnn methods should be close to nn percent.