CPU Usage



I have found this post very intresting.I have a task manager which calculates battery and memory stats i need to add cpu usage into it .How do i calculate cpu usage based on a process
CHAK
.