COMP 303 (Fall 2006) Assignment 1

Please submit an electronic version of your assignment as a single PDF file using WebCT. 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. Assignments should be done individually.

Due Date: 21 November 11:59pm.


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 save a file buffer in jEdit. 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 jEdit 4.1-pre6 in an Eclipse project.
  2. Make sure you can compile and run jEdit.
  3. Download and install AspectJ using the simple instructions you will find at the other end of the link.
  4. Run jEdit with the hprof profiler and the option -agentlib:hprof=cpu=times (experiment with other options)
  5. Study the output and answer the following questions:
    1. What are the 5 methods of jEdit that use the most CPU time?
    2. What are the 5 methods of jEdit that are called the most?
    3. Is there any correlation between the two?
    4. Can you determine anything about the behavior of jEdit associated with file saving 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 jEdit project an AspectJ project and write an aspect that will help you profile specifically the behavior of the program related to the saving of files.
  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.