I'm writing an Android app that delivers statistics on the device it is installed on, and want to know if it is possible to determine the following metric.

Time the CPU has spent servicing a specific process. The device I am testing on has a 4 core processor, and I would like to get time spent regardless of weather the process in question is in the foreground or background. Using top gives you the % of the CPU a process occupies, is there a way to determine time (in seconds or clock cycles)?

Thank you