LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 11-07-2013, 11:14 AM   #1
Candy_Rulez
LQ Newbie
 
Registered: Nov 2013
Posts: 2

Rep: Reputation: Disabled
Question Obtain consecutive runtime of a process within a kernel module


Hi guys,

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.

Best Regards
Manuel
 
Old 11-14-2013, 11:55 PM   #2
nini09
Member
 
Registered: Apr 2009
Posts: 916

Rep: Reputation: 67
You can use RTC time to increase time resolution.
 
Old 11-15-2013, 07:43 AM   #3
Candy_Rulez
LQ Newbie
 
Registered: Nov 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Mh, but how would you obtain the time where a task has been scheduled?

There is a field "exec_start" in every tasks scheduling entity, but it is updated several times while the task is running so i really can't use it.

Another pssible solution would of course be to use KProbes to place breakpoint in the scheduling and descheduling methode to signal activity to my module.
But I don't want that overhead. I still hope there is a way to obtain that value at the time it is needed.

Best Regards
 
Old 11-15-2013, 02:53 PM   #4
nini09
Member
 
Registered: Apr 2009
Posts: 916

Rep: Reputation: 67
The RTC time is hardware timer. You can obtain it anytime you want.
KProbe is good point. If you want less overhead, you have to dig into code.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange process found (Bluetooth kernel module, s2u) robeich Linux - Newbie 18 04-22-2011 04:12 PM
how to send events from kernel module to user space process yugandhar Linux - Kernel 2 02-21-2011 10:39 AM
How to obtain runtime stats of a POSIX thread ? vasanth2001 Programming 2 08-23-2008 04:51 AM
How to create new process from within loadable kernel module? mtb001 Programming 5 08-31-2007 11:09 PM
C funtion to obtain a process ID Linh Programming 5 06-18-2003 02:37 PM


All times are GMT -5. The time now is 09:30 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration