COMP 303 (Fall 2005) Assignment 2

Please submit an electronic version of your assignment (in PDF or self-contained HTML) using WebCT. The PDF format is preferred. If you choose HTML, please make sure that all the links are internal and work. Do not submit Word documents! Include your name and student ID. This assignment will be marked out of 20. It is your responsibility to hand this assignment in on time. Assignments not submitted on time will not be marked and will receive a grade of 0. By submitting your assignment you acknowledge your understanding of McGill University's academic integrity policy.

Due Date: Tuesday 8 November 11:59am.

Goals

To familiarize yourself with profiling technology and to start experimenting with AspectJ.

Required Problems

Your mission, if you choose to accept it (you should), will be to examine what happens when you move a figure in JHotDraw. First you will do this with the hprof profiler bundled with Java, and then using a profiler that you write using AspectJ.
  1. Download and import JHotDraw5.3 in an Eclipse project.
  2. Make sure you can compile and run JHotDraw. Create a figure and move it, just for kicks.
  3. Download and install AspectJ using the simple instructions you will find at the other end of the link.
  4. Run JHotDraw with the hprof profiler and the option -agentlib:hprof=cpu=times
  5. Study the output and answer the following questions:
    1. What are the 5 methods of JHotDraw that use the most CPU time?
    2. What are the 5 methods of JHotDraw that are called the most?
    3. Is there any correlation between the two?
    4. Can you determine anything about the behavior of JHotDraw associated with figure movement from the hprof output? How? Be specific and use examples.
    5. How does the trace information help you understand the behavior of the program associated with the 10 methods described above? Be specific and refer to the trace numbers.
  6. Using AspectJ, make your JHotDraw project an AspectJ project and write an aspect that will help you profile specifically the behavior of the program related to the movement of figures.
  7. Write a short paragraph contrasting your experience with hprof and AspectJ, respectively. Your discussion should include the ease of use of the profiling technology and the usefulness of the results.

Optional Problem

Experiment with sample and heap profiling in hprof. Provide the JVM arguments you used, your output file, and a short paragraph synthesizing your experience, and in particular the contrast between time and sample profiling. Be specific and refer to specific lines in the output. Maximum two bonus points based on the quality of the work.

Stuff to Hand In

  1. The output file obtained from step 4.
  2. Answers to the questions in step 5.
  3. The code of your aspect for step 6.
  4. The answer to the question in step 7.
  5. (Optional) The results of the optional problem.