Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
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.
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
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
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.
Distribution: Mostly RH and SuSE, various versions
Posts: 1
Rep:
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.