CPU usage of process

Hi all,

Platform :2K/XP

I have a requirement to monitor the CPU usage of each process in the
system. I will have to raise an alarm when it goes beyond certain
limits. How can I programatically findout the CPU usage of a process (I
need the value similar to the one shown in Task manager)? Can we rely
on WMI, is the Win32_PerfRawData_PerfProc_Process.PercentProcessorTime
same as the one shown in task manager.

TIA
Best Regards
Prasanth