Assignment 7: Design and Implement a CPU Profiler (Part 2)

Part 2: Record the stack trace and calculate the task execution time

[40 points + 20 bonus points] In Part 2, you will modify your kernel module, perftop, to: (a) track the time that both user and kernel tasks spend on a CPU and (b) print the 20 most scheduled tasks on the system using /proc.

Part 2.1. Storing kernel stack trace

[20 points] Modify your kernel module from Part 1 to track tasks instead of PIDs. A task is defined as a unique user or kernel stack trace. The hash table key will now be a hash of a task stack trace, and the value will be the number of times the unique kernel stack trace is scheduled on the CPU. Particularly, referring to background reading stack trace and Jenkins Hash in Part 1 of the project (Assignment 6).

Tasks:

Deliverables:

Part 2.2. Store schedule time

[20 points] Calculate the time spent by each kernel task scheduled on a CPU and store it.

Task:

Deliverables:


Part 2.3: Use rb-tree to get 20 most scheduled tasks [Optional]

[20 points] Modify the kernel module to print the 20 most scheduled tasks.

Note: This is an optional task. Credits are added to your total homework points, provided they do not cause your total to exceed the maximum points for the homework section.

Tasks:

Deliverables: