CS644 HW2 -- Eric Christiansen mailto:tericc@mac.com 508-496-1065 1. Summary of the implementation of the pc sampler PC Sampler provides three routines in its API: PCsamp_on(), PCsamp_off(), and PCsamp_histogram(). PCsamp_on() sets up the interrupt gate for TIMER0 to call the interrupt handler irq0inthandc(), enables the interrupt controller for TIMER0, and finally sets up the timer circuit (PIT) to regularly interrupt at a specified microsecond interval. The startup.c routine modified for this test calls PCsamp_on with an interval of 500 microsecs. (After main() is called in the startup.c routine it calls PCsamp_off and PCsamp_histogram.) irq0inthandc() called by the timer interrupt reads the PC off the stack by way of StackLayout structure it overlays on top of the register save area used by the interrupt mechanism. It stores the PC in the next location of a 10,000 item ring buffer which is later read by the histogram routine. PCsamp_off() simply disables the interrupt controller. PCsamp_histogram() sorts the list of PCs captured and counts how many are in each consecutive group. It then prints out the results. 2. Results on pctest, interpreted by symbolic values for at least the top three locations/regions, incl. library locations [Note from eoneil: the text-graphics here are "extra"] From the following output: Saw 12181 interrupts. PC | # of ints =========|=========== 5a61b | 304 :oooooo 5a61d | 298 :oooooo 100427 | 1416 :oooooooooooooooooooooooooooo 10042e | 1793 :oooooooooooooooooooooooooooooooooooo 100434 | 1415 :oooooooooooooooooooooooooooo 100437 | 1793 :oooooooooooooooooooooooooooooooooooo 100483 | 723 :oooooooooooooo 10048a | 626 :ooooooooooooo 100490 | 796 :oooooooooooooooo 100493 | 707 :oooooooooooooo 1005ee | 3 : 1005f5 | 3 : 1005fc | 119 :oo 1005ff | 4 : most of the interrupts occured in the main() routine. The addresses 100427, 10042e, 100434, and 100437 are from the first "for" loop of main() (looping for 300*MILLION at line 11). The addresses 100483, 10048a, 100490, and 100493 are from the last loop of main() at line 18. More interrupts were caught in the first loop. Some of them were probably over written by the ring buffer. 3. Discussion of accuracy and relevance of results With the sample rate set at 0.5 ms and with a 400 MHz processor approximately 20,000 instructions executed between samples. But with the test program set up as it was with three "slow" loops the general characteristic of the test program could be captured.