<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Xaprb &#187; iopp</title>
	<atom:link href="http://www.xaprb.com/blog/tag/iopp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog</link>
	<description>Stay curious!</description>
	<lastBuildDate>Thu, 09 Feb 2012 03:58:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>iopp: a tool to print I/O operations per-process</title>
		<link>http://www.xaprb.com/blog/2009/01/13/iopp-a-tool-to-print-io-operations-per-process/</link>
		<comments>http://www.xaprb.com/blog/2009/01/13/iopp-a-tool-to-print-io-operations-per-process/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 00:16:42 +0000</pubDate>
		<dc:creator>Xaprb</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[iopp]]></category>
		<category><![CDATA[Mark Wong]]></category>
		<category><![CDATA[markwkm]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=774</guid>
		<description><![CDATA[Mark Wong&#8217;s entry titled &#8220;Following up a couple questions from the presentation at PSU on January 8, 2009&#8221; just caught my eye: What is &#8216;iopp&#8217;? It&#8217;s a custom tool to go through the Linux process table to get i/o statistics per process. It is open source and can be downloaded from: http://git.postgresql.org/?p=~markwkm/iopp.git;a=summary If you know [...]


<strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2009/08/23/how-to-find-per-process-io-statistics-on-linux/' rel='bookmark' title='Permanent Link: How to find per-process I/O statistics on Linux'>How to find per-process I/O statistics on Linux</a></li>
<li><a href='http://www.xaprb.com/blog/2010/02/04/infinidb-gets-the-release-process-right/' rel='bookmark' title='Permanent Link: InfiniDB gets the release process right'>InfiniDB gets the release process right</a></li>
<li><a href='http://www.xaprb.com/blog/2011/02/05/new-aspersa-io-analysis-tool-diskstats/' rel='bookmark' title='Permanent Link: New Aspersa I/O analysis tool, diskstats'>New Aspersa I/O analysis tool, diskstats</a></li>
<li><a href='http://www.xaprb.com/blog/2010/03/16/try-mk-query-advisor-a-new-maatkit-tool/' rel='bookmark' title='Permanent Link: Try mk-query-advisor, a new Maatkit tool'>Try mk-query-advisor, a new Maatkit tool</a></li>
<li><a href='http://www.xaprb.com/blog/2010/05/20/my-chapter-in-the-forthcoming-web-operations-book/' rel='bookmark' title='Permanent Link: My chapter in the forthcoming Web Operations book'>My chapter in the forthcoming Web Operations book</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Mark Wong&#8217;s entry titled &#8220;<a href="http://pugs.postgresql.org/node/513">Following up a couple questions from the presentation at PSU on January 8, 2009</a>&#8221; just caught my eye:</p>

<blockquote><p>What is &#8216;iopp&#8217;?</p>

<p>It&#8217;s a custom tool to go through the Linux process table to get i/o statistics per process. It is open source and can be downloaded from:</p>

<p>http://git.postgresql.org/?p=~markwkm/iopp.git;a=summary</p></blockquote>

<p>If you know me, you know I can&#8217;t pass up &#8220;I/O statistics per process.&#8221;  No way.  So, after a moment of browsing the code, which is short and to the point, I tried it out:</p>

<pre>baron@kanga:~$ wget -q -O iopp.c "http://git.postgresql.org/?p=~markwkm/iopp.git;a=blob_plain;f=iopp.c;hb=HEAD"
baron@kanga:~$ gcc -o iopp iopp.c 
baron@kanga:~$ ./iopp --help
usage: iopp -h|--help
usage: iopp [-ci] [-k|-m] [delay [count]]
            -c, --command display full command line
            -h, --help display help
            -i, --idle hides idle processes
            -k, --kilobytes display data in kilobytes
            -m, --megabytes display data in megabytes
</pre>

<p>Sweet!  Next,</p>

<pre>baron@kanga:~$ ./iopp -i -k 5
  pid    rchar    wchar    syscr    syscw      rkb      wkb     cwkb command
 4912        2        1        0        0        0        0        0 dbus-daemon
 5713        0        1        0        0        0        0        0 hald
 5717       17        0        0        0        0        0        0 hald-runner
 5932        0        2        0        0        0        0        0 NetworkManager
22101       94       28        0        0        0        0        0 Xorg
22238        4        4        0        0        0        0        0 pulseaudio
22684       29       55        1        0        0        0        0 firefox
26860        0       43        0        0        0        0        0 gnome-terminal
</pre>

<p>It behaves just like vmstat &#8212; it loops every 5 seconds until I stop it.</p>

<p>So what are we looking at here?  I don&#8217;t see any documentation, but I see from the source that it&#8217;s reading /proc/[PID]/io.  Unfortunately that&#8217;s not documented in my proc manpage, but there&#8217;s a <a href="http://lkml.org/lkml/2007/3/3/131">patch that provides documentation</a> for the file&#8217;s contents.</p>

<p>According to that, we&#8217;re looking at the pid, the number of kibibytes read and written (even if they came from the cache), the number of read and write system calls, and the number of kibibytes read and written to physical medium (i.e. not just to the OS cache).  Finally we have canceled write kibibytes, and the command name.  I won&#8217;t repeat the documentation on the canceled write bytes &#8212; it is what it sounds like, but there&#8217;s a little bit more explanation on that patch I linked.</p>

<p>This tool would have been very handy to know about last week.  One of my clients was seeing a lot of disk writes from a MySQL server, and it would have made it considerably easier to diagnose the problem.</p>

<p>There is one small bug &#8212; the -i flag causes idle processes not to be printed out, but it&#8217;s applied after bytes have been transformed into kibi/mebibytes, so any process that has zeroes after that transformation gets filtered out.  So you&#8217;ll get different output from -i -k than you will from -i or from -i -m.  I&#8217;ll see if I can find the author&#8217;s email address and let him know about this&#8230;</p>

<p><strong>Further Reading:</strong><ul><li><a href='http://www.xaprb.com/blog/2009/08/23/how-to-find-per-process-io-statistics-on-linux/' rel='bookmark' title='Permanent Link: How to find per-process I/O statistics on Linux'>How to find per-process I/O statistics on Linux</a></li>
<li><a href='http://www.xaprb.com/blog/2010/02/04/infinidb-gets-the-release-process-right/' rel='bookmark' title='Permanent Link: InfiniDB gets the release process right'>InfiniDB gets the release process right</a></li>
<li><a href='http://www.xaprb.com/blog/2011/02/05/new-aspersa-io-analysis-tool-diskstats/' rel='bookmark' title='Permanent Link: New Aspersa I/O analysis tool, diskstats'>New Aspersa I/O analysis tool, diskstats</a></li>
<li><a href='http://www.xaprb.com/blog/2010/03/16/try-mk-query-advisor-a-new-maatkit-tool/' rel='bookmark' title='Permanent Link: Try mk-query-advisor, a new Maatkit tool'>Try mk-query-advisor, a new Maatkit tool</a></li>
<li><a href='http://www.xaprb.com/blog/2010/05/20/my-chapter-in-the-forthcoming-web-operations-book/' rel='bookmark' title='Permanent Link: My chapter in the forthcoming Web Operations book'>My chapter in the forthcoming Web Operations book</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://www.xaprb.com/blog/2009/01/13/iopp-a-tool-to-print-io-operations-per-process/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

