LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 11-19-2007, 04:14 AM   #1
kornelix
Member
 
Registered: Oct 2005
Location: Germany
Distribution: Ubuntu
Posts: 58

Rep: Reputation: 24
how to enable process IO statistics


kernel 2.6.20 announced new real-time process IO statistics. Here is a fragment from the announcement:
Quote:
So this IO accounting implements per-process statistics of "storage I/O" (i.e.: I/O that _really_ does I/O on the storage device - Linux already had I/O storage statistics but it's not per-task). The data is reported through taskstats and procfs (/proc/$PID/io) (commit 1, 2, 3, 4, 5, 6, 7, 8, 10, 11)
I see no such thing in the several recent Linux distros I have tried out, with kernels up to 2.6.22. There are no /proc/<pid>/io directories (I did see one of these, but the disk numbers remained static).

There must be something special I must do to enable this feature. Where can I find information?

thanks
 
Old 11-19-2007, 05:22 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I am starting to look at this on 2.6.24-rc3
There is some reasonable doco in ../Documentation/accounting (from memory - I can't dial into my testbox from outside the office).

Looks like you're going to have to knock up some code to register an interest in the stats - then do your own maths. There is a sample shipped in the above location for delay stats.
 
Old 11-19-2007, 02:23 PM   #3
kornelix
Member
 
Registered: Oct 2005
Location: Germany
Distribution: Ubuntu
Posts: 58

Original Poster
Rep: Reputation: 24
I hope to get live stats the easy way, in /proc/pid/io, as advertised.

I saw some docs (taskstats.txt in kernel docs place, I think) about how to set up a socket to get live process stats with kernel queries and responses, but this was very skimpy and aimed at kernel pros. I was not able to understand enough of it - too many assumptions about prior knowledge.
 
Old 11-20-2007, 01:19 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I think the data is there, you just need to look in the right place. You have to make sure that if a command shells out, you look under that (new) PID, not the PID of the shell you used to launch it.
Also, once the task terminates the data is gone - at least as far as /proc/$PID/io is concerned anyway. If you have registered a listener, you can nominate to be notified when the watched task terminates - I haven't looked at that yet.

From the kernel config. you need to have CONFIG_TASKSTATS enabled.

Edit: I have just noticed we have had a similar thread previously.

Last edited by syg00; 11-20-2007 at 03:23 AM.
 
Old 11-20-2007, 03:33 AM   #5
kornelix
Member
 
Registered: Oct 2005
Location: Germany
Distribution: Ubuntu
Posts: 58

Original Poster
Rep: Reputation: 24
Thanks.

None of the distros I have tried have any process IO data, for any PID.

I think CONFIG_TASKSTATS must be what I need. Is this a kernel compile time option?
Must I compile my own kernel to have this feature?
 
Old 11-20-2007, 03:41 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Yes - depending on the distro recompiling the kernel can be a serious pain. I just looked at this Ubuntu Grunty (7.10) config, and it is disabled.
Without this option enabled, you won't even see the /proc/$PID/io, so there is nothing you can do in that case.
 
Old 12-23-2007, 09:52 AM   #7
markseger
Member
 
Registered: Jul 2003
Posts: 244

Rep: Reputation: 26
Check out collectl

As of today's release, if you've enabled process I/O stats in your kernel, collectl will display them. Check out http://collectl.sourceforge.net/ProcessIOStats.html and if you like what you see, download a copy.
btw - collectl does a LOT more than just show process stats and you can read more about it on the home page.
-mark
 
Old 12-23-2007, 04:36 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Looks mighty handy Mark - I'll have to have a play ...
Expect to hear from me ...
 
Old 02-29-2008, 09:33 AM   #9
markseger
Member
 
Registered: Jul 2003
Posts: 244

Rep: Reputation: 26
As an update I've just released a new version - see http://collectl.sourceforge.net/, which allows you to monitor interrupts by cpu, something I don't believe is available with any other tools! here's an example of one of the output formats, there are others that show even more details at http://collectl.sourceforge.net/Interrupts.html

#Time Cpu0 Cpu1 Cpu2 Cpu3 Cpu4 Cpu5 Cpu6 Cpu7
12:49:55 4828 16K 1000 16K 18 16K 16K 0
12:49:56 4804 16K 1000 16K 0 16K 16K 0
12:49:57 4811 16K 1000 16K 18 16K 16K 0
12:49:58 4789 16K 1000 16K 0 17K 16K 44

-mark
 
Old 03-01-2008, 01:23 AM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
G'day Mark, I did look at your efforts. Nice.
For my particular needs, blktrace probably fits the bill better.

More tools is always better though - each situation (usually) needs something different.
 
Old 06-12-2008, 10:06 AM   #11
markseger
Member
 
Registered: Jul 2003
Posts: 244

Rep: Reputation: 26
I just wanted to let people know that I just released a new version of collectl at http://collectl.sourceforge.net/. Entering the command "collectl --top io" which show a dynamic list of processes sorted by I/O usage. If you add the switch "--procopts t" it will include threads. You can/should read more about monitoring processes at http://collectl.sourceforge.net/Process.html and also remember that collectl can do a lot more than just look at processes.

enjoy
-mark
 
Old 06-12-2008, 10:18 AM   #12
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Thanks Mark, I did pass by a few days back.
Will download it and have a look.

Cheers ...
 
Old 09-18-2008, 01:50 PM   #13
chrisbertin
LQ Newbie
 
Registered: Sep 2008
Location: Auburn, CA, USA
Distribution: Mostly RH and SuSE, various versions
Posts: 1

Rep: Reputation: 0
These process IO counters are not available in any official RedHat or SuSE kernels, AFAIK. Does anyone know what the plans are to make them available? Or if they are already available, which versions?
 
  


Reply

Tags
io, process, statistics



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
how a father process know which child process send the signal SIGCHLD icoming Programming 10 07-20-2010 07:26 AM
How to enable process core in solaris 5.6. UltraSoul Solaris / OpenSolaris 13 10-30-2006 11:28 AM
child process usses same amount of ram as parent process socialjazz Programming 7 10-19-2006 05:48 PM
process I/O statistics? kornelix Linux - General 7 07-15-2006 12:30 AM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 01:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration