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.
- Download and import JHotDraw5.3
in an Eclipse project.
- Make sure you can compile and run JHotDraw. Create a figure and
move it, just for kicks.
- Download and install AspectJ using the simple
instructions you will find at the other end of the link.
- Run JHotDraw with the hprof profiler and the option
-agentlib:hprof=cpu=times
- Study the output and answer the following questions:
- What are the 5 methods of JHotDraw that use the most CPU time?
- What are the 5 methods of JHotDraw that are called the
most?
- Is there any correlation between the two?
- Can you determine anything about the behavior of JHotDraw
associated with figure movement from the hprof output? How? Be
specific and use examples.
- 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.
- 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.
- 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
- The output file obtained from step 4.
- Answers to the questions in step 5.
- The code of your aspect for step 6.
- The answer to the question in step 7.
- (Optional) The results of the optional problem.