find out how much time an already running process is spending in user and kernel spac
I am currently struggling with one of my tasks.
I was asked to find a way how to determine how much time an _already running_ process is spending in user and kernel space.
E.G. <some tool> <pid>
[Control] + [c]
<pid> spent 12.1 seconds in user and 1.52 seconds in kernel space.
Does something like this exist? Basically I guess I am looking for something similar to time, except that the process is already running.
a) Is there a tool which fulfills this task?
b) Is there a way to write your own software which does the job? Is it even possible to code something I am looking for?
I recently found strace -c -p <pid>, but well, this is not exactly what I was looking for.
Any reply is highly appreciated.