Obtain consecutive runtime of a process within a kernel module
I'm currently working on a system hang detector for academic purpose.
Therefore I want to monitor the consecutive runtime of every running process.
With consecutive I mean the time that has passed since a process was scheduled or in other words, the time a process is running without interuption.
I'm iteration over the task_structure list but I'm not sure how to obtain that value.
As I understand utime and stime are the accumulated runtimes of the process. Is this right?
My current approach would be to get the time where the task has been scheduled and substract it from the current time.
First, is it possible to obtain the time when the task is scheduled and how?
Second, I'm afraid that this solution is inaccurate because of the current time. Do you have any Ideas what would be a good way to solve this problem?
I hope you can help me. Thanks for every helping attempts in advance.