|
164 | 164 | <title>BCEL</title> |
165 | 165 | <para>[TODO]</para> |
166 | 166 | </section> |
167 | | - |
| 167 | + |
| 168 | + <section id="yourKit"> |
| 169 | + <title>YourKit Java Profiler</title> |
| 170 | + <subtitle>(compiled by Mathias Ricken, mgricken at rice dot edu)</subtitle> |
| 171 | + <para>The <ulink url="http://www.yourkit.com/download/">YourKit Java Profiler</ulink> is a powerful profiler |
| 172 | + for Java programs that has been lincensed to the DrJava open source project free of charge. It may only be |
| 173 | + used for developing and improving DrJava and individual licenses for each individual developer are |
| 174 | + required; they also need to be renewed from time to time. All of this has been generally unproblematic by |
| 175 | + emailing <ulink url="mailto://sales@yourkit.com">sales@yourkit.com</ulink>. Please do not jeopardize our |
| 176 | + very good relationshit with YourKit by using it in ways not approved.</para> |
| 177 | + <para> |
| 178 | + <orderedList> |
| 179 | + <listitem> |
| 180 | + <formalpara> |
| 181 | + <title><literal>Getting YourKit</literal></title> |
| 182 | + <para>You can download YourKit from the URL above, but have also installed YourKit into |
| 183 | + the javaplt account on CSnet. Here are instructions if you want to use it. Please note that this |
| 184 | + is for the Linux environment on CSnet. For Windows and MacOS, or away from CSnet, these steps |
| 185 | + don't apply.</para> |
| 186 | + </formalpara> |
| 187 | + </listitem> |
| 188 | + <listitem> |
| 189 | + <formalpara> |
| 190 | + <title><literal>Location of YourKit on CSnet</literal></title> |
| 191 | + <para>YourKit is located in the directory <literal>/home/javaplt/packages/yjp-6.0.11</literal> . You |
| 192 | + should add the <literal>bin</literal> path to your <literal>PATH</literal> environment |
| 193 | + variable. Make the following directory accessible from everywhere: |
| 194 | + <literal>/home/javaplt/packages/yjp-6.0.11/bin</literal> . |
| 195 | + That gives you access to the two most important scripts, <literal>yjp.sh</literal> and |
| 196 | + <literal>yjpjava</literal> .</para> |
| 197 | + </formalpara> |
| 198 | + </listitem> |
| 199 | + <listitem> |
| 200 | + <formalpara> |
| 201 | + <title><literal>Adding the Library</literal></title> |
| 202 | + <para>Before you can use Yourkit, you have to set the following environment variable: |
| 203 | + <literal>setenv LD_LIBRARY_PATH /home/javaplt/packages/yjp-6.0.11/bin/linux-x86-32</literal> . |
| 204 | + If you already have an <literal>LD_LIBRARY_PATH</literal> variable, then you |
| 205 | + should extend it by adding a colon and the path: |
| 206 | + <literal>setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:/home/javaplt/packages/yjp-6.0.11/bin/linux-x86-32</literal> .</para> |
| 207 | + </formalpara> |
| 208 | + </listitem> |
| 209 | + <listitem> |
| 210 | + <formalpara> |
| 211 | + <title><literal>Starting YourKit</literal</title> |
| 212 | + <para>To start YourKit, run the following script from the command line: |
| 213 | + <literal>yjp.sh & </literal>. |
| 214 | + The & at the end will make YourKit run in the background, i.e. you can |
| 215 | + still use the same command line window you've been using. |
| 216 | + The first time you start YourKit, it should ask you for your license |
| 217 | + information. If you are a member of the core DrJava development team, you |
| 218 | + should have by now received your personalized license key.</para> |
| 219 | + </formalpara> |
| 220 | + </listitem> |
| 221 | + <listitem> |
| 222 | + <formalpara> |
| 223 | + <title><literal>Starting the Application to Profile</literal></title> |
| 224 | + <para>You need to pass a special command line argument to your java |
| 225 | + executable when you're running a program that you want to profile: |
| 226 | + <literal>-agentlib:yjpagent</literal> . |
| 227 | + To make that easier to remember, I have written a script that passes |
| 228 | + that arguments, and all the argument passed to the script, to java. |
| 229 | + It's located in the same directory as Yourkit: |
| 230 | + <literal>/home/javaplt/packages/yjp-6.0.11/bin/yjpjava </literal> . |
| 231 | + If you added YourKit to your path in step 2, it should be directly |
| 232 | + accessible. |
| 233 | + If you want to use it to run a program that you would normally start |
| 234 | + with: |
| 235 | + <literal>java MyClass </literal> . |
| 236 | + now just use: |
| 237 | + <literal>yjpjava MyClass </literal> . |
| 238 | + Here is a more complicated example to start DrJava. Instead of |
| 239 | + writing: |
| 240 | + <literal>java -cp drjava-15.jar edu.rice.cs.drjava.DrJava </literal> . |
| 241 | + now write instead the following, which avoids the restart, which may cause |
| 242 | + trouble: |
| 243 | + <literal>yjpjava -cp drjava-15.jar edu.rice.cs.drjava.DrJavaRoot </literal> . |
| 244 | + Regardless, the application you just started should launch now.</para> |
| 245 | + </formalpara> |
| 246 | + </listitem> |
| 247 | + <listitem> |
| 248 | + <formalpara> |
| 249 | + <title><literal>Starting to Profile</literal></title> |
| 250 | + <para>When you actually want to record usage times and counts, press the |
| 251 | + "Start CPU Profiling" button. That will open another pane. There are |
| 252 | + two selections, "Sampling" and "Tracing", and as far as I know, |
| 253 | + "Sampling" records times only and doesn't give you invocation counts |
| 254 | + and call stacks, but is faster. "Tracing" is a lot slower but gives |
| 255 | + you more information.</para> |
| 256 | + </formalpara> |
| 257 | + </listitem> |
| 258 | + <listitem> |
| 259 | + <formalpara> |
| 260 | + <title><literal>Viewing Data</literal></title> |
| 261 | + <para>When you want to view the data, i.e. when you're done performing |
| 262 | + the action you want to profile, press the "Capture Snapshot" button. |
| 263 | + That will bring up a dialog that tells you the file name as which the |
| 264 | + snapshot has been saved, and it asks you whether you want to open the |
| 265 | + snapshot. You probably want to press "Open" if you want to look at the |
| 266 | + data right now.</para> |
| 267 | + </formalpara> |
| 268 | + </listitem> |
| 269 | + <listitem> |
| 270 | + <formalpara> |
| 271 | + <title><literal>Taking a Snapshot Stops Profiling</literal></title> |
| 272 | + <para>Note that taking a snapshot stops profiling, so if you want to |
| 273 | + continue to profile, you need to press the "Start CPU Profiling" |
| 274 | + button again.</para> |
| 275 | + </formalpara> |
| 276 | + </listitem> |
| 277 | + <listitem> |
| 278 | + <formalpara> |
| 279 | + <title><literal>Sorting Methods</literal></title> |
| 280 | + <para>On the page that displays CPU snapshot informations, there are lots |
| 281 | + of ways to gather information. I haven't explored everything. I found |
| 282 | + selecting "Method List" on the left the most useful. That will give |
| 283 | + you a lsit of all methods that were called, and you can sort by name, |
| 284 | + time, own time, and invocation count (if you used tracing). Time |
| 285 | + includes time spent in calls to other methods, i.e. the time from |
| 286 | + method entry to method exit. Own time is only the time spent in the |
| 287 | + actual method, i.e. the time from method entry to method exit |
| 288 | + EXCLUDING the time spent in other methods that were called.</para> |
| 289 | + </formalpara> |
| 290 | + </listitem> |
| 291 | + <listitem> |
| 292 | + <formalpara> |
| 293 | + <title><literal>Finding the Hotspot</literal></title> |
| 294 | + <para>Usually I found a very sharp break between the times, i.e. going from |
| 295 | + 40 seconds in some methods (that were probably in a call chain) to 5 |
| 296 | + seconds. My intuition tells me that the last method to have a lot of |
| 297 | + time spent is one of the "hot spots". You should also look at the |
| 298 | + invocation count: The program may spend a lot of time in a method, but |
| 299 | + if it's called very often, that may not mean very much.</para> |
| 300 | + </formalpara> |
| 301 | + </listitem> |
| 302 | + </orderedList> |
| 303 | + </para> |
| 304 | + </section> |
| 305 | + |
168 | 306 | <section id="otherTools"> |
169 | 307 | <title>Other Useful Development Tools</title> |
170 | 308 | <para>[TODO]</para> |
|
0 commit comments