<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CE4GR3s5fSp7ImA9WhBbGEo.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535</id><updated>2013-05-18T11:28:46.525+01:00</updated><category term="wubi" /><category term="regressions" /><category term="tools" /><category term="documentation" /><category term="books" /><category term="bugs" /><category term="C" /><category term="compilers" /><category term="Nexus 7" /><category term="backporting" /><category term="community" /><category term="obfuscated" /><category term="disk" /><category term="temperature" /><category term="poll" /><category term="microblogging" /><category term="Easter Eggs" /><category term="UNR" /><category term="obscure" /><category term="firefox" /><category term="audio" /><category term="devices" /><category term="TCP" /><category term="valgrind" /><category term="fwts" /><category term="reliability" /><category term="keyboard" /><category term="installer" /><category term="cmos" /><category term="firmware" /><category term="QEMU" /><category term="performance" /><category term="vim" /><category term="launchpad" /><category term="review" /><category term="raid" /><category term="BIOS" /><category term="cpu" /><category term="helicopter" /><category term="buttons" /><category term="visualization" /><category term="lego" /><category term="hdd" /><category term="ssd" /><category term="wifi" /><category term="karmic koala" /><category term="security" /><category term="UEFI" /><category term="graphics" /><category term="SuperHub" /><category term="GPE" /><category term="battery" /><category term="bash" /><category term="networking" /><category term="USB" /><category term="minimodem" /><category term="resume" /><category term="microcontroller" /><category term="chumby" /><category term="ROM" /><category term="coding" /><category term="rebooting" /><category term="power" /><category term="stats" /><category term="quality" /><category term="benchmarking" /><category term="fun" /><category term="sata" /><category term="suspend" /><category term="testing" /><category term="ubuntu" /><category term="Intel" /><category term="conferences" /><category term="latencies" /><category term="UNIX" /><category term="rdrand" /><category term="optimisation" /><category term="grub" /><category term="fuse" /><category term="debugging" /><category term="cache" /><category term="ACPI" /><category term="oops" /><category term="iso" /><category term="input" /><category term="hacking" /><category term="tty" /><category term="tracing" /><category term="C64" /><category term="processes" /><category term="KVM" /><category term="bootloaders" /><category term="filesystems" /><category term="nvram" /><category term="sensors" /><category term="analysis" /><category term="IRC" /><category term="windows" /><category term="ext4" /><category term="podcasts" /><category term="productivity" /><category term="microcode" /><category term="CSM" /><category term="tsc" /><category term="simulators" /><category term="C macros" /><category term="hardware" /><category term="boot times" /><category term="arduino" /><category term="PCI" /><category term="boot" /><category term="The" /><category term="programming" /><category term="reset" /><category term="videos" /><category term="interrupts" /><category term="ssh" /><category term="canonical" /><category term="X" /><category term="systemtap" /><category term="C hacks" /><category term="alpha" /><category term="eCryptfs" /><category term="ALSA" /><category term="netbook" /><category term="kernel" /><category term="history" /><category term="benhmarking" /><category term="routing" /><category term="gcc" /><category term="hot" /><category term="bell" /><category term="bloat" /><category term="failure" /><category term="virtualisation" /><category term="tweaks" /><category term="hotkeys" /><category term="data" /><category term="profiling" /><category term="printers" /><category term="ftp" /><category term="gource" /><title>A Smackerel of Opinion</title><subtitle type="html">Notes and jottings from an Ubuntu Kernel Engineer.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://smackerelofopinion.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>297</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/ASmackerelOfOpinion" /><feedburner:info uri="asmackerelofopinion" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by/2.0/" /><feedburner:emailServiceId>ASmackerelOfOpinion</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;CEcGQng5fyp7ImA9WhBbGE0.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-3764834563817270491</id><published>2013-05-17T13:38:00.000+01:00</published><updated>2013-05-17T15:47:03.627+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-17T15:47:03.627+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="tracing" /><category scheme="http://www.blogger.com/atom/ns#" term="debugging" /><title>Kernel tracing using lttng</title><content type="html">LTTng (&lt;span id="slogan"&gt;Linux Trace Toolkit - next generation) is a highly efficient system tracer that allows tracing of the kernel and userspace. It also provides tools to view and analyse the gathered trace data.&amp;nbsp; So let's see how to install and use LTTng kernel tracing in Ubuntu. First, one has to install the LTTng userspace tools:
&lt;/span&gt;&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;span id="slogan"&gt;&lt;span id="slogan"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo apt-get update  
 sudo apt-get install lttng-tools  
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span id="slogan"&gt;
&lt;span id="slogan"&gt;
LTTng was already &lt;a href="http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-saucy.git;a=commit;h=ec6810d99bd324b542c616d5cd667cfc1ae79f38"&gt;recently added&lt;/a&gt; into the Ubuntu 13.10 Saucy kernel, however, with earlier releases one needs to install the LTTng kernel driver using lttng-modules-dkms as follows:&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;span id="slogan"&gt;&lt;span id="slogan"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo apt-get install lttng-modules-dkms  
&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span id="slogan"&gt;&lt;span id="slogan"&gt;
It is a good idea to sanity check to see if the tools and driver are installed correctly, so first check to see the available kernel events on your machine:&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo lttng list -k  
&lt;/code&gt;&lt;/pre&gt;
And you should get a list similar to the following:&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; Kernel events:  
 -------------  
    mm_vmscan_kswapd_sleep (loglevel: TRACE_EMERG (0)) (type: tracepoint)  
    mm_vmscan_kswapd_wake (loglevel: TRACE_EMERG (0)) (type: tracepoint)  
    mm_vmscan_wakeup_kswapd (loglevel: TRACE_EMERG (0)) (type: tracepoint)  
    mm_vmscan_direct_reclaim_begin (loglevel: TRACE_EMERG (0)) (type: tracepoint)  
    mm_vmscan_memcg_reclaim_begin (loglevel: TRACE_EMERG (0)) (type: tracepoint)  
 ..  
&lt;/code&gt;&lt;/pre&gt;
Next, we need to create a tracing session:&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo lttng create examplesession  
&lt;/code&gt;&lt;/pre&gt;
..and enable events to be traced using:&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo lttng enable-event sched_process_exec -k  
&lt;/code&gt;&lt;/pre&gt;
One can also specify multiple events as a comma separated list. Next, start the tracing using:&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo lttng start  
&lt;/code&gt;&lt;/pre&gt;
and to stop and complete the tracing use:&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo lttng stop  
 sudo lttng destroy  
&lt;/code&gt;&lt;/pre&gt;
and the trace data will be saved in the directory ~/lttng-traces/examplesession-[date]-[time]/.&amp;nbsp; One can examine the trace data using the babeltrace tool, for example:&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo babeltrace ~/lttng-traces/examplesession-20130517-125533  
&lt;/code&gt;&lt;/pre&gt;
And you should get a list similar to the following:&lt;br /&gt;
&lt;pre style="background-image: URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; [12:56:04.490960303] (+?.?????????) x220i sched_process_exec: { cpu_id = 2 }, { filename = "/usr/bin/firefox", tid = 4892, old_tid = 4892 }  
 [12:56:04.493116594] (+0.002156291) x220i sched_process_exec: { cpu_id = 0 }, { filename = "/usr/bin/which", tid = 4895, old_tid = 4895 }  
 [12:56:04.496291224] (+0.003174630) x220i sched_process_exec: { cpu_id = 2 }, { filename = "/usr/lib/firefox/firefox", tid = 4892, old_tid = 4892 }  
 [12:56:05.472770438] (+0.976479214) x220i sched_process_exec: { cpu_id = 2 }, { filename = "/usr/lib/libunity-webapps/unity-webapps-service", tid = 4910, old_tid = 4910 }  
 [12:56:05.478117340] (+0.005346902) x220i sched_process_exec: { cpu_id = 2 }, { filename = "/usr/bin/ubuntu-webapps-update-index", tid = 4912, old_tid = 4912 }  
 [12:56:10.834043409] (+5.355926069) x220i sched_process_exec: { cpu_id = 3 }, { filename = "/usr/bin/top", tid = 4937, old_tid = 4937 }  
 [12:56:13.668306764] (+2.834263355) x220i sched_process_exec: { cpu_id = 3 }, { filename = "/bin/ps", tid = 4938, old_tid = 4938 }  
 [12:56:16.047191671] (+2.378884907) x220i sched_process_exec: { cpu_id = 3 }, { filename = "/usr/bin/sudo", tid = 4939, old_tid = 4939 }  
 [12:56:16.059363974] (+0.012172303) x220i sched_process_exec: { cpu_id = 3 }, { filename = "/usr/bin/lttng", tid = 4940, old_tid = 4940 }  
&lt;/code&gt;&lt;/pre&gt;
The LTTng &lt;a href="http://lttng.org/"&gt;wiki&lt;/a&gt; contains many useful &lt;a href="https://bugs.lttng.org/projects/lttng-tools/wiki"&gt;worked examples &lt;/a&gt;and is well worth exploring.&lt;br /&gt;
&lt;br /&gt;
As it stands, LTTng is relatively light weight.&amp;nbsp;&amp;nbsp; &lt;a href="http://mdh.diva-portal.org/smash/get/diva2:325301/FULLTEXT01"&gt;Research by Romik Guha Anjoy and Soumya Kanti Chakraborty&lt;/a&gt; shows that LTTng describes how the CPU overhead is ~1.6% on a Intel® CoreTM 2 Quad with four 64 bit Q9550 cores.&amp;nbsp; With measurements I've made with oprofile on a Nexus 4 with 1.5&amp;nbsp;GHz quad-core Snapdragon S4 Pro processor shows a CPU overhead of &amp;lt; 1% for kernel tracing.&amp;nbsp; In flight recorder mode, one can generate a lot of trace data. For example, with all tracing enabled running multiple stress tests I was able to generate ~850K second of trace data, so this will obviously impact disk I/O.&lt;/span&gt;&lt;/span&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=HT_k-JOZIjo:8_gbsOgR1KY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=HT_k-JOZIjo:8_gbsOgR1KY:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=HT_k-JOZIjo:8_gbsOgR1KY:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=HT_k-JOZIjo:8_gbsOgR1KY:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=HT_k-JOZIjo:8_gbsOgR1KY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=HT_k-JOZIjo:8_gbsOgR1KY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=HT_k-JOZIjo:8_gbsOgR1KY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=HT_k-JOZIjo:8_gbsOgR1KY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=HT_k-JOZIjo:8_gbsOgR1KY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=HT_k-JOZIjo:8_gbsOgR1KY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=HT_k-JOZIjo:8_gbsOgR1KY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=HT_k-JOZIjo:8_gbsOgR1KY:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/HT_k-JOZIjo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/3764834563817270491/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2013/05/kernel-tracing-using-lttng.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/3764834563817270491?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/3764834563817270491?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/HT_k-JOZIjo/kernel-tracing-using-lttng.html" title="Kernel tracing using lttng" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2013/05/kernel-tracing-using-lttng.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIGQXk4fip7ImA9WhBbEE8.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-7636738459787596319</id><published>2013-05-08T15:32:00.000+01:00</published><updated>2013-05-08T15:32:00.736+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-08T15:32:00.736+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="profiling" /><title>Getting started with oprofile on Ubuntu</title><content type="html">Oprofile is a powerful system wide profiler for Linux.&amp;nbsp; It can profile all running code on a system with minimal overhead.&amp;nbsp;&amp;nbsp; Running oprofile requires the uncompressed vmlinux image, so one has to also install the kernel .ddeb images.&lt;br /&gt;
&lt;br /&gt;
To install oprofile:&lt;br /&gt;
&lt;pre nbsp="" style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install oprofile&lt;/code&gt;&lt;/pre&gt;
..and then install the kernel .ddebs:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | \  
 sudo tee -a /etc/apt/sources.list.d/ddebs.list  
 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 428D7C01  
 sudo apt-get update  
 sudo apt-get install linux-image-$(uname -r)-dbgsym  
&lt;/code&gt;&lt;/pre&gt;
&amp;nbsp;..the installed vmlinux image can be found in /usr/lib/debug/boot/vmlinux-$(uname-r)&lt;br /&gt;
&lt;br /&gt;
Oprofile is now ready to be used.&amp;nbsp; Let's assume we want to profile the following command:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; dd if=/dev/urandom of=/dev/null bs=4K  
&lt;/code&gt;&lt;/pre&gt;
First, before running opcontrol, one may have to stop the NMI watchdog to free up counter 0 using the following:&lt;br /&gt;
&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; echo "0" | sudo tee /proc/sys/kernel/watchdog  
&lt;/code&gt;&lt;/pre&gt;
Next, we tell opcontrol the location of vmlinux, separate out kernel samples, initialize, reset profiling and start profiling:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo opcontrol --vmlinux=/usr/lib/debug/boot/vmlinux-$(uname -r)  
 sudo opcontrol --separate=kernel  
 sudo opcontrol --init  
 sudo opcontrol --reset  
 sudo opcontrol --start  
&lt;/code&gt;&lt;/pre&gt;
&amp;nbsp;..and run the command we want to profile for the desired duration.  Next we stop profiling, generate a report for the executable we are interested in and de-initialize oprofile using:
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo opcontrol --stop  
 sudo opreport image:/bin/dd -gl  
 sudo opcontrol --deinit  
&lt;/code&gt;&lt;/pre&gt;
The resulting output from opreport is as follows:

&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; Using /var/lib/oprofile/samples/ for samples directory.  
 warning: /kvm could not be found.  
 CPU: Intel Ivy Bridge microarchitecture, speed 2.501e+06 MHz (estimated)  
 Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 100000  
 samples %    image name        symbol name  
 55868  59.8973 vmlinux-3.9.0-0-generic sha_transform  
 14942  16.0196 vmlinux-3.9.0-0-generic random_poll  
 10971  11.7622 vmlinux-3.9.0-0-generic ftrace_define_fields_random__mix_pool_bytes  
 3977   4.2638 vmlinux-3.9.0-0-generic extract_buf  
 1905   2.0424 vmlinux-3.9.0-0-generic __mix_pool_bytes  
 1596   1.7111 vmlinux-3.9.0-0-generic _mix_pool_bytes  
 900    0.9649 vmlinux-3.9.0-0-generic __ticket_spin_lock  
 737    0.7902 vmlinux-3.9.0-0-generic copy_user_enhanced_fast_string  
 574    0.6154 vmlinux-3.9.0-0-generic perf_trace_random__extract_entropy  
 419    0.4492 vmlinux-3.9.0-0-generic extract_entropy_user  
 336    0.3602 vmlinux-3.9.0-0-generic random_fasync  
 146    0.1565 vmlinux-3.9.0-0-generic sha_init  
 133    0.1426 vmlinux-3.9.0-0-generic wait_for_completion  
 129    0.1383 vmlinux-3.9.0-0-generic __ticket_spin_unlock  
 72     0.0772 vmlinux-3.9.0-0-generic default_spin_lock_flags  
 69     0.0740 vmlinux-3.9.0-0-generic _copy_to_user  
 35     0.0375 dd            /bin/dd  
 23     0.0247 vmlinux-3.9.0-0-generic __srcu_read_lock  
 22     0.0236 vmlinux-3.9.0-0-generic account  
 15     0.0161 vmlinux-3.9.0-0-generic fsnotify
...  
&lt;/code&gt;&lt;/pre&gt;
This example just scratches the surface of the capabilities of oprofile.  For further reading I recommend reading the &lt;a href="http://oprofile.sourceforge.net/doc/index.html"&gt;oprofile manual&lt;/a&gt; as it contains some excellent examples.
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0p0g8rwTdTo:zB-WXWaVwR4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0p0g8rwTdTo:zB-WXWaVwR4:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0p0g8rwTdTo:zB-WXWaVwR4:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=0p0g8rwTdTo:zB-WXWaVwR4:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0p0g8rwTdTo:zB-WXWaVwR4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=0p0g8rwTdTo:zB-WXWaVwR4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0p0g8rwTdTo:zB-WXWaVwR4:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0p0g8rwTdTo:zB-WXWaVwR4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=0p0g8rwTdTo:zB-WXWaVwR4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0p0g8rwTdTo:zB-WXWaVwR4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=0p0g8rwTdTo:zB-WXWaVwR4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0p0g8rwTdTo:zB-WXWaVwR4:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/0p0g8rwTdTo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/7636738459787596319/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2013/05/getting-started-with-oprofile-on-ubuntu.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/7636738459787596319?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/7636738459787596319?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/0p0g8rwTdTo/getting-started-with-oprofile-on-ubuntu.html" title="Getting started with oprofile on Ubuntu" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2013/05/getting-started-with-oprofile-on-ubuntu.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QASX8-eCp7ImA9WhBVGUo.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-6635421749651124009</id><published>2013-04-26T12:22:00.000+01:00</published><updated>2013-04-26T12:22:28.150+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-26T12:22:28.150+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="fwts" /><category scheme="http://www.blogger.com/atom/ns#" term="ACPI" /><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="firmware" /><category scheme="http://www.blogger.com/atom/ns#" term="UEFI" /><title>Firmware Test Suite New Features in Ubuntu Raring 13.04</title><content type="html">The &lt;a href="https://wiki.ubuntu.com/Kernel/Reference/fwts"&gt;Firmware Test Suite &lt;/a&gt;(fwts) is a tool containing a large set of tests to exercise and diagnose firmware related bugs in x86 PC firmware.&amp;nbsp; So what new shiny features have appeared in the new Ubuntu Raring 13.04 release?&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface"&gt;UEFI&lt;/a&gt; specific tests to exercise and stress test various UEFI run time services:&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; * Stress test for miscellaneous run time service interfaces.&lt;br /&gt;
&amp;nbsp; * Test get/set time interfaces.&lt;br /&gt;
&amp;nbsp; * Test get/set wakeup time interfaces.&lt;br /&gt;
&amp;nbsp; * Test get variable interface.&lt;br /&gt;
&amp;nbsp; * Test get next variable name interface.&lt;br /&gt;
&amp;nbsp; * Test set variable interface.&lt;br /&gt;
&amp;nbsp; * Test query variable info interface.&amp;nbsp;&lt;br /&gt;
&amp;nbsp; * Set variable interface stress test.&lt;br /&gt;
&amp;nbsp; * Query variable info interface stress test.&lt;br /&gt;
&amp;nbsp; * Test Miscellaneous runtime service interfaces.&lt;br /&gt;
&lt;br /&gt;
These use a new kernel driver to allow fwts to access the kernel UEFI run time interfaces.&amp;nbsp; The driver is built and installed using DKMS.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface"&gt;ACPI&lt;/a&gt; specific improvements:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; * Improved ACPI 5.0 support&lt;br /&gt;
&amp;nbsp; * Annotated ACPI _CRS (Current Resource Settings) dumping.&lt;br /&gt;
&lt;br /&gt;
Kernel log scanning (finds and diagnoses errors as reported by the kernel):&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; * Improved kernel log scanning with an additional 450 tests.&lt;br /&gt;
&lt;br /&gt;
This release also includes many small bug fixes as well as minor improvements to the layout of the output of some of the tests. &lt;br /&gt;
&lt;br /&gt;
Many thanks to Alex Hung, Ivan Hu, Keng-Yu Lin and Matt Fleming for all the improvements to fwts for this release.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZRtaixRYs1M:9OcwiPXEjEM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZRtaixRYs1M:9OcwiPXEjEM:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZRtaixRYs1M:9OcwiPXEjEM:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=ZRtaixRYs1M:9OcwiPXEjEM:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZRtaixRYs1M:9OcwiPXEjEM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=ZRtaixRYs1M:9OcwiPXEjEM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZRtaixRYs1M:9OcwiPXEjEM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZRtaixRYs1M:9OcwiPXEjEM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=ZRtaixRYs1M:9OcwiPXEjEM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZRtaixRYs1M:9OcwiPXEjEM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=ZRtaixRYs1M:9OcwiPXEjEM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZRtaixRYs1M:9OcwiPXEjEM:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/ZRtaixRYs1M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/6635421749651124009/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2013/04/firmware-test-suite-new-features-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/6635421749651124009?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/6635421749651124009?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/ZRtaixRYs1M/firmware-test-suite-new-features-in.html" title="Firmware Test Suite New Features in Ubuntu Raring 13.04" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2013/04/firmware-test-suite-new-features-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcBQnc5cSp7ImA9WhBVFUs.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-7046775820422798761</id><published>2013-04-21T17:00:00.000+01:00</published><updated>2013-04-21T17:00:53.929+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-21T17:00:53.929+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="valgrind" /><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="debugging" /><title>Valgrind stack traces</title><content type="html">Sometimes when debugging an application it is useful to generate a stack dump when a specific code path is being executed.&amp;nbsp; The valgrind tool provides a very useful and easy to use mechanism to do this:&lt;br /&gt;
&lt;br /&gt;
1. Add in the following to the source file:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; #include &amp;lt;valgrind/valgrind.h&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
2. Generate the stack trace at the point you desire (and print a specific message) using VALGRIND_PRINTF_BACKTRACE(), for example:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; VALGRIND_PRINTF_BACKTRACE("Stack trace @ %s(), %d", __func__, __LINE__);  
&lt;/code&gt;&lt;/pre&gt;
3. Run the program with valgrind.&amp;nbsp; You may wish to use the --tool=none option to make valgrind run a little faster:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt;  valgrind --tool=none ./generate/unix/bin64/acpiexec *.dat  
&lt;/code&gt;&lt;/pre&gt;
4. Observe the strack trace. For example, I added this to the ACPICA acpiexec in AcpiDsInitOneObject() and got stack traces such as:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; ACPI: SSDT 0x563a480 00249 (v01 LENOVO TP-SSDT2 00000200 INTL 20061109)  
 **7129** Stack trace @ AcpiDsInitOneObject(), 174  at 0x416041: VALGRIND_PRINTF_BACKTRACE (in /home/king/repos/acpica/generate/unix/bin64/acpiexec)  
 ==7129==  by 0x4160A6: AcpiDsInitOneObject (in /home/king/repos/acpica/generate/unix/bin64/acpiexec)  
 ==7129==  by 0x441F76: AcpiNsWalkNamespace (in /home/king/repos/acpica/generate/unix/bin64/acpiexec)  
 ==7129==  by 0x416312: AcpiDsInitializeObjects (in /home/king/repos/acpica/generate/unix/bin64/acpiexec)  
 ==7129==  by 0x43D84D: AcpiNsLoadTable (in /home/king/repos/acpica/generate/unix/bin64/acpiexec)  
 ==7129==  by 0x450448: AcpiTbLoadNamespace (in /home/king/repos/acpica/generate/unix/bin64/acpiexec)  
 ==7129==  by 0x4502F6: AcpiLoadTables (in /home/king/repos/acpica/generate/unix/bin64/acpiexec)  
 ==7129==  by 0x405D1A: AeInstallTables (in /home/king/repos/acpica/generate/unix/bin64/acpiexec)  
 ==7129==  by 0x4052E8: main (in /home/king/repos/acpica/generate/unix/bin64/acpiexec)  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
There are a collection of very useful tricks to be found in the &lt;a href="http://valgrind.org/docs/manual/manual-core-adv.html"&gt;Valgrind online manual&lt;/a&gt; which I recommend perusing at your leisure.&lt;br /&gt;
&lt;br /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=opWhhbUjs0g:8_uBgWK5SCg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=opWhhbUjs0g:8_uBgWK5SCg:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=opWhhbUjs0g:8_uBgWK5SCg:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=opWhhbUjs0g:8_uBgWK5SCg:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=opWhhbUjs0g:8_uBgWK5SCg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=opWhhbUjs0g:8_uBgWK5SCg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=opWhhbUjs0g:8_uBgWK5SCg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=opWhhbUjs0g:8_uBgWK5SCg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=opWhhbUjs0g:8_uBgWK5SCg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=opWhhbUjs0g:8_uBgWK5SCg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=opWhhbUjs0g:8_uBgWK5SCg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=opWhhbUjs0g:8_uBgWK5SCg:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/opWhhbUjs0g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/7046775820422798761/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2013/04/valgrind-stack-traces.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/7046775820422798761?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/7046775820422798761?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/opWhhbUjs0g/valgrind-stack-traces.html" title="Valgrind stack traces" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2013/04/valgrind-stack-traces.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0AEQXc8fip7ImA9WhBREUs.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-5744383225059979832</id><published>2013-03-01T19:20:00.003Z</published><updated>2013-03-01T19:21:40.976Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-01T19:21:40.976Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="analysis" /><title>Pragmatic Graphing</title><content type="html">Over the past few days I have been analysing various issues and also doing some background research, so I have been collecting some rather large sets of data to process.&amp;nbsp;&amp;nbsp; Normally I filter, re-format and process the data using a bunch of simple tools such as awk, tr, cut, sort, uniq and grep to get the data into some form where it can be plotted using gnuplot.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
The UNIX philosophy of piping together a bunch of tools to produce the final output normally works fine, however, graphing the data with gnuplot always ends up with me digging around in the online gnuplot documentation or reading old gnuplot files to remind myself exactly how to plot the data just the way I want.&amp;nbsp;&amp;nbsp; This is fine for occasions where I gather lots of identical logs and want to compare results from multiple tests, the investment in time to automate this with gnuplot is well worth the hassle. &amp;nbsp; However, some times I just have a handful of samples and want to plot a graph and then quickly re-jig the data and perhaps calculate some statistical information such a trend lines.&amp;nbsp; In this case, I fall back to shoving the samples into LibreOffice Calc and slamming out some quick graphs.&lt;br /&gt;
&lt;br /&gt;
This makes me choke a bit.&amp;nbsp; Using LibreOffice Calc starts to make me feel like I'm an accountant rather than a software engineer.&amp;nbsp; However, once I have swallowed my pride I have come to the conclusion that one has to be pragmatic and use the right tool for the job.&amp;nbsp; To turn around small amounts of data quickly, LibreOffice Calc does seem to be quite useful.&amp;nbsp;&amp;nbsp; For processing huge datasets and automated graph plotting, gnuplot does the trick (as long as I can remember how to use it).&amp;nbsp;&amp;nbsp; I am a command line junkie and really don't like using GUI based power tools, but there does seem to be a place where I can mix the two quite happily.&lt;br /&gt;
&lt;br /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=yR0uKguxBx8:auA6hI2n35g:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=yR0uKguxBx8:auA6hI2n35g:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=yR0uKguxBx8:auA6hI2n35g:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=yR0uKguxBx8:auA6hI2n35g:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=yR0uKguxBx8:auA6hI2n35g:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=yR0uKguxBx8:auA6hI2n35g:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=yR0uKguxBx8:auA6hI2n35g:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=yR0uKguxBx8:auA6hI2n35g:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=yR0uKguxBx8:auA6hI2n35g:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=yR0uKguxBx8:auA6hI2n35g:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=yR0uKguxBx8:auA6hI2n35g:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=yR0uKguxBx8:auA6hI2n35g:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/yR0uKguxBx8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/5744383225059979832/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2013/03/pragmatic-graphing.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5744383225059979832?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5744383225059979832?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/yR0uKguxBx8/pragmatic-graphing.html" title="Pragmatic Graphing" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>4</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2013/03/pragmatic-graphing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0AAQ3o4fCp7ImA9WhNVEUs.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-5589586779722613350</id><published>2012-12-19T08:39:00.000Z</published><updated>2012-12-22T09:49:02.434Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-22T09:49:02.434Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="obfuscated" /><title>..and now something seasonal</title><content type="html">The Christmas holidays are almost here and to celebrate I've mildly obfuscated some C that prints the lyrics to a traditional English carol.

The source code can be found &lt;a href="http://kernel.ubuntu.com/~cking/christmas-2012.c"&gt;here&lt;/a&gt; and compiled and run using:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;malloc.h&amp;gt;
#define H malloc (1237) ;
#define c while
#define W &amp;gt;&amp;gt; /* fallen right tree */
#define w &amp;lt;&amp;lt; /* fallen left tree */
#define B(wish,times) ((_ &amp;amp;wish) times 2)
#define L {o Q=q;p(3[Z]),P(false[Z],q),\
p(q&amp;gt;2?&amp;quot;th&amp;quot;:N),p(Z[2]);c(true+Q)p(q&amp;#124;Q?Q?\
N:4[Z]:&amp;quot;a &amp;quot;),P(1[Z],Q),p(Q&amp;gt;1?&amp;quot;, &amp;quot;:N),--\
Q;p(&amp;quot;.\n\n&amp;quot;),++q;}
char typedef o;void typedef d

                         ;
                        o*N
                       =&amp;quot;&amp;quot;;o
                      q;o*O(o
                       *p){o
                      *P,_;o*
                     f=P=H;c(_
                    =*p)_^=1,*f
                   ++=B(1,w)&amp;#124;B(4
                    ,W)&amp;#124;B(2,w)&amp;#124;
                   B(8,W)&amp;#124;(_&amp;amp;240
                  ),++p,*f=false;
                 return P;}d p(o*f
                ){fputs(f,stdout);}
                 d P(o*s,o o){c( o
                --){c(122-*s)s++; s
               ++;}c(122-*s)putchar(
              *s++);} o main(void){o*
             Z[]={O(&amp;quot;hgy}p{}dmnj`{pcg&amp;quot;
              &amp;quot;y`{hny{hgh{}gs{}dxdj{&amp;quot;
             &amp;quot;dglc{jgj{pdj{dbdxdj{p&amp;#124;d&amp;quot;
            &amp;quot;bh{&amp;quot;),O(&amp;quot;qeypyg`ld!gj!e!q&amp;quot;
           &amp;quot;dey!pydd{p&amp;#124;n!ptypbd!`nxd}{p&amp;quot;
          &amp;quot;cydd!Hydjmc!Cdj}{hnty!mnbbw!i&amp;quot;
                       &amp;quot;gy`&amp;quot;
                       &amp;quot;}{h&amp;quot;
                       &amp;quot;gxd&amp;quot;
                       &amp;quot;!ln&amp;quot;
                       &amp;quot;b`d&amp;quot;
                 &amp;quot;j!ygjl}{}gs!ldd}&amp;quot;
                 &amp;quot;d&amp;amp;e&amp;amp;bewgjl{}dxdj&amp;quot;
                  &amp;quot;!}&amp;#124;ej}&amp;amp;e&amp;amp;}&amp;#124;gff&amp;quot;
                  &amp;quot;gjl{dglcp!feg`&amp;quot;
&amp;quot;}&amp;amp;e&amp;amp;fgbogjl{jgjd!be`gd}!`ejmgjl{pdj!bny`}&amp;amp;e&amp;amp;bdeqgjl{&amp;quot;
&amp;quot;dbdxdj!qgqdy}&amp;amp;qgqgjl{p&amp;#124;dbxd!`ytffdy}!`ytffgjl{&amp;quot;) ,O (
&amp;quot;!`ew!nh!Mcyg}pfe}!fw!pytd!bnxd!lexd!pn!fd!&amp;quot;),O(&amp;quot;Nj!p&amp;quot;
&amp;quot;cd!&amp;quot;),O(&amp;quot;!ej`!e!&amp;quot;)};L L L L L L L L L L L L /*Xmas*/}
&lt;/code&gt;&lt;/pre&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=W0D1DndEmIo:2rtQC-a08Qc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=W0D1DndEmIo:2rtQC-a08Qc:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=W0D1DndEmIo:2rtQC-a08Qc:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=W0D1DndEmIo:2rtQC-a08Qc:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=W0D1DndEmIo:2rtQC-a08Qc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=W0D1DndEmIo:2rtQC-a08Qc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=W0D1DndEmIo:2rtQC-a08Qc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=W0D1DndEmIo:2rtQC-a08Qc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=W0D1DndEmIo:2rtQC-a08Qc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=W0D1DndEmIo:2rtQC-a08Qc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=W0D1DndEmIo:2rtQC-a08Qc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=W0D1DndEmIo:2rtQC-a08Qc:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/W0D1DndEmIo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/5589586779722613350/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/12/and-now-something-seasonal.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5589586779722613350?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5589586779722613350?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/W0D1DndEmIo/and-now-something-seasonal.html" title="..and now something seasonal" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>6</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/12/and-now-something-seasonal.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0AHSHg_fyp7ImA9WhNWGUw.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-1750481408604714354</id><published>2012-12-15T09:31:00.000Z</published><updated>2012-12-19T12:22:19.647Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-19T12:22:19.647Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="debugging" /><title>Debugging using Visualisation.</title><content type="html">There are many different classes of bugs and hence many different debugging techniques can be used.&amp;nbsp;&amp;nbsp; Sometimes there is a lot of complexity in a problem and it is hard to make a mental model of what exactly is going on between multiple interdependent components, especially when non-deterministic behaviour is occurring.&lt;br /&gt;
&lt;br /&gt;
Unfortunately the human mind is limited; there is only so much debugging state that it can follow.&amp;nbsp; The problem is compounded when a bug manifests itself after several hours or days of continuous execution time - there just seems like there is too much state to track and to make sense from.&lt;br /&gt;
&lt;br /&gt;
Looking at thousands of lines of debug trace and trying to spot any lurking evidence that may offer some hint to why code is failing is not trivial. However the brain is highly developed at making sense of visual input, so it makes sense to visualise copious amounts of debug data to spot anomalies.&lt;br /&gt;
&lt;br /&gt;
The kernel offers many ways to gather data, be it via different &lt;a href="http://netsplit.com/2011/03/07/tracing-on-linux/"&gt;trace mechanisms&lt;/a&gt; or just by using plain old printk().&amp;nbsp;&amp;nbsp; The steps to debug are thus: &lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp; Try and find a way to reliably reproduce the problem to be debugged.&lt;br /&gt;
2.&amp;nbsp; Where possible, try to remove complexity from the problem and still end up with a reliable way of reproducing the problem.&lt;br /&gt;
3.&amp;nbsp; Rig up a way of collecting internal state or data on system activity.&amp;nbsp;&amp;nbsp; Obviously the type of data to be collected is dependant on the type of problem being worked on.&amp;nbsp;&amp;nbsp; Be careful that any instrumentation does not affect the behaviour of the system.&lt;br /&gt;
4.&amp;nbsp; Start collecting data and try to reproduce the bug.&amp;nbsp; You may have to do this multiple times to collect enough data to allow one to easily spot trends over different runs.&lt;br /&gt;
5.&amp;nbsp; Visualise the data.&lt;br /&gt;
&lt;br /&gt;
Iterating on steps 2 to 5 allow one to keep on refining a problem down to the bare minimum required to corner a bug. &lt;br /&gt;
&lt;br /&gt;
Now step 5 is the fun part.&amp;nbsp; Sometimes one has to lightly parse the output to collect specific items of data. I generally use tools such as awk to extract specific fields or to re-munge data into a format that can be easily processed by graphing tools.&amp;nbsp; It can be useful to also collect time stamps with the data as some bugs are timing dependant and seeing interactions between components is key to understanding why issues occur.&amp;nbsp; If one gathers multiple sets of data from different sources then being able to correlate the data on a timestamp&amp;nbsp; can be helpful.&lt;br /&gt;
&lt;br /&gt;
If I have just a few tens of hundreds items of data to visualise I generally just collate my data into tab or comma separated output and then import it into LibreOffice Calc and then generate graphs from the raw data.&amp;nbsp;&amp;nbsp; However, for more demanding graphing I normally resort to using &lt;a href="http://www.gnuplot.info/"&gt;gnuplot&lt;/a&gt;.&amp;nbsp;&amp;nbsp; Gnuplot is an incredibly powerful plotting tool - however for more complex graphs one often needs to delve deep into the manual and perhaps crib from the very useful worked examples.&lt;br /&gt;
&lt;br /&gt;
Graphing data allows one to easily spot trends or correlate between seemingly unrelated parts of a system. What was originally an overwhelmingly huge mass of debug data turns into a powerful resource.&amp;nbsp;&amp;nbsp; Sometimes I find it useful to run multiple tests over a range of tweaked kernel tuneables to see if bugs change behaviour - often this aids understanding when there is significant amounts of inter-component complexity occurring.&lt;br /&gt;
&lt;br /&gt;
Perhaps it is just the way I like to think about issues, but I do recommend experimenting with collecting large data sets and creatively transforming the data into visualise representations to allow one to easily spot issues.&amp;nbsp; It can be surprising just how much one can glean from thousands of seemingly unrelated&amp;nbsp; traces of debug data.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=wRyoLcMtwsQ:ahcMwQEs4R4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=wRyoLcMtwsQ:ahcMwQEs4R4:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=wRyoLcMtwsQ:ahcMwQEs4R4:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=wRyoLcMtwsQ:ahcMwQEs4R4:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=wRyoLcMtwsQ:ahcMwQEs4R4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=wRyoLcMtwsQ:ahcMwQEs4R4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=wRyoLcMtwsQ:ahcMwQEs4R4:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=wRyoLcMtwsQ:ahcMwQEs4R4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=wRyoLcMtwsQ:ahcMwQEs4R4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=wRyoLcMtwsQ:ahcMwQEs4R4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=wRyoLcMtwsQ:ahcMwQEs4R4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=wRyoLcMtwsQ:ahcMwQEs4R4:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/wRyoLcMtwsQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/1750481408604714354/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/12/debugging-using-visualisation.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/1750481408604714354?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/1750481408604714354?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/wRyoLcMtwsQ/debugging-using-visualisation.html" title="Debugging using Visualisation." /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/12/debugging-using-visualisation.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYMQ34-fSp7ImA9WhNXE0s.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-506299618700472594</id><published>2012-12-01T12:16:00.000Z</published><updated>2012-12-01T12:16:22.055Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-01T12:16:22.055Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="UNIX" /><category scheme="http://www.blogger.com/atom/ns#" term="simulators" /><category scheme="http://www.blogger.com/atom/ns#" term="history" /><title>UNIX 1st Edition restoration project.</title><content type="html">Earlier this week I stumbled upon the &lt;a href="http://code.google.com/p/unix-jun72/"&gt;unix-jun72&lt;/a&gt; project which is a restoration of the 1st edition of UNIX based on a &lt;a href="http://www.bitsavers.org/pdf/bellLabs/unix/PreliminaryUnixImplementationDocument_Jun72.pdf"&gt;scanned printout&lt;/a&gt; of the original source.&amp;nbsp; Unfortunately not all the &lt;a href="http://code.google.com/p/unix-jun72/source/browse/"&gt;source&lt;/a&gt; is available, but some userland binaries and the C compiler have been recovered from some tapes and there is enough functionality to be able to boot to a minimal and usable system.&lt;br /&gt;
&lt;br /&gt;
The first step is to download and build the most excellent &lt;a href="http://simh.trailing-edge.com/"&gt;Simh simulator&lt;/a&gt; so that we can simulate a &lt;a href="http://en.wikipedia.org/wiki/PDP-11"&gt;PDP-11&lt;/a&gt;.&amp;nbsp;&amp;nbsp; Fortunately the &lt;a href="http://unix-jun72.googlecode.com/files/images-20080625.tgz"&gt;disk images&lt;/a&gt; are already pre-built and downloadable, so one just has to download these and point the PDP-11 simulator at a config file and the system almost instantly boots.&amp;nbsp; The full instructions are provided in great detail &lt;a href="http://code.google.com/p/unix-jun72/source/browse/trunk/Readme"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
I am rather fond of the PDP-11. It was the first mini computer I worked on back in 1987 when I was a &lt;i&gt;very&lt;/i&gt; junior programmer at &lt;a href="http://www.prosig.co.uk/"&gt;Prosig&lt;/a&gt;.&amp;nbsp; The machine was running &lt;a href="http://en.wikipedia.org/wiki/RSX-11"&gt;RSX-11M Plus&lt;/a&gt; rather than UNIX but even so it gave me the appreciation of what one can do on a very small multi-user machine. At the time I was maintaining, building and testing &lt;a href="http://www.prosig.com/dats/"&gt;DATS signal processing tools&lt;/a&gt; written in &lt;a href="http://en.wikipedia.org/wiki/Fortran#FORTRAN_77"&gt;Fortran 77&lt;/a&gt;, and some of the work involved tinkering with &lt;a href="http://odl.sysworks.biz/disk$vaxdocsep953/decw$book/d33vaa11.p22.decw$book"&gt;task builder&lt;/a&gt; scripts to try and cram code into the very limited memory.&lt;br /&gt;
&lt;br /&gt;
So in those days size really mattered.&amp;nbsp; Small was considered beautiful and this mindset was instilled into me in my formative years.&amp;nbsp; So I was very pleased to find the unix-jun72 project which allows me to relive those PDP-11 days and also experience UNIX-1.&lt;br /&gt;
&lt;br /&gt;
Since some of the original source code still exists, one can browse the source of the kernel and some of the core utilities.&amp;nbsp; It is amazing to see the functionality that is available in very small binaries.&lt;br /&gt;
&lt;br /&gt;
Let's&amp;nbsp; fire up the simulator and see the size of the 'cat' command:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; PDP-11 simulator V3.9-0  
 Disabling CR  
 Disabling XQ  
 RF: buffering file in memory  
 TC0: 16b format, buffering file in memory  
 :login: root  
 root  
 # ls -al /bin/cat  
 total  1  
  50 sxrwr- 1 bin   134 Jan 1 00:00:00 cat  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&amp;nbsp;And how does that compare to a GNU cat on a 64 bit Ubuntu laptop?&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; ls -al /bin/cat  
 -rwxr-xr-x 1 root root 47912 Nov 28 12:48 /bin/cat  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
134 bytes versus 47912 bytes. That is quite a difference!&amp;nbsp; Admittedly we are comparing apples vs pears here, so obviously this is an unfair comparison, but it does illustrate how we've "progressed" since the early UNIX-1 days.&amp;nbsp;&amp;nbsp; Honestly I'm glad we can now write userland tools and the kernel in C rather than assembler and not have to worry about size constraints quite so much.&lt;br /&gt;
&lt;br /&gt;
I'm very glad that this project exists to preserve the UNIX heritage.&amp;nbsp; History has a lot to teach us.&amp;nbsp; Browsing the early code is an education; it allows us to appreciate the memory constraints that shaped the design and implementation of UNIX.&amp;nbsp; To be able to run this code in a simulator and tinker with a running system adds to the experience.&lt;br /&gt;
&lt;br /&gt;
We've moved on a long way in 40 or so years, machines are incredibly powerful, and memory and disk is cheap.&amp;nbsp; But let us not forget the "small is beautiful" ideal.&amp;nbsp; There is something very appealing about tools that do just enough to be very useful and yet are not bloated with unnecessary memory hogging feature creep.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0vLEL-ASpVg:e_rXgmPALh4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0vLEL-ASpVg:e_rXgmPALh4:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0vLEL-ASpVg:e_rXgmPALh4:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=0vLEL-ASpVg:e_rXgmPALh4:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0vLEL-ASpVg:e_rXgmPALh4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=0vLEL-ASpVg:e_rXgmPALh4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0vLEL-ASpVg:e_rXgmPALh4:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0vLEL-ASpVg:e_rXgmPALh4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=0vLEL-ASpVg:e_rXgmPALh4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0vLEL-ASpVg:e_rXgmPALh4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=0vLEL-ASpVg:e_rXgmPALh4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=0vLEL-ASpVg:e_rXgmPALh4:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/0vLEL-ASpVg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/506299618700472594/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/12/unix-1st-edition-restoration-project.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/506299618700472594?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/506299618700472594?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/0vLEL-ASpVg/unix-1st-edition-restoration-project.html" title="UNIX 1st Edition restoration project." /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/12/unix-1st-edition-restoration-project.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MBRnc8eyp7ImA9WhNQFkU.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-4435994630094989376</id><published>2012-11-23T16:50:00.001Z</published><updated>2012-11-23T16:50:57.973Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-23T16:50:57.973Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="gcc" /><title>Using the gcc cleanup attribute</title><content type="html">Section &lt;a href="http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html"&gt;6.36 of the GCC manual&lt;/a&gt; describes the rather interesting &lt;i&gt;cleanup&lt;/i&gt; variable attribute.&amp;nbsp;&amp;nbsp; This allows one to specify a function to call when the variable goes out of scope.&lt;br /&gt;
&lt;br /&gt;
The caveat is that the cleanup attribute can only be used with auto function
scope variables, so it cannot be used on function parameters or static variables.&lt;br /&gt;
&lt;br /&gt;
So what about an simple example?&amp;nbsp; How about automatic free'ing on variables that go out of scope?&amp;nbsp; This way we can be lazy and do automatic garbage collecting without having to remember to free() each allocation. Now, I'm not recommending this is good practice, I am just using this as an example.&lt;br /&gt;
&lt;br /&gt;
Below I define a macro autofree that we use on the auto variables that we want to garbage collect on. &amp;nbsp; When the variable goes out of scope __autofree() is called and it is passing the address of the variable.&amp;nbsp; GCC insists on the helper function to be passed as a pointer to the type of the variable being cleaned. To handle any particular type I used a void * argument __autofree() and then I cast this to a void ** to allow me to free the memory that the variable pointed to, so a little bit of legitimate slight of hand being used here.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; #include &amp;lt;stdlib.h&amp;gt;  
 #include &amp;lt;stdio.h&amp;gt;  
   
 #define autofree __attribute((cleanup(__autofree)))  
   
 void __autofree(void *p)  
 {  
     void **_p = (void**)p;  
   
     printf("free -&amp;gt; %p\n", *_p);  
     free(*_p);  
 }  
   
 void *myalloc(size_t sz)  
 {  
     void *ptr;  
   
     if ((ptr = malloc(sz)) == NULL) {  
         fprintf(stderr, "malloc failed.\n");  
         exit(1);  
     }  
     printf("malloc -&amp;gt; %p\n", ptr);  
   
     return ptr;  
 }  
   
 int main(int argc, char **argv)  
 {  
     autofree char *x = myalloc(32);  
   
     {  
         autofree int *y = myalloc(64);  
   
         printf("y = %p\n", y);  
     }  
     printf("x = %p\n", x);  
   
     return 0;
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
In this example, I malloc memory for x and then y.&amp;nbsp; Then y and then x go out of scope and the cleaner function __autofree() frees the memory in that order:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; malloc -&amp;gt; 0x1504010  
 malloc -&amp;gt; 0x1504040  
 y = 0x1504040  
 free -&amp;gt; 0x1504040  
 x = 0x1504010  
 free -&amp;gt; 0x1504010  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
I'm sure there are other ways that this can be creatively used (or abused...); as it stands it is a GCC extension so it is not portable C in any shape or form. &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=5vJRiq5RnjA:oxoEE_uim6E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=5vJRiq5RnjA:oxoEE_uim6E:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=5vJRiq5RnjA:oxoEE_uim6E:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=5vJRiq5RnjA:oxoEE_uim6E:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=5vJRiq5RnjA:oxoEE_uim6E:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=5vJRiq5RnjA:oxoEE_uim6E:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=5vJRiq5RnjA:oxoEE_uim6E:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=5vJRiq5RnjA:oxoEE_uim6E:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=5vJRiq5RnjA:oxoEE_uim6E:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=5vJRiq5RnjA:oxoEE_uim6E:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=5vJRiq5RnjA:oxoEE_uim6E:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=5vJRiq5RnjA:oxoEE_uim6E:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/5vJRiq5RnjA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/4435994630094989376/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/11/using-gcc-cleanup-attribute.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/4435994630094989376?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/4435994630094989376?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/5vJRiq5RnjA/using-gcc-cleanup-attribute.html" title="Using the gcc cleanup attribute" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>5</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/11/using-gcc-cleanup-attribute.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0AFRHg9cCp7ImA9WhNQEUU.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-2312929826401439927</id><published>2012-11-17T20:55:00.000Z</published><updated>2012-11-17T20:55:15.668Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-17T20:55:15.668Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="data" /><category scheme="http://www.blogger.com/atom/ns#" term="analysis" /><category scheme="http://www.blogger.com/atom/ns#" term="stats" /><title>Benford's Law with real world data.</title><content type="html">If one has a &lt;i&gt;large&lt;/i&gt; &lt;i&gt;enough&lt;/i&gt; real life source of data (such as the size of files in the file system) and look at the distribution of the first digit of these values then one will find something that at first glance is rather surprising.&amp;nbsp; The leading digit 1 appears about 30% of the time and as the digits increase to 9 their frequency drops until we reach 9, which only appears about 5% of the time.&amp;nbsp;&amp;nbsp; This seemingly curious frequency distribution is commonly known as &lt;a href="http://en.wikipedia.org/wiki/Benford%27s_law"&gt;Benford's law&lt;/a&gt; or the first digit law.&lt;br /&gt;
&lt;br /&gt;
The probability P of digit d can be expresses as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;
P(d) = log&lt;sub&gt;10&lt;/sub&gt;(1 + 1 / d)&lt;/div&gt;
&lt;br /&gt;
..where d is any integer value 1 to 9 inclusive. So for each leading digit in the data, the distribution works out to be about:&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
&amp;nbsp;&amp;nbsp;
Digit &amp;nbsp;&amp;nbsp; &lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
&amp;nbsp;
Probability &lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
1&lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
0.301&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
2&lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
0.176&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
3&lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
0.125&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
4&lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
0.097&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
5&lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
0.079&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
6&lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
0.067&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
7&lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
0.058&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
8&lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
0.051&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td&gt;&lt;center&gt;
9&lt;/center&gt;
&lt;/td&gt;
  &lt;td&gt;&lt;center&gt;
0.046&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/center&gt;
&lt;br /&gt;
But how does this hold up with some "real world" data? Can it really be true?&amp;nbsp; Well, for my first experiment, I analysed the leading digit of all the source files in the current Linux source tree and compared that to Benford's Law:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-C75AJ7rVuU4/UKfz_Oxsp6I/AAAAAAAADW0/JvIPm4fm3JE/s1600/benford1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-C75AJ7rVuU4/UKfz_Oxsp6I/AAAAAAAADW0/JvIPm4fm3JE/s1600/benford1.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
So, this is convincing enough.&amp;nbsp; How about something more exotic?&amp;nbsp; For my second experiment I counted up the number of comments in each file that start with /* in just the C source files in the Linux source tree and again looked at the distribution of the leading digits.&amp;nbsp; I was hazarding a guess that there are a reasonable amount of comments in each file (knowing the way some code is commented this may be pushing my luck).&amp;nbsp; Anyhow, the data generated also produces a distribution that obeys Benford's Law too:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-mGfg-Fv8YKM/UKf09ErVX5I/AAAAAAAADW8/5zGfDkFeFuY/s1600/benford2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-mGfg-Fv8YKM/UKf09ErVX5I/AAAAAAAADW8/5zGfDkFeFuY/s1600/benford2.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Well, that certainly shows that Kernel developers are sprinkling enough comments in the Kernel source to be statistically meaningful.&amp;nbsp; If the comments themselves are meaningful is another matter... &lt;br /&gt;
&lt;br /&gt;
How about one more test?&amp;nbsp; This time I gathered the length of every executable in /usr/bin and plotted the distribution of the leading digits from this data:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-nFofktJUjrA/UKf20E7p67I/AAAAAAAADXM/l5orTTiVT10/s1600/benford3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-nFofktJUjrA/UKf20E7p67I/AAAAAAAADXM/l5orTTiVT10/s1600/benford3.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
..this data set has far less files to analyse, so the distribution deviates a little, but the trend is still rather good. &lt;br /&gt;
&lt;br /&gt;
As mentioned earlier, one has to have a large set of data for this too work well.&amp;nbsp; Interesting this may be, but what kind of practical use is it?&amp;nbsp;&amp;nbsp; It can be applied to accountancy - if one has a large enough set of data in the accounts and the leading digits of the data do not fit Benford's Law then maybe one should suspect that somebody has been fiddling the books.&amp;nbsp; Humans are rather poor at making up lots of "random" values that don't skew Benford's Law. &lt;br /&gt;
&lt;br /&gt;
One more interesting fact is that it applies even if one rescales the data.&amp;nbsp; For example, if you are looking at accounts in terms of £ sterling and covert it into US dollars or Albanian Lek the rescaled data still obeys Benford's Law.&amp;nbsp; Thus if re-ran my tests and didn't analyse the size of files in bytes but instead used size in 512 byte blocks it still would produce a leading digit distribution that obeyed Benford's Law.&amp;nbsp; Nice.&lt;br /&gt;
&lt;br /&gt;
How can we apply this in computing? Perhaps we could use it to detect tampering with the sizes of a large set of files.&amp;nbsp; Who knows?&amp;nbsp; I am sure somebody can think of a useful way to use it.&amp;nbsp;&amp;nbsp; I just find it all rather fascinating.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=FWBQMH0McVo:mV_Twc8aDCo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=FWBQMH0McVo:mV_Twc8aDCo:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=FWBQMH0McVo:mV_Twc8aDCo:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=FWBQMH0McVo:mV_Twc8aDCo:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=FWBQMH0McVo:mV_Twc8aDCo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=FWBQMH0McVo:mV_Twc8aDCo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=FWBQMH0McVo:mV_Twc8aDCo:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=FWBQMH0McVo:mV_Twc8aDCo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=FWBQMH0McVo:mV_Twc8aDCo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=FWBQMH0McVo:mV_Twc8aDCo:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=FWBQMH0McVo:mV_Twc8aDCo:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=FWBQMH0McVo:mV_Twc8aDCo:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/FWBQMH0McVo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/2312929826401439927/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/11/benfords-law-with-real-world-data.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/2312929826401439927?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/2312929826401439927?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/FWBQMH0McVo/benfords-law-with-real-world-data.html" title="Benford's Law with real world data." /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-C75AJ7rVuU4/UKfz_Oxsp6I/AAAAAAAADW0/JvIPm4fm3JE/s72-c/benford1.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/11/benfords-law-with-real-world-data.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcNRXoycSp7ImA9WhNQEEQ.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-8604022784552432210</id><published>2012-11-16T19:11:00.002Z</published><updated>2012-11-16T19:11:34.499Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-16T19:11:34.499Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Nexus 7" /><category scheme="http://www.blogger.com/atom/ns#" term="battery" /><category scheme="http://www.blogger.com/atom/ns#" term="power" /><title>Non linear characteristics in a draining battery on the Nexus 7</title><content type="html">Measuring power consumption on low power devices really is not as simple as running tools such as PowerTop and then assuming the data is trustworthy.&amp;nbsp; I shall explain why.&lt;br /&gt;
&lt;br /&gt;
With Ubuntu on the Nexus 7, the battery driver originally provided battery capacity in terms of percentage full, which lacked precision to make any sane power consumption estimates.&amp;nbsp;&amp;nbsp; We tweaked the battery driver so that we could get battery capacity in terms of uWh from the &lt;a href="http://www.ti.com/lit/gpn/bq27541-g1"&gt;bq27541 battery fuel gauge&lt;/a&gt;.&amp;nbsp; From this, one can measure the change in capacity over time and estimate the power consumed by the device.&lt;br /&gt;
&lt;br /&gt;
For the Ubuntu 12.04 Precise release I wrote the lightweight power measurement tool "&lt;a href="http://kernel.ubuntu.com/~cking/powerstat/"&gt;powerstat&lt;/a&gt;" to try to determine power consumption using the change in battery capacity.&amp;nbsp; Powerstat can gather changes in the battery capacity level and by using a simple sliding window on the samples it gives an &lt;i&gt;estimate&lt;/i&gt; on the power being consumed over time.&amp;nbsp; With laptops that consume a &lt;i&gt;lot&lt;/i&gt; of power this provides a &lt;i&gt;reasonable&lt;/i&gt; rough &lt;i&gt;estimate&lt;/i&gt; of power consumption.&lt;br /&gt;
&lt;br /&gt;
The tweak to the Nexus 7 battery driver allows powerstat to work on the Nexus 7 running Ubuntu.&amp;nbsp; So how trustworthy is the battery data from the battery fuel gauge?&amp;nbsp; Is the data reliable if we repeat the test under the same conditions?&amp;nbsp; Do we get consistent readings over time?&lt;br /&gt;
&lt;br /&gt;
For my first set of tests, I fully charged the Nexus 7 and then fully loaded the 4 CPUs with busy loops and then ran multiple powerstat tests; powerstat gathers samples over 8 minutes and estimates power consumption. It also calculates the standard deviation from these samples to give us some idea of the variability of the battery power measurements.&amp;nbsp;&amp;nbsp;&amp;nbsp; For each powerstat test I logged the battery voltage level, the % battery capacity (normalized to a range of 0..1 to make it easier to plot), the estimated power consumption (with its standard deviation) and then plotted the results: &lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-u9jgsKcn5yA/UKaEtNQO8UI/AAAAAAAADWU/c4j58sJNIFc/s1600/battery-cpu-busy.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-u9jgsKcn5yA/UKaEtNQO8UI/AAAAAAAADWU/c4j58sJNIFc/s1600/battery-cpu-busy.png" /&gt;&lt;/a&gt;&lt;/div&gt;
With this test the machine is in a steady state, we are not changing the load on the CPUs, so one should expect a steady power measurement.&amp;nbsp; But as one can see, the battery gauge informs us that the voltage is dropping over time (from ~4V down to ~3.25V) and the estimated power also varies from 4.6W down to 3.3W.&amp;nbsp; So, clearly, the power estimate will depend on the level of charge in the battery.&lt;br /&gt;
&lt;br /&gt;
I also measured an idle machine:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-ocsBUir3s_g/UKaJFXLDkMI/AAAAAAAADWk/xpDyJgH8xfI/s1600/battery-cpu-idle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-ocsBUir3s_g/UKaJFXLDkMI/AAAAAAAADWk/xpDyJgH8xfI/s1600/battery-cpu-idle.png" /&gt;&lt;/a&gt;&lt;/div&gt;
Again, voltage drops over time and estimated power drops too.&amp;nbsp; More interesting is that the estimated power measurement is not particularly smooth over time as shown by the plot of the standard deviation too.&amp;nbsp;&amp;nbsp; We can therefore conclude that a lightly loaded machine has a lot of variability in the estimated power consumption data and this means we cannot realistically measure subtle power optimization tweaks made to the software as there is just too much variability in the data.&lt;br /&gt;
&lt;br /&gt;
I re-ran the idle test over several days, running from the same fully charged state to a completely empty battery, and compared runs.&amp;nbsp; I got variability in the duration of the test (+/- 5%). Also, comparing estimated power consumption at the 100%, 75%, 50% and 25% battery capacity points also shows a lot of variability. This means one cannot get accurate and repeatable power estimations even when the battery is charged at specific capacities.&lt;br /&gt;
&lt;br /&gt;
So next time somebody tells you that the latest changes made their low power device suck more (or less!) power than the previous release and their findings are based on data derived from battery fuel gauge, take it with a pinch of salt.&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
The only reliable way to measure instantaneous power consumption is using specialised precision equipment that has been accurately calibrated.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=fEYjZbaA6WI:fwV1wlN3tgU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=fEYjZbaA6WI:fwV1wlN3tgU:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=fEYjZbaA6WI:fwV1wlN3tgU:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=fEYjZbaA6WI:fwV1wlN3tgU:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=fEYjZbaA6WI:fwV1wlN3tgU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=fEYjZbaA6WI:fwV1wlN3tgU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=fEYjZbaA6WI:fwV1wlN3tgU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=fEYjZbaA6WI:fwV1wlN3tgU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=fEYjZbaA6WI:fwV1wlN3tgU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=fEYjZbaA6WI:fwV1wlN3tgU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=fEYjZbaA6WI:fwV1wlN3tgU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=fEYjZbaA6WI:fwV1wlN3tgU:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/fEYjZbaA6WI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/8604022784552432210/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/11/non-linear-characteristics-in-draining.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/8604022784552432210?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/8604022784552432210?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/fEYjZbaA6WI/non-linear-characteristics-in-draining.html" title="Non linear characteristics in a draining battery on the Nexus 7" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-u9jgsKcn5yA/UKaEtNQO8UI/AAAAAAAADWU/c4j58sJNIFc/s72-c/battery-cpu-busy.png" height="72" width="72" /><thr:total>5</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/11/non-linear-characteristics-in-draining.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QDSX8_eip7ImA9WhNSGUU.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-5741100483403091199</id><published>2012-11-03T22:14:00.001Z</published><updated>2012-11-03T22:22:58.142Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-03T22:22:58.142Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><title>Counting code size with SLOCCount</title><content type="html">David A. Wheeler's &lt;a href="http://www.dwheeler.com/sloccount/"&gt;SLOCCount&lt;/a&gt; is a useful tool for counting lines of code in a software project.&amp;nbsp; It is simple to use, just provide it with the path to the source code and let it grind through all the source files.&amp;nbsp; The resulting output is a break down of code line count for each type of source based on the programming language. &lt;br /&gt;
&lt;br /&gt;
SLOCCount also estimates development time in person-years as well as the number of developers and the cost to develop.&amp;nbsp; One can override the defaults and specify parameters such as costs per person, overhead and effort to make it match to your development model.&lt;br /&gt;
&lt;br /&gt;
Of course, like all tools that produce metrics it can be abused, for example using it as a meaningless metric of programmer productivity.&amp;nbsp; Counting lines of code does &lt;b&gt;not&lt;/b&gt; really measure project complexity, a vexing bug that took 2 days to figure out and resulted in a 1 line fix is obviously more expensive than a poorly written 500 line function that introduces a no new noticeable functionality.&amp;nbsp;&amp;nbsp; As a rule of thumb, SLOCCount is a useful tool to get an idea of the size of a project and some idea of the cost to develop it.&amp;nbsp;&amp;nbsp; There are of course more complex ways to examine project source code, such as &lt;a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity"&gt;cyclomatic complexity&lt;/a&gt; metrics, and there are specific tools such as &lt;a href="http://sourceforge.net/projects/panopticode/"&gt;Panopticode&lt;/a&gt; that do this.&lt;br /&gt;
&lt;br /&gt;
As a small exercise, I gave SLOCCount the task of counting the lines of code in the Linux kernel from version 2.6.12 to 3.6 and used the default settings to produce an estimated cost to develop each version.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-zkvDvKUYPpc/UJWR0XE3vbI/AAAAAAAADVI/ny_UKJV4GCM/s1600/linux-sloccount2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-zkvDvKUYPpc/UJWR0XE3vbI/AAAAAAAADVI/ny_UKJV4GCM/s1600/linux-sloccount2.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
It is interesting to see that the rate of code being added seemed to increase around the 2.6.28 release.&amp;nbsp;&amp;nbsp; So what about the estimated cost to develop?..&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-3SmJQL0nA5E/UJWRX95zHiI/AAAAAAAADU4/X3CW86QXr8I/s1600/linux-sloccount1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-3SmJQL0nA5E/UJWRX95zHiI/AAAAAAAADU4/X3CW86QXr8I/s1600/linux-sloccount1.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
This is of course pure conjecture.&amp;nbsp; The total lines of code does not consider the code of some patches that remove code and assumes that the cost is directly related to lines of code.&amp;nbsp; Also, code complexity makes some lines of code far more expensive to develop than others.&amp;nbsp;&amp;nbsp; It is interesting to see that each release is adding an average of 184,000 lines of code per release which SLOCCount estimates to cost about $8.14 million dollars or ~44.24 dollars per line of code; not sure how realistic that really is.&lt;br /&gt;
&lt;br /&gt;
Anyhow, SLOCCount is easy to use and provides some very useful rule-of-thumb analysis on project size and costs.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=9DXPASXyecw:KwS-k--u0Ac:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=9DXPASXyecw:KwS-k--u0Ac:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=9DXPASXyecw:KwS-k--u0Ac:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=9DXPASXyecw:KwS-k--u0Ac:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=9DXPASXyecw:KwS-k--u0Ac:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=9DXPASXyecw:KwS-k--u0Ac:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=9DXPASXyecw:KwS-k--u0Ac:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=9DXPASXyecw:KwS-k--u0Ac:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=9DXPASXyecw:KwS-k--u0Ac:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=9DXPASXyecw:KwS-k--u0Ac:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=9DXPASXyecw:KwS-k--u0Ac:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=9DXPASXyecw:KwS-k--u0Ac:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/9DXPASXyecw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/5741100483403091199/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/11/counting-code-size-with-sloccount.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5741100483403091199?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5741100483403091199?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/9DXPASXyecw/counting-code-size-with-sloccount.html" title="Counting code size with SLOCCount" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-zkvDvKUYPpc/UJWR0XE3vbI/AAAAAAAADVI/ny_UKJV4GCM/s72-c/linux-sloccount2.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/11/counting-code-size-with-sloccount.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkQHSXsyfyp7ImA9WhNTEU4.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-5757289475693492941</id><published>2012-10-13T15:25:00.000+01:00</published><updated>2012-10-13T15:25:38.597+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-13T15:25:38.597+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="benchmarking" /><category scheme="http://www.blogger.com/atom/ns#" term="rdrand" /><title>Intel rdrand instruction revisited</title><content type="html">A few months ago I did a quick and dirty benchmark of the Intel rdrand instruction found on the new Ivybridge processors.&amp;nbsp; I did some further analysis a while ago and I've only just got around to writing up my findings. I've improved the test by exercising the &lt;a href="http://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide/"&gt;Intel Digital Random Number Generator&lt;/a&gt; (DRNG) with multiple threads and also re-writing the rdrand wrapper in assembler and ensuring the code is inline'd.&amp;nbsp; The source code for this test is available &lt;a href="http://kernel.ubuntu.com/git?p=cking/debug-code/.git;a=commit;h=1e2b369e91bf39175f2eeeeb8e95bd1d801d03f5"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;So, how does it shape up?&amp;nbsp; On a i5-3210M (2.5GHz) Ivybridge (2 cores, 4 threads) I get a peak of ~99.6 million 64 bit rdrands per second with 4 threads which equates to ~6.374 billion bits per second.&amp;nbsp; &lt;i&gt;Not bad at all&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-hyJFMTpSubk/UHlqog4rNGI/AAAAAAAADUQ/2dcsGu2pQSo/s1600/rdrand-throughput.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-hyJFMTpSubk/UHlqog4rNGI/AAAAAAAADUQ/2dcsGu2pQSo/s1600/rdrand-throughput.png" /&gt;&lt;/a&gt;&lt;/div&gt;
With a 4 threaded i5-3210M CPU we hit maximum rdrand throughput with 4 threads.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-pSXZaOGIe9k/UHl1DVoEgVI/AAAAAAAADUk/q84O27lSOIA/s1600/rdrand-throughput-i7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-pSXZaOGIe9k/UHl1DVoEgVI/AAAAAAAADUk/q84O27lSOIA/s1600/rdrand-throughput-i7.png" /&gt;&lt;/a&gt;&lt;/div&gt;
..and with a 8 threaded i7-3770 (3.4GHz) Ivybridge (4 cores, 8 threads) we again hit a peak throughput of 99.6 million 64 bit rdrands a second on 3 threads. One can therefore conclude that this is the peak rate of the DNRG on both CPUs tested.&amp;nbsp; A 2 threaded i3 Ivybridge CPU won't be able to hit the peak rate of the DNRG, and a 4 threaded i5 can only just max out the DNRG with some hand-optimized code.&lt;br /&gt;
&lt;br /&gt;
Now how random is this random data?&amp;nbsp; There are several tests available; I chose to exercise the DRNG using the &lt;a href="http://www.phy.duke.edu/~rgb/General/dieharder.php"&gt;dieharder&lt;/a&gt; test suite.&amp;nbsp; The test is relatively simple; install dieharder and do 64 bit rdrand reads and output these as a raw random number stream and pipe this into dieharder:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo apt-get install dieharder  
 ./rdrand-test | dieharder -g 200 -a
#=============================================================================#
#            dieharder version 3.31.1 Copyright 2003 Robert G. Brown          #
#=============================================================================#
   rng_name    |rands/second|   Seed   |
stdin_input_raw|  3.66e+07  | 639263374|
#=============================================================================#
        test_name   |ntup| tsamples |psamples|  p-value |Assessment
#=============================================================================#
   diehard_birthdays|   0|       100|     100|0.40629140|  PASSED  
      diehard_operm5|   0|   1000000|     100|0.79942347|  PASSED  
  diehard_rank_32x32|   0|     40000|     100|0.35142889|  PASSED  
    diehard_rank_6x8|   0|    100000|     100|0.75739694|  PASSED  
   diehard_bitstream|   0|   2097152|     100|0.65986567|  PASSED  
        diehard_opso|   0|   2097152|     100|0.24791918|  PASSED  
        diehard_oqso|   0|   2097152|     100|0.36850828|  PASSED  
         diehard_dna|   0|   2097152|     100|0.52727856|  PASSED  
diehard_count_1s_str|   0|    256000|     100|0.08299753|  PASSED  
diehard_count_1s_byt|   0|    256000|     100|0.31139908|  PASSED  
 diehard_parking_lot|   0|     12000|     100|0.47786440|  PASSED  
    diehard_2dsphere|   2|      8000|     100|0.93639860|  PASSED  
    diehard_3dsphere|   3|      4000|     100|0.43241488|  PASSED  
     diehard_squeeze|   0|    100000|     100|0.99088862|  PASSED  
        diehard_sums|   0|       100|     100|0.00422846|   WEAK   
        diehard_runs|   0|    100000|     100|0.48432365|  PASSED 
..
        dab_monobit2|  12|  65000000|       1|0.98439048|  PASSED 
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
..and leave to cook for about 45 minutes.&amp;nbsp; The -g 200 option specifies that the random numbers come from stdin and the -a option runs all the dieharder tests.&amp;nbsp; All the tests &lt;b&gt;passed&lt;/b&gt; with the exception of the &lt;i&gt;diehard_sums&lt;/i&gt; test which produced "weak" results, however, this test is known to be unreliable and recommended not to be used.&amp;nbsp; Quite honestly, I would be surprised if the tests failed, but you never know until one runs them.&lt;br /&gt;
&lt;br /&gt;
The CA cert research labs have an on-line random number generator analysis &lt;a href="http://www.cacert.at/random/"&gt;website&lt;/a&gt; allowing one to submit and test at least 12 MB of random numbers. I submitted 32 MB of data, and I am currently waiting to see if I get any results back.&amp;nbsp; Watch this space.&lt;br /&gt;
&lt;br /&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=WL6-dGkw_5E:bN4CHAVAr9w:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=WL6-dGkw_5E:bN4CHAVAr9w:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=WL6-dGkw_5E:bN4CHAVAr9w:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=WL6-dGkw_5E:bN4CHAVAr9w:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=WL6-dGkw_5E:bN4CHAVAr9w:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=WL6-dGkw_5E:bN4CHAVAr9w:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=WL6-dGkw_5E:bN4CHAVAr9w:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=WL6-dGkw_5E:bN4CHAVAr9w:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=WL6-dGkw_5E:bN4CHAVAr9w:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=WL6-dGkw_5E:bN4CHAVAr9w:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=WL6-dGkw_5E:bN4CHAVAr9w:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=WL6-dGkw_5E:bN4CHAVAr9w:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/WL6-dGkw_5E" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/5757289475693492941/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/10/intel-rdrand-instruction-revisited.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5757289475693492941?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5757289475693492941?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/WL6-dGkw_5E/intel-rdrand-instruction-revisited.html" title="Intel rdrand instruction revisited" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-hyJFMTpSubk/UHlqog4rNGI/AAAAAAAADUQ/2dcsGu2pQSo/s72-c/rdrand-throughput.png" height="72" width="72" /><thr:total>5</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/10/intel-rdrand-instruction-revisited.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4AQ3w_fCp7ImA9WhNVEE8.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-7041462046945228772</id><published>2012-09-16T19:13:00.000+01:00</published><updated>2012-12-20T16:29:02.244Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-20T16:29:02.244Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="debugging" /><title>Striving for better code quality.</title><content type="html">Software is complex and is never bug free, but fortunately there are many different tools and techniques available to help to identify and catch a large class of common and obscure bugs.&lt;br /&gt;
&lt;br /&gt;
Compilers provide build options that can help drive up code quality by being particularly strict to detect questionable code constructions, for example gcc's &lt;b&gt;-Wall&lt;/b&gt; and &lt;b&gt;-pedantic&lt;/b&gt; flags.&amp;nbsp; The gcc &lt;b&gt;-Werror&lt;/b&gt; flag is useful during code development to ensure compilation halts with an error on warning messages, this ensures the developer will stop and fix code.&lt;br /&gt;
&lt;br /&gt;
Static analysis during compilation is also a very useful technique, tools such as &lt;a href="http://smatch.sourceforge.net/"&gt;smatch&lt;/a&gt; and &lt;a href="http://coccinelle.lip6.fr/"&gt;Concinelle&lt;/a&gt; can identify bugs such as deferencing of NULL pointers, checks for return values and ranges,&amp;nbsp; incorrect use of &amp;amp;&amp;amp; and ||, bad use of unsigned or signed values and many more beside.&amp;nbsp; These tools were aimed for use on the Linux kernel source code, but can be used on C application source too.&amp;nbsp; Let's take a moment to see how to use smatch when building an application.&lt;br /&gt;
&lt;br /&gt;
Download the dependencies:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo apt-get install libxml2-dev llvm-dev libsqlite3-dev
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Download and build smatch:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; mkdir ~/src  
 cd ~/src  
 git clone git://repo.or.cz/smatch  
 cd smatch  
 make  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now build your application using smatch:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; cd ~/your_source_code  
 make clean  
 make CHECK="~/src/smatch/smatch --full-path" \
   CC=~/src/smatch/cgcc | tee warnings.log  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
..and inspect the warnings and errors in the file warnings.log.&amp;nbsp; Smatch will produce false-positives, so not every warning or error is necessarily buggy code.&lt;br /&gt;
&lt;br /&gt;
Of course, run time profiling of programs also can catch errors.&amp;nbsp; Valgrind is an excellent run time profiler that I regularly use when developing applications to catch bugs such as memory leaks and incorrect memory read/writes. I recommend starting off using the following valgrind options:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; --leak-check=full --show-possibly-lost=yes --show-reachable=yes --malloc-fill=&lt;hexvalue&gt;  
&lt;/hexvalue&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; valgrind --leak-check=full --show-possibly-lost=yes --show-reachable=yes \
  --malloc-fill=ff your-program  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Since the application is being run on a synthetic software CPU execution can be slow, however it is amazingly thorough and produces detailed output that is extremely helpful in cornering buggy code.&lt;br /&gt;
&lt;br /&gt;
The gcc compiler also provides mechanism to instrument code for run-time analysis.&amp;nbsp; The &lt;b&gt;-fmudflap&lt;/b&gt; family of options instruments risky pointer and array dereferencing operations, some standard library string and heap functions as well as some other range + validity tests.&amp;nbsp;&amp;nbsp; For threaded applications use &lt;b&gt;-fmudflapth&lt;/b&gt; instead of -fmudflap.&amp;nbsp;&amp;nbsp; The application also needs to be linked with libmudflap.&lt;br /&gt;
&lt;br /&gt;
Here is a simple example:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; int main(int argc, char **argv)  
 {  
     static int x[100];  
     return x[100];  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Compile with:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; gcc example.c -o example -fmudflap -lmudflap  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
..and mudflap detects the error:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; ./example   
 *******  
 mudflap violation 1 (check/read): time=1347817180.586313 ptr=0x701080 size=404  
 pc=0x7f98d3d17f01 location=`example.c:5:2 (main)'  
    /usr/lib/x86_64-linux-gnu/libmudflap.so.0(__mf_check+0x41) [0x7f98d3d17f01]  
    ./example(main+0x7a) [0x4009c6]  
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f98d397276d]  
 Nearby object 1: checked region begins 0B into and ends 4B after  
 mudflap object 0x190a370: name=`example.c:3:13 x'  
 bounds=[0x701080,0x70120f] size=400 area=static check=3r/0w liveness=3  
 alloc time=1347817180.586261 pc=0x7f98d3d175f1  
 number of nearby objects: 1  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
These are just a few examples, however there are many other options too. &lt;a href="http://elinux.org/Electric_Fence"&gt;Electric Fence&lt;/a&gt; is a useful malloc debugger, and gcc's &lt;b&gt;-fstack-protector&lt;/b&gt; produces extra code to check for buffer overflows, for example in stack smashing. Tools like &lt;a href="http://bfbtester.sourceforge.net/"&gt;bfbtester&lt;/a&gt; allow us to brute force check command line overflows - this is useful as I don't know many developers who try to thoroughly validate all the options in their command line utilities.&lt;br /&gt;
&lt;br /&gt;
No doubt there are many more tools and techniques available.&amp;nbsp; If we use these wisely and regularly we can reduce bugs and drive up code quality.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=gBlr2wNZ6kE:aVEin-5leeg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=gBlr2wNZ6kE:aVEin-5leeg:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=gBlr2wNZ6kE:aVEin-5leeg:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=gBlr2wNZ6kE:aVEin-5leeg:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=gBlr2wNZ6kE:aVEin-5leeg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=gBlr2wNZ6kE:aVEin-5leeg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=gBlr2wNZ6kE:aVEin-5leeg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=gBlr2wNZ6kE:aVEin-5leeg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=gBlr2wNZ6kE:aVEin-5leeg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=gBlr2wNZ6kE:aVEin-5leeg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=gBlr2wNZ6kE:aVEin-5leeg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=gBlr2wNZ6kE:aVEin-5leeg:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/gBlr2wNZ6kE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/7041462046945228772/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/09/striving-for-better-code-quality.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/7041462046945228772?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/7041462046945228772?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/gBlr2wNZ6kE/striving-for-better-code-quality.html" title="Striving for better code quality." /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/09/striving-for-better-code-quality.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIEQ3k-fyp7ImA9WhJWFkk.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-1392085793440687734</id><published>2012-08-22T14:50:00.000+01:00</published><updated>2012-08-22T14:51:42.757+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-22T14:51:42.757+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TCP" /><category scheme="http://www.blogger.com/atom/ns#" term="ssh" /><category scheme="http://www.blogger.com/atom/ns#" term="SuperHub" /><title>Virgin Media Super Hub and ssh timeouts</title><content type="html">After upgrading to a new "shiny" Virgin Media Super Hub I started to get annoying ssh timeouts on idle connections.&amp;nbsp; After some Googling around I discovered that it suffers from TCP connection timeouts and some users have suggested that there isn't much memory in the device, so it can't save much session data.&lt;br /&gt;
&lt;br /&gt;
Well, how does one workaround this issue?&amp;nbsp; Setting the keep alive probe down to 50 seconds and then resending it every 10 seconds seems to do the trick for me. I also tweaked the TCP settings so that if no ACK response is received for 5 consecutive times, the connection is marked as broken.&amp;nbsp; Here's the quick one-liner fix:&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo sysctl -w net.ipv4.tcp_keepalive_time=50 \
 net.ipv4.tcp_keepalive_intvl=10 \
 net.ipv4.tcp_keepalive_probes=5  &lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Of course, to make these settings persistent across reboots, add them to /etc/sysctl.conf&lt;br /&gt;
&lt;br /&gt;
I'm not sure if these settings are "optimal", but they do the trick. You're mileage may vary. &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=SyEPSsG_9NU:aajeSv4wIXI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=SyEPSsG_9NU:aajeSv4wIXI:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=SyEPSsG_9NU:aajeSv4wIXI:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=SyEPSsG_9NU:aajeSv4wIXI:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=SyEPSsG_9NU:aajeSv4wIXI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=SyEPSsG_9NU:aajeSv4wIXI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=SyEPSsG_9NU:aajeSv4wIXI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=SyEPSsG_9NU:aajeSv4wIXI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=SyEPSsG_9NU:aajeSv4wIXI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=SyEPSsG_9NU:aajeSv4wIXI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=SyEPSsG_9NU:aajeSv4wIXI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=SyEPSsG_9NU:aajeSv4wIXI:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/SyEPSsG_9NU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/1392085793440687734/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/08/virgin-media-super-hub-and-ssh-timeouts.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/1392085793440687734?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/1392085793440687734?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/SyEPSsG_9NU/virgin-media-super-hub-and-ssh-timeouts.html" title="Virgin Media Super Hub and ssh timeouts" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>3</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/08/virgin-media-super-hub-and-ssh-timeouts.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C08DQ388eip7ImA9WhJWFUU.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-25270572401445741</id><published>2012-08-21T21:44:00.000+01:00</published><updated>2012-08-21T21:44:32.172+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-08-21T21:44:32.172+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="bugs" /><category scheme="http://www.blogger.com/atom/ns#" term="testing" /><category scheme="http://www.blogger.com/atom/ns#" term="kernel" /><category scheme="http://www.blogger.com/atom/ns#" term="eCryptfs" /><category scheme="http://www.blogger.com/atom/ns#" term="backporting" /><title>Testing eCryptfs</title><content type="html">Over the past several months I've been occasionally back-porting a bunch of eCryptfs patches onto older Ubuntu releases.&amp;nbsp; Each back-ported fix needs to be properly sanity checked and so I've been writing test cases for each one and adding them to the eCryptfs test suite.&lt;br /&gt;
&lt;br /&gt;
To get hold of the test suite, check it out using bzr:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; bzr checkout lp:ecryptfs  
&lt;/code&gt;&lt;/pre&gt;
and install the dependencies so one can build the test suite:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo apt-get install debhelper autotools-dev autoconf automake \
 intltool libtool libgcrypt11-dev libglib2.0-dev libkeyutils-dev \
 libnss3-dev libpam0g-dev pkg-config python-dev swig acl \
 ecryptfs-utils  
&lt;/code&gt;&lt;/pre&gt;
If you want to test eCrytpfs with xfs and btrfs as the lower file system onto which eCryptfs is mounted, then one needs to also install the tools for these:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo apt-get install xfsprogs btrfs-tools  
&lt;/code&gt;&lt;/pre&gt;
And then build the test programs:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; cd ecryptfs  
 autoreconf -ivf  
 intltoolize -c -f  
 ./configure --enable-tests --disable-pywrap  
 make  
&lt;/code&gt;&lt;/pre&gt;
To run the tests, one needs to create lower and upper mount points. The tests allow one to create ext2, ext3, ext4, xfs or btrfs loop-back mounted file systems on the lower mount point, and then eCryptfs is mounted on the upper mount point on top.&amp;nbsp;&amp;nbsp; To create these, use something like:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo mkdir /lower /upper  
&lt;/code&gt;&lt;/pre&gt;
The loop-back file system image needs to be placed somewhere too, I generally place mine in a directory /tmp/image, so this needs creating too:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; mkdir /tmp/image  
&lt;/code&gt;&lt;/pre&gt;
There are two categories of tests, "safe" and "destructive".&amp;nbsp; Safe tests should run in such a ways as to not lock up the machine.&amp;nbsp; Destructive tests try hard to force bugs that can cause kernel oopses or panics. One specifies the test category with the -c option.&amp;nbsp; Now to run the tests, use:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo ./tests/run_tests.sh -K -c safe -b 1000000 -D /tmp/image -l /lower -u /upper  
&lt;/code&gt;&lt;/pre&gt;
The -K option tells the test suite to run the kernel specific tests. These are the ones I am generally interested in since I'm testing kernel patches.&lt;br /&gt;
&lt;br /&gt;
The -b option specifies the size in 1K blocks of the loop-back mounted /lower file system size.&amp;nbsp; I generally use 1000000 blocks as a minimum.&lt;br /&gt;
&lt;br /&gt;
The -D option specifies the path where the temporary loop-back mounted image is kept and the -l and -u options specified the paths of the lower and upper mount points.&lt;br /&gt;
&lt;br /&gt;
By default the tests will use an ext4 lower filesystem. One can also run specify which file systems to run the tests on using the -f option, this can be a comma separated list of one or more file systems, for example:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo ./tests/run_tests.sh -K -c safe -b 1000000 -D /tmp/image -l /lower -u /upper \
 -f ext2,ext3,ext4,xfs  
&lt;/code&gt;&lt;/pre&gt;
And also, instead of running a bunch of tests, one can just a particular test using the -t option:&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo ./tests/run_tests.sh -K -c safe -b 1000000 -D /tmp/image -l /lower -u /upper \
 -f ext2,ext3,ext4,xfs -t lp-926292.sh
&lt;/code&gt;&lt;/pre&gt;
..which tests the fix for LaunchPad bug &lt;a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/926292"&gt;926292&lt;/a&gt;&lt;br /&gt;
&amp;nbsp;
&lt;br /&gt;
We also run these tests regularly on new kernel images to ensure we don't introduce and regressions.&amp;nbsp;&amp;nbsp; As it stands, I'm currently adding in tests for each bug fix that we back-port and for most new bugs that require a thorough test. I hope to expand the breadth of the tests to ensure we get better general test coverage.&lt;br /&gt;
&lt;br /&gt;
And finally, thanks to Tyler Hicks for writing the test framework and for his valuable help in describing how to construct a bunch of these tests.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=GrzmzUS5mpg:-iQhDFvpnVg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=GrzmzUS5mpg:-iQhDFvpnVg:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=GrzmzUS5mpg:-iQhDFvpnVg:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=GrzmzUS5mpg:-iQhDFvpnVg:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=GrzmzUS5mpg:-iQhDFvpnVg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=GrzmzUS5mpg:-iQhDFvpnVg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=GrzmzUS5mpg:-iQhDFvpnVg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=GrzmzUS5mpg:-iQhDFvpnVg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=GrzmzUS5mpg:-iQhDFvpnVg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=GrzmzUS5mpg:-iQhDFvpnVg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=GrzmzUS5mpg:-iQhDFvpnVg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=GrzmzUS5mpg:-iQhDFvpnVg:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/GrzmzUS5mpg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/25270572401445741/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/08/testing-ecryptfs.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/25270572401445741?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/25270572401445741?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/GrzmzUS5mpg/testing-ecryptfs.html" title="Testing eCryptfs" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/08/testing-ecryptfs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUDQHs7fSp7ImA9WhJUGE8.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-5233711158398555863</id><published>2012-08-07T22:27:00.001+01:00</published><updated>2012-09-16T19:31:11.505+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-09-16T19:31:11.505+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="performance" /><category scheme="http://www.blogger.com/atom/ns#" term="cpu" /><category scheme="http://www.blogger.com/atom/ns#" term="rdrand" /><title>Simple performance test of rdrand</title><content type="html">My new Lenovo X230 laptop is equipped with a Intel(R) i5-3210M CPU (2.5 GHz, with 3.1 GHz Turbo) which supports the new Digital Random Number Generator (DRNG) - a high performance entropy and random number generator.&amp;nbsp; The DNRG is read using the new Intel &lt;b&gt;rdrand&lt;/b&gt; instruction which can return 64, 32 or 16 bit random numbers.&lt;br /&gt;
&lt;br /&gt;
The DRNG is described in detail in &lt;a href="http://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide/"&gt;this article&lt;/a&gt; and provides very useful code examples in assembler and C which I used to write a simple and naive test to see how well the rdrand performs on my i5-3210M.&lt;br /&gt;
&lt;br /&gt;
For my test, I simply read 100 million 64 bit random numbers on a single thread. The Intel literature states one can get up to about 70 million rdrand invocations per second on 8 threads, so my simple test is rather naive as it only exercises rdrand on one thread.&amp;nbsp; For a set of 10 iterations on my test, I'm getting around 40-45 nanoseconds per rdrand, or about &lt;b&gt;22-25 million&lt;/b&gt; rdrands per second, which is &lt;b&gt;&lt;i&gt;really&lt;/i&gt;&lt;/b&gt; impressive.&amp;nbsp;&amp;nbsp; The test is a mix of assembler and C, and is not totally optimal, so I am sure I can squeeze a little more performance out with some extra work.&lt;br /&gt;
&lt;br /&gt;
The next test I suspect is to see just random the data is and to see how well it compares to other software random number generators... but I will tinker with that after my vacation.&lt;br /&gt;
&lt;br /&gt;
Anyhow, for reference, the test can be found &lt;a href="http://kernel.ubuntu.com/git?p=cking/debug-code/.git;a=tree;f=rdrand;hb=HEAD"&gt;here&lt;/a&gt; in my git repository.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EDqlJpZuc6M:PZPQsPqvZqA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EDqlJpZuc6M:PZPQsPqvZqA:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EDqlJpZuc6M:PZPQsPqvZqA:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=EDqlJpZuc6M:PZPQsPqvZqA:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EDqlJpZuc6M:PZPQsPqvZqA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=EDqlJpZuc6M:PZPQsPqvZqA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EDqlJpZuc6M:PZPQsPqvZqA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EDqlJpZuc6M:PZPQsPqvZqA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=EDqlJpZuc6M:PZPQsPqvZqA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EDqlJpZuc6M:PZPQsPqvZqA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=EDqlJpZuc6M:PZPQsPqvZqA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EDqlJpZuc6M:PZPQsPqvZqA:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/EDqlJpZuc6M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/5233711158398555863/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/08/simple-performance-test-of-rdrand.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5233711158398555863?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5233711158398555863?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/EDqlJpZuc6M/simple-performance-test-of-rdrand.html" title="Simple performance test of rdrand" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/08/simple-performance-test-of-rdrand.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkINRXg7fCp7ImA9WhJQEUk.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-3137117225263370506</id><published>2012-07-24T15:35:00.000+01:00</published><updated>2012-07-24T15:36:34.604+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-07-24T15:36:34.604+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="KVM" /><category scheme="http://www.blogger.com/atom/ns#" term="virtualisation" /><category scheme="http://www.blogger.com/atom/ns#" term="QEMU" /><category scheme="http://www.blogger.com/atom/ns#" term="testing" /><title>Using virt-manager to manage KVM and QEMU instances</title><content type="html">I've been using QEMU and KVM for quite a while now for general kernel testing, for example, sanity checking &lt;a href="http://ecryptfs.org/"&gt;eCryptfs&lt;/a&gt; and &lt;a href="http://ceph.com/"&gt;Ceph&lt;/a&gt;.&amp;nbsp;&amp;nbsp; It can be argued that the best kind of testing is performed on real hardware, however, there are times when it is much more convenient (and faster) to exercise kernel fixes on a virtual machine.&lt;br /&gt;
&lt;br /&gt;
I used to use the command line incantations to run &lt;a href="http://wiki.qemu.org/Main_Page"&gt;QEMU&lt;/a&gt; and &lt;a href="http://www.linux-kvm.org/page/Main_Page"&gt;KVM&lt;/a&gt;, but recently I've moved over to using &lt;a href="http://virt-manager.org/"&gt;virt-manager&lt;/a&gt; because it so much simpler to use and caters for most of my configuration needs.&lt;br /&gt;
&lt;br /&gt;
Virt-manager provides a very usable GUI and allows one to create, manage, clone and destroy virtual machine instances with ease.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-IJZYw56MLZ8/UA6r81b-VCI/AAAAAAAADK0/S1o9R5N26Ww/s1600/virt-manager-1.png" style="margin-left: auto; margin-right: auto;" /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;virt-manager view of virtual machines&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
Each virtual machine can be easy reconfigured in terms of CPU configuration (number and type of CPUs),&amp;nbsp; memory size, boot options, disk and CD-ROM selection, NIC selection, display server (VNC or Spice), sound device, serial port config, video hardware and USB and IDE controller config.&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
One can add and remove additional hardware, such serial port, parallel ports, USB and PCI host devices, watchdog controllers and much more besides.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-ziv6EiJrWUc/UA6tn2jYc3I/AAAAAAAADLE/upgAwgfsF88/s1600/virt-manager-3.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-ziv6EiJrWUc/UA6tn2jYc3I/AAAAAAAADLE/upgAwgfsF88/s1600/virt-manager-3.png" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Configuring a virtual machine&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
..so reconfiguring a test to run on a single core CPU to multi-core is a simple case of shutting down the virtual machine, bumping up the number of CPUs and booting up again.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
By default one can view the virtual machine's console via a VNC viewer in virt-manager and there is provision to scale the screen to the window size, set to full size or resize the virt-manager window to the screen size.&amp;nbsp; For ease of use, I generally just ssh into the virtual machines and ignore the console unless I can't get the kernel to boot.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-EEC0wGcTNvA/UA6wUlYQzgI/AAAAAAAADLQ/-rmblt_c_gA/s1600/virt-manager-4.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="397" src="http://2.bp.blogspot.com/-EEC0wGcTNvA/UA6wUlYQzgI/AAAAAAAADLQ/-rmblt_c_gA/s400/virt-manager-4.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;virt-manager viewing a 64 bit Natty server (for eCryptfs testing)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
Virt-manager is a great tool and well worth giving a spin. For more information on virt-manager visit &lt;a href="http://virt-manager.org/"&gt;virt-manager.org&lt;/a&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EKktmZX_rn4:4BJVi9F5KHc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EKktmZX_rn4:4BJVi9F5KHc:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EKktmZX_rn4:4BJVi9F5KHc:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=EKktmZX_rn4:4BJVi9F5KHc:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EKktmZX_rn4:4BJVi9F5KHc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=EKktmZX_rn4:4BJVi9F5KHc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EKktmZX_rn4:4BJVi9F5KHc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EKktmZX_rn4:4BJVi9F5KHc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=EKktmZX_rn4:4BJVi9F5KHc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EKktmZX_rn4:4BJVi9F5KHc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=EKktmZX_rn4:4BJVi9F5KHc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=EKktmZX_rn4:4BJVi9F5KHc:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/EKktmZX_rn4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/3137117225263370506/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/07/using-virt-manager-to-manage-kvm-and.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/3137117225263370506?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/3137117225263370506?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/EKktmZX_rn4/using-virt-manager-to-manage-kvm-and.html" title="Using virt-manager to manage KVM and QEMU instances" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-IJZYw56MLZ8/UA6r81b-VCI/AAAAAAAADK0/S1o9R5N26Ww/s72-c/virt-manager-1.png" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/07/using-virt-manager-to-manage-kvm-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UBRnc_eCp7ImA9WhJTEEU.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-51924014006161429</id><published>2012-06-19T08:00:00.000+01:00</published><updated>2012-06-19T08:00:57.940+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-19T08:00:57.940+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="fwts" /><category scheme="http://www.blogger.com/atom/ns#" term="firmware" /><category scheme="http://www.blogger.com/atom/ns#" term="BIOS" /><category scheme="http://www.blogger.com/atom/ns#" term="kernel" /><category scheme="http://www.blogger.com/atom/ns#" term="debugging" /><category scheme="http://www.blogger.com/atom/ns#" term="UEFI" /><category scheme="http://www.blogger.com/atom/ns#" term="hotkeys" /><title>Ubuntu ODM portal</title><content type="html">A new Ubuntu portal &lt;a href="http://odm.ubuntu.com/"&gt;http://odm.ubuntu.com&lt;/a&gt; is a jump-start page containing links to pages and documents useful for Original Design Manufactures (ODMs), Original Equipment Manufacturers (OEMs) and Independent BIOS vendors.&lt;br /&gt;
&lt;br /&gt;
Some of the highlights include:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;A BIOS/UEFI requirements document that containing recommendations to ensure firmware is compatible with the Linux kernel.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Getting started links describing how to download, install, configure and debug Ubuntu.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Links to certified hardware, debugging tools, SystemTap guides, packaging guides, kernel building notes.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Debugging tips, covering: hotkeys, suspend/resume, sound, X and wireless and an A5 sized Ubuntu Debugging booklet. &lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;Link to fwts-live, the Firmware Test Suite live image.&lt;/li&gt;
&lt;/ul&gt;
&amp;nbsp;..so lots of useful technical resources to call upon.&lt;br /&gt;
&lt;br /&gt;
Kudos to Chris Van Hoof for organizing this useful portal.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=VHq2F8T8hUc:LBMhG9ajC_8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=VHq2F8T8hUc:LBMhG9ajC_8:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=VHq2F8T8hUc:LBMhG9ajC_8:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=VHq2F8T8hUc:LBMhG9ajC_8:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=VHq2F8T8hUc:LBMhG9ajC_8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=VHq2F8T8hUc:LBMhG9ajC_8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=VHq2F8T8hUc:LBMhG9ajC_8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=VHq2F8T8hUc:LBMhG9ajC_8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=VHq2F8T8hUc:LBMhG9ajC_8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=VHq2F8T8hUc:LBMhG9ajC_8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=VHq2F8T8hUc:LBMhG9ajC_8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=VHq2F8T8hUc:LBMhG9ajC_8:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/VHq2F8T8hUc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/51924014006161429/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/06/ubuntu-odm-portal.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/51924014006161429?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/51924014006161429?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/VHq2F8T8hUc/ubuntu-odm-portal.html" title="Ubuntu ODM portal" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/06/ubuntu-odm-portal.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkEDRng5eip7ImA9WhVaFks.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-8440359231443041122</id><published>2012-06-01T20:21:00.003+01:00</published><updated>2012-06-14T08:57:57.622+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-06-14T08:57:57.622+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="disk" /><category scheme="http://www.blogger.com/atom/ns#" term="devices" /><category scheme="http://www.blogger.com/atom/ns#" term="benhmarking" /><category scheme="http://www.blogger.com/atom/ns#" term="Intel" /><title>Intel ® SSD 520 Goodness</title><content type="html">&lt;a href="http://3.bp.blogspot.com/-W0d6DyuR2-I/T8j_VNIYLrI/AAAAAAAAC7s/3m0dtwcvVgg/s1600/ssd.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="255" src="http://3.bp.blogspot.com/-W0d6DyuR2-I/T8j_VNIYLrI/AAAAAAAAC7s/3m0dtwcvVgg/s320/ssd.jpg" width="320" /&gt;&lt;/a&gt;I've been fortunate to get my hands on an Intel ® 520 2.5" 240GB Solid State Drive so I thought I'd put it through some relatively simple tests to see how well it performs.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;

















Power Consumption&lt;/h3&gt;
&lt;br /&gt;
My first round of tests involved seeing how well it performs in terms of power consumption compared to a typical laptop spinny Hard Disk Drive.&amp;nbsp; I rigged up a Lenovo X220i (i3-2350M @ 2.30GHz) running Ubuntu Precise 12.04 LTS (x86-64) to a Fluke 8846A precision digital multimeter and then compared the SSD with a 320GB Seagate ST320LT020-9YG142 HDD against some simple I/O tests.&amp;nbsp; Each test scenario was run 5 times and I based my results of the average of these 5 runs.&lt;br /&gt;
&lt;br /&gt;
The Intel ® 520 2.5" SSD fits into conventional drive bays but comes with a black plastic shim attached to one side that has to be first removed to reduce the height so that it can be inserted into the Lenovo X220i low profile drive bay. This is a trivial exercise and takes just a few moments with a suitable Phillips screwdriver.&amp;nbsp;&amp;nbsp; (As a bonus, the SSD also comes with a 3.5" adapter bracket and SATA 6.0 signal and power cables allowing it to be easily added into a Desktop too).&lt;br /&gt;
&lt;br /&gt;
In an idle state, the HDD pulled ~25mA more than the SSD, so in overall power consumption terms the SSD saves ~5%, (e.g. adds ~24 minutes life to an 8 hour battery).&lt;br /&gt;
&lt;br /&gt;
I then exercised the ext4 file system with &lt;i&gt;Bonnie++&lt;/i&gt; and measured the average current drawn during the run and using the idle "baseline" calculated the power consumed for the duration of the test.&amp;nbsp;&amp;nbsp;&amp;nbsp; The SSD draws more current than the HDD, however it ran the Bonnie++ test ~4.5 times faster and so the total power consumed to get the same task completed was less, typically &lt;b&gt;1/3&lt;/b&gt; of the power of the HDD. &lt;br /&gt;
&lt;br /&gt;
Using dd, I next wrote 16GB to the devices and found the SSD was ~5.3 times faster than the HDD and consumed ~ &lt;b&gt;1/3&lt;/b&gt; the power of the HDD.&amp;nbsp;&amp;nbsp;&amp;nbsp; For a 16GB read, the SSD was ~5.6 times faster than the HDD and used about &lt;b&gt;1/4&lt;/b&gt; the power of the HDD.&lt;br /&gt;
&lt;br /&gt;
Finally, using tiobench I calculated that the SSD was ~7.6 times faster than the HDD and again used about &lt;b&gt;1/4&lt;/b&gt; the power of the HDD.&lt;br /&gt;
&lt;br /&gt;
So, overall, very good power savings.&amp;nbsp; The caveat is that since the SSD consumes more power than the HDD per second (but gets way more I/O completed) one can use more power with the SSD if one is using continuous I/O &lt;i&gt;all&lt;/i&gt; the time.&amp;nbsp; &amp;nbsp; You do more, and it costs more; but you get it done faster, so like for like the SSD wins in terms of reducing power consumption. &lt;br /&gt;
&lt;h3&gt;

















&amp;nbsp;&lt;/h3&gt;
&lt;h3&gt;

















Boot Speed&lt;/h3&gt;
&lt;br /&gt;
Although ureadhead tries hard to optimize the inode and data reads during boot, the HDD is always going to perform badly because of seek latency and slow data transfer rates compared to any reasonable SSD.&amp;nbsp;&amp;nbsp; Using bootchart and five runs the average time to boot was ~7.9 seconds for the SSD and ~25.8 seconds for the HDD, so the SSD improved boot times by a factor of about 3.2 times.&amp;nbsp; Read rates were topping ~420 MB/sec which was good, but could have been higher for some (yet unknown) reason.&amp;nbsp; &lt;br /&gt;
&lt;h3&gt;

















&amp;nbsp;&lt;/h3&gt;
&lt;h3&gt;

















Palimpsest Performance Test&lt;/h3&gt;
&lt;br /&gt;
Palimpsest (aka "Disk Utility") has a quick and easy to use drive benchmarking facility that I used to measure the SSD read/write rates and access times.&amp;nbsp; Since writing to the drive destroys the file system I rigged the SSD up in a SATA3 capable desktop as a 2nd drive and then ran the tests.&amp;nbsp; Results are very impressive:&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://3.bp.blogspot.com/-lEKFuxI_SKE/T8j9B6Unv-I/AAAAAAAAC7k/7yVB0RQ0xDY/s1600/ssd-sata3.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="464" src="http://3.bp.blogspot.com/-lEKFuxI_SKE/T8j9B6Unv-I/AAAAAAAAC7k/7yVB0RQ0xDY/s640/ssd-sata3.png" width="640" /&gt;&lt;/a&gt;Average Read Rate: &lt;b&gt;535.8&lt;/b&gt; MB/sec&lt;br /&gt;
Average Write Rate: &lt;b&gt;539.5&lt;/b&gt; MB/sec&lt;br /&gt;
Average Access Time: sub &lt;b&gt;0.1 &lt;/b&gt;milliseconds.&lt;br /&gt;
&lt;br /&gt;
This is ~7 x faster in read/write speed and ~200-300 x faster in access time compared to the Seagate HDD.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;

















File System Benchmarks &lt;/h3&gt;
&lt;br /&gt;
So which file system performs best on the SSD?&amp;nbsp; Well, it depends on the use case. There are may different file system benchmarking tools available and each one addresses different types of file system behaviour.&amp;nbsp;&amp;nbsp; Which ever test I use it most probably won't match your use case(!)&amp;nbsp; Since SSDs have very small latency overhead it is worth exercising various file systems with multiple threaded I/O read/writes and see how well these perform.&amp;nbsp; I rigged up the threaded I/O benchmarking tool &lt;i&gt;tiobench&lt;/i&gt; to exercise ext2, ext3, ext4, xfs and btrfs while varying the number of threads from 1 to 128 in powers of 2.&amp;nbsp; In theory the SSD can do multiple random seeks very efficiently, so this type of testing should show the point where the SSD has optimal performance with multiple I/O requests.&lt;br /&gt;
&lt;h4&gt;

















&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;

















Sequential Read Rates&lt;/h4&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-p3QqK1HALFg/T8kDz6BCS9I/AAAAAAAAC74/ngmN5Faxeb0/s1600/tiobench-transfer-rate-sequential-reads.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="480" src="http://3.bp.blogspot.com/-p3QqK1HALFg/T8kDz6BCS9I/AAAAAAAAC74/ngmN5Faxeb0/s640/tiobench-transfer-rate-sequential-reads.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
Throughput peaks at 32-64 threads and xfs performs best followed by ext4, both are fairly close to the maximum device read rate.&amp;nbsp;&amp;nbsp; Interestingly btrfs performance is always almost level.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;

















Sequential Write Rates&lt;/h4&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-OKoy1r7WJyA/T8kEV_u0VlI/AAAAAAAAC8A/QaOWitvmnuk/s1600/tiobench-transfer-rate-sequential-writes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="480" src="http://3.bp.blogspot.com/-OKoy1r7WJyA/T8kEV_u0VlI/AAAAAAAAC8A/QaOWitvmnuk/s640/tiobench-transfer-rate-sequential-writes.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
xfs is consistently best, where as btrfs performs badly with the low thread count.&lt;br /&gt;
&lt;h4&gt;

















&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;

















Sequential Read Latencies&lt;/h4&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-WMsJffWvC28/T8kF943W06I/AAAAAAAAC8I/ByTKz48u-Pw/s1600/tiobench-latency-sequential-reads.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="480" src="http://3.bp.blogspot.com/-WMsJffWvC28/T8kF943W06I/AAAAAAAAC8I/ByTKz48u-Pw/s640/tiobench-latency-sequential-reads.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
These scale linearly with the number of threads and all file systems follow the same trend.&lt;br /&gt;
&lt;h4&gt;

















&lt;/h4&gt;
&lt;h4&gt;







&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;







&amp;nbsp;Sequential Write Latencies&lt;/h4&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-48LRcoMUPbc/T8kGi1190oI/AAAAAAAAC8Q/i8ivRY1Jjq8/s1600/tiobench-latency-sequential-writes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="480" src="http://4.bp.blogspot.com/-48LRcoMUPbc/T8kGi1190oI/AAAAAAAAC8Q/i8ivRY1Jjq8/s640/tiobench-latency-sequential-writes.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Again, linear scaling of latencies with number of threads.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;

















Random Read Rates&lt;/h4&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-GVCTs_DfqEQ/T8kG3N-xLmI/AAAAAAAAC8Y/XCXNrM97UEw/s1600/tiobench-transfer-rate-random-reads.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="480" src="http://4.bp.blogspot.com/-GVCTs_DfqEQ/T8kG3N-xLmI/AAAAAAAAC8Y/XCXNrM97UEw/s640/tiobench-transfer-rate-random-reads.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Again, best transfer rates seem to occur at with 32-64 threads, and btrfs does not seem to perform that well compared to ext2, ext3, ext4 and xfs &lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;

















Random Write Rates&lt;/h4&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-JH4srLufzkA/T8kHpCHPYBI/AAAAAAAAC8g/3AuBbVXyCZg/s1600/tiobench-transfer-rate-random-writes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="480" src="http://3.bp.blogspot.com/-JH4srLufzkA/T8kHpCHPYBI/AAAAAAAAC8g/3AuBbVXyCZg/s640/tiobench-transfer-rate-random-writes.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Interestingly ext2 and ext3 fair well with ext4 and xfs performing very similarly and btrfs performing worst again.&lt;br /&gt;
&lt;h4&gt;

















&lt;/h4&gt;
&lt;h4&gt;







&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;







Random Read Latencies&lt;/h4&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-kG07OWbwZ2I/T8kIDqeuD4I/AAAAAAAAC8o/nzuIhGL4ziM/s1600/tiobench-latency-random-reads.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="480" src="http://3.bp.blogspot.com/-kG07OWbwZ2I/T8kIDqeuD4I/AAAAAAAAC8o/nzuIhGL4ziM/s640/tiobench-latency-random-reads.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Again the linear scaling with latency as thread count increases with very similar performance between all file systems.&amp;nbsp; In this case, btrfs performs best.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;

















Random Write Latencies &lt;/h4&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-dSuErXDnrN4/T8kIgHEd_PI/AAAAAAAAC8w/v_9cdCXGfLw/s1600/tiobench-latency-random-writes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="480" src="http://2.bp.blogspot.com/-dSuErXDnrN4/T8kIgHEd_PI/AAAAAAAAC8w/v_9cdCXGfLw/s640/tiobench-latency-random-writes.jpg" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;
With random writes the latency is consistently flat, apart from the final data point for ext4 at 128 threads which could be just due to an anomaly.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;

















Which I/O scheduler should I use?&lt;/h3&gt;
&lt;h3&gt;







&amp;nbsp;&lt;/h3&gt;
Anecdotal evidence suggests using the noop scheduler should be best for an SSD.&amp;nbsp; In this test I exercised ext4, xfs and btrfs with Bonnie++ using the CFQ, Noop and Deadline schedulers.&amp;nbsp;&amp;nbsp; The tests were run 5 times and below are the averages of the 5 test runs.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;










ext4:&lt;/h4&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;table cellpadding="4"&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;CFQ&lt;/td&gt;&lt;td&gt;Noop&lt;/td&gt;&lt;td&gt;Deadline&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sequential Block Write (K/sec):&lt;/td&gt;&lt;td&gt;506046&lt;/td&gt;&lt;td&gt;513349&lt;/td&gt;&lt;td&gt;509893&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sequential Block Re-Write (K/sec):&lt;/td&gt;&lt;td&gt;213714&lt;/td&gt;&lt;td&gt;231265&lt;/td&gt;&lt;td&gt;217430&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sequentual Block Read (K/sec):&lt;/td&gt;&lt;td&gt;523525&lt;/td&gt;&lt;td&gt;551009&lt;/td&gt;&lt;td&gt;508774&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/center&gt;
&lt;br /&gt;
&lt;br /&gt;
So for ext4 on this SSD, Noop is a clear winner for sequential I/O.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;










xfs:&lt;/h4&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;table cellpadding="4"&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;CFQ&lt;/td&gt;&lt;td&gt;Noop&lt;/td&gt;&lt;td&gt;Deadline&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sequential Block Write (K/sec):&lt;/td&gt;&lt;td&gt;514219&lt;/td&gt;&lt;td&gt;514367&lt;/td&gt;&lt;td&gt;514815&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sequential Block Re-Write (K/sec):&lt;/td&gt;&lt;td&gt;229455&lt;/td&gt;&lt;td&gt;230845&lt;/td&gt;&lt;td&gt;252210&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sequentual Block Read (K/sec):&lt;/td&gt;&lt;td&gt;526971&lt;/td&gt;&lt;td&gt;550393&lt;/td&gt;&lt;td&gt;553543&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/center&gt;
&lt;br /&gt;
&lt;br /&gt;
It appears that Deadline for xfs seems to perform best for sequential I/O.&lt;br /&gt;
&lt;h4&gt;






&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;






btrfs:&lt;/h4&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;table cellpadding="4"&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;CFQ&lt;/td&gt;&lt;td&gt;Noop&lt;/td&gt;&lt;td&gt;Deadline&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sequential Block Write (K/sec):&lt;/td&gt;&lt;td&gt;511799&lt;/td&gt;&lt;td&gt;431700&lt;/td&gt;&lt;td&gt;430780&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sequential Block Re-Write (K/sec):&lt;/td&gt;&lt;td&gt;252210&lt;/td&gt;&lt;td&gt;253656&lt;/td&gt;&lt;td&gt;242291&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Sequentual Block Read (K/sec):&lt;/td&gt;&lt;td&gt;629640&lt;/td&gt;&lt;td&gt;655361&lt;/td&gt;&lt;td&gt;659538&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/center&gt;
&lt;br /&gt;
&lt;br /&gt;
And for btrfs, Noop is marginally better for sequential writes and re-writes but Deadline is best for reads.&lt;br /&gt;
&lt;br /&gt;
So it appears for sequential I/O operations, CFQ is the least optimal choice with Noop being a good choice for ext4, deadline for xfs and either for btrfs.&amp;nbsp;&amp;nbsp; However, this is just based on Sequential I/O testing and we should explore Random I/O testing before drawing any firm conclusions.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;






Conclusion&lt;/h3&gt;
&lt;h3&gt;





&amp;nbsp;&lt;/h3&gt;
As can be seen from the data, SSD provide excellent transfer rates, incredibly short latencies as well as a reducing power consumption.&amp;nbsp;&amp;nbsp; At the time of writing the cost per GB for an SSD is typically slightly more than £1 per GB which is around 5-7 times more expensive than a HDD.&amp;nbsp;&amp;nbsp;&amp;nbsp; Since I travel quite frequently and have damaged a couple of HDDs in the last few years the shock resistance, performance and power savings of the SSD are worth paying for.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZKmGnVrc9Q0:1wKAs3uuJ-Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZKmGnVrc9Q0:1wKAs3uuJ-Q:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZKmGnVrc9Q0:1wKAs3uuJ-Q:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=ZKmGnVrc9Q0:1wKAs3uuJ-Q:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZKmGnVrc9Q0:1wKAs3uuJ-Q:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=ZKmGnVrc9Q0:1wKAs3uuJ-Q:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZKmGnVrc9Q0:1wKAs3uuJ-Q:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZKmGnVrc9Q0:1wKAs3uuJ-Q:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=ZKmGnVrc9Q0:1wKAs3uuJ-Q:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZKmGnVrc9Q0:1wKAs3uuJ-Q:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=ZKmGnVrc9Q0:1wKAs3uuJ-Q:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=ZKmGnVrc9Q0:1wKAs3uuJ-Q:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/ZKmGnVrc9Q0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/8440359231443041122/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/06/intel-ssd-520-goodness.html#comment-form" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/8440359231443041122?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/8440359231443041122?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/ZKmGnVrc9Q0/intel-ssd-520-goodness.html" title="Intel ® SSD 520 Goodness" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-W0d6DyuR2-I/T8j_VNIYLrI/AAAAAAAAC7s/3m0dtwcvVgg/s72-c/ssd.jpg" height="72" width="72" /><thr:total>7</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/06/intel-ssd-520-goodness.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQHSH85eSp7ImA9WhVTGEU.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-5956781183891773729</id><published>2012-03-03T18:28:00.005Z</published><updated>2012-03-04T18:38:59.121Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-03-04T18:38:59.121Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="battery" /><title>Dell 1525 battery not charging</title><content type="html">My wife's &lt;a href="http://en.wikipedia.org/wiki/Dell_Inspiron_1525"&gt;Dell 1525&lt;/a&gt; Ubuntu laptop starting having battery problems last year and eventually we ended up with a totally dead Li-ion battery. &amp;nbsp; Fortunately I was able to acquire a clone replacement for about £25 which charged fine and worked for a week before becoming totally drained.&lt;br /&gt;
&lt;br /&gt;
According to some users, this happens because the charging circuitry has died, which was a little alarming since the machine was way out of warranty.&amp;nbsp; So I had a machine that runs fine on AC power, but the battery won't charge.&amp;nbsp;&amp;nbsp; So I slept on the problem and this morning I thought I'd try another spare Dell AC adapter just to factor out the AC power supply.&amp;nbsp; To my surprise the battery started charging, so I had to conclude the problem is simply due to a broken AC power supply.&lt;br /&gt;
&lt;br /&gt;
So if the AC power supply is not charging, perhaps the original battery wasn't dead after all.&amp;nbsp; I plugged in the old battery, gave it an hour to charge but found it really was dead and useless.&lt;br /&gt;
&lt;br /&gt;
I've compared the characteristics of the working power supply against the broken one with a multimeter and I cannot see any difference, which strikes me a little curious. &amp;nbsp; If anyone has any ideas why one works and other other doesn't please let me know!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;UPDATE &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
After a bit of research I found a relevant article at laptop-junction.com &lt;a href="http://www.laptop-junction.com/toast/content/battery-not-charging"&gt;[1]&lt;/a&gt; that describes the AC adapter battery charging issue.&amp;nbsp;&amp;nbsp; So it seems that this is a common issue &lt;a href="http://www.laptop-junction.com/toast/content/dell-ac-power-adapter-not-recognized"&gt;[2]&lt;/a&gt;&amp;nbsp; for a bunch of AC adapters and the author suggests a possible design issue &lt;a href="http://www.laptop-junction.com/toast/content/dell-ac-power-adapter-id-chip-died"&gt;[3]&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
References:&lt;br /&gt;
&lt;br /&gt;
[1] &lt;a href="http://www.laptop-junction.com/toast/content/battery-not-charging"&gt;http://www.laptop-junction.com/toast/content/battery-not-charging&lt;/a&gt;&lt;br /&gt;
[2] &lt;a href="http://www.laptop-junction.com/toast/content/dell-ac-power-adapter-not-recognized"&gt;http://www.laptop-junction.com/toast/content/dell-ac-power-adapter-not-recognized&lt;/a&gt;&lt;br /&gt;
[3] &lt;a href="http://www.laptop-junction.com/toast/content/dell-ac-power-adapter-id-chip-died"&gt;http://www.laptop-junction.com/toast/content/dell-ac-power-adapter-id-chip-died&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=93tgoquRjcw:6_KzfBNYgiI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=93tgoquRjcw:6_KzfBNYgiI:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=93tgoquRjcw:6_KzfBNYgiI:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=93tgoquRjcw:6_KzfBNYgiI:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=93tgoquRjcw:6_KzfBNYgiI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=93tgoquRjcw:6_KzfBNYgiI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=93tgoquRjcw:6_KzfBNYgiI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=93tgoquRjcw:6_KzfBNYgiI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=93tgoquRjcw:6_KzfBNYgiI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=93tgoquRjcw:6_KzfBNYgiI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=93tgoquRjcw:6_KzfBNYgiI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=93tgoquRjcw:6_KzfBNYgiI:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/93tgoquRjcw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/5956781183891773729/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/03/dell-1525-battery-not-charging.html#comment-form" title="14 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5956781183891773729?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5956781183891773729?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/93tgoquRjcw/dell-1525-battery-not-charging.html" title="Dell 1525 battery not charging" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>14</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/03/dell-1525-battery-not-charging.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MCQHwzeyp7ImA9WhVTF0Q.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-4391199876209269600</id><published>2012-02-25T15:50:00.004Z</published><updated>2012-03-03T18:31:01.283Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-03-03T18:31:01.283Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="power" /><category scheme="http://www.blogger.com/atom/ns#" term="graphics" /><category scheme="http://www.blogger.com/atom/ns#" term="testing" /><category scheme="http://www.blogger.com/atom/ns#" term="Intel" /><title>RC6 Call for testing in Ubuntu 12.04 Precise Pangolin LTS, part 2</title><content type="html">The Ubuntu Kernel Team has uploaded a new kernel (3.2.0-17.27) which contains an additional fix to resolve the remaining issues seen with the RC6 power saving enabled. For users with Sandy Bridge based hardware we would appreciate them to run the tests described on &lt;a href="https://wiki.ubuntu.com/Kernel/PowerManagementRC6"&gt;https://wiki.ubuntu.com/Kernel/PowerManagementRC6&lt;/a&gt; and add their results to that page.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=1Fb2tlqTmR8:rBRYuJ6TpnI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=1Fb2tlqTmR8:rBRYuJ6TpnI:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=1Fb2tlqTmR8:rBRYuJ6TpnI:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=1Fb2tlqTmR8:rBRYuJ6TpnI:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=1Fb2tlqTmR8:rBRYuJ6TpnI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=1Fb2tlqTmR8:rBRYuJ6TpnI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=1Fb2tlqTmR8:rBRYuJ6TpnI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=1Fb2tlqTmR8:rBRYuJ6TpnI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=1Fb2tlqTmR8:rBRYuJ6TpnI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=1Fb2tlqTmR8:rBRYuJ6TpnI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=1Fb2tlqTmR8:rBRYuJ6TpnI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=1Fb2tlqTmR8:rBRYuJ6TpnI:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/1Fb2tlqTmR8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/4391199876209269600/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/02/rc6-call-for-testing-in-ubuntu-1204_25.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/4391199876209269600?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/4391199876209269600?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/1Fb2tlqTmR8/rc6-call-for-testing-in-ubuntu-1204_25.html" title="RC6 Call for testing in Ubuntu 12.04 Precise Pangolin LTS, part 2" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/02/rc6-call-for-testing-in-ubuntu-1204_25.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIGQnYyeSp7ImA9WhRaFkU.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-3642851402871130265</id><published>2012-02-19T19:54:00.001Z</published><updated>2012-02-19T20:32:03.891Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-19T20:32:03.891Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="power" /><category scheme="http://www.blogger.com/atom/ns#" term="graphics" /><category scheme="http://www.blogger.com/atom/ns#" term="testing" /><category scheme="http://www.blogger.com/atom/ns#" term="Intel" /><title>RC6 Call for testing in Ubuntu 12.04 Precise Pangolin LTS</title><content type="html">The Ubuntu Kernel Team has released a call for testing for a set of RC6 power saving patches for Ubuntu 12.04 Precise Pangolin LTS. Quoting Leann Ogasawara's email to the ubuntu kernel team and ubuntu-devel mailing lists:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;"Hi All,&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;RC6 is a technology which allows the GPU to go into a very low power consumption state when the GPU is idle (down to 0V). It results in considerable power savings when this stage is activated. When comparing under idle loads with machine state where RC6 is disabled, improved power usage of around 40-60% has been witnessed &lt;a href="http://phoronix.com/forums/showthread.php?68199-Intel-Wants-YOUR-Linux-Questions-Feedback&amp;amp;p=246785#post246785"&gt;[1].&lt;/a&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Up until recently, RC6 was disabled by default for Sandy Bridge systems due to reports of hangs and graphics corruption issues when RC6 was enabled.  Intel has now asserted that RC6p (deep RC6) is responsible for the RC6 related issues on Sandy Bridge. As a result, a patch has recently been submitted upstream to disable RC6p for Sandy Bridge &lt;a href="http://lists.freedesktop.org/archives/intel-gfx/2012-February/015131.html"&gt;[2]&lt;/a&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;In an effort to provide more exposure and testing for this proposed patch, the Ubuntu Kernel Team has applied this patch to 3.2.0-17.26 and newer Ubuntu 12.04 Precise Pangolin kernels.  We have additionally enabled plain RC6 by default on Sandy Bridge systems so that users can benefit from the improved power savings by default.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;We have decided to post a widespread call for testing from Sandy Bridge owners running Ubuntu 12.04.  We hope to capture data which supports the the claims of power saving improvements and therefore justify keeping these patches in the Ubuntu 12.04 kernel.  We also want to ensure we do not trigger any issues due to plain RC6 being enabled by default for Sandy Bridge.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;If you are running Ubuntu 12.04 (Precise Pangolin) and willing to test and provide feedback, please refer to our PowerManagementRC6 wiki for detailed instructions &lt;a href="https://wiki.ubuntu.com/Kernel/PowerManagementRC6"&gt;[3]&lt;/a&gt;.  Additionally, instructions for reporting any issues with RC6 enabled are also noted on the wiki.  We would really appreciate any testing and feedback users are able to provide.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Thanks in advance,&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;The Ubuntu Kernel Team"&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
So please contribute to this call for testing by visiting &lt;a href="https://wiki.ubuntu.com/Kernel/PowerManagementRC6"&gt;https://wiki.ubuntu.com/Kernel/PowerManagementRC6&lt;/a&gt; and follow the instructions.&amp;nbsp; Thank you!&lt;br /&gt;
&lt;pre&gt;&lt;/pre&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=3w1CSQ5THYw:9aGaSFWGM1c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=3w1CSQ5THYw:9aGaSFWGM1c:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=3w1CSQ5THYw:9aGaSFWGM1c:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=3w1CSQ5THYw:9aGaSFWGM1c:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=3w1CSQ5THYw:9aGaSFWGM1c:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=3w1CSQ5THYw:9aGaSFWGM1c:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=3w1CSQ5THYw:9aGaSFWGM1c:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=3w1CSQ5THYw:9aGaSFWGM1c:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=3w1CSQ5THYw:9aGaSFWGM1c:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=3w1CSQ5THYw:9aGaSFWGM1c:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=3w1CSQ5THYw:9aGaSFWGM1c:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=3w1CSQ5THYw:9aGaSFWGM1c:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/3w1CSQ5THYw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/3642851402871130265/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/02/rc6-call-for-testing-in-ubuntu-1204.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/3642851402871130265?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/3642851402871130265?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/3w1CSQ5THYw/rc6-call-for-testing-in-ubuntu-1204.html" title="RC6 Call for testing in Ubuntu 12.04 Precise Pangolin LTS" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/02/rc6-call-for-testing-in-ubuntu-1204.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQAQHc4cSp7ImA9WhRaFEo.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-312349202685747382</id><published>2012-02-17T10:17:00.003Z</published><updated>2012-02-17T10:25:41.939Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-17T10:25:41.939Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="fwts" /><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="USB" /><title>Introducing the Firmware Test Suite Live (fwts-live)</title><content type="html">Firmware Test Suite Live (fwts-live) is a USB live image that will automatically boot and run the &lt;a href="https://wiki.ubuntu.com/Kernel/Reference/fwts"&gt;Firmware Test Suite&lt;/a&gt; (fwts) - it will run on legacy BIOS and also UEFI firmware (x86_64) bit systems.&lt;br /&gt;
&lt;br /&gt;
fwts-live will run a range of fwts tests and store the results on the USB stick - these can be reviewed while running fwts-live or at a later time on another computer if required.&lt;br /&gt;
&lt;br /&gt;
To install fwts-live on to a USB first download either a 32 or 64 bit image from &lt;a href="http://odm.ubuntu.com/fwts-live/"&gt;http://odm.ubuntu.com/fwts-live/&lt;/a&gt; and then uncompress the image using:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; bunzip2 fwts-live-*.img.bz2  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
Next insert a USB stick into your machine and unmount it. Now one has to copy the fwts-live image to the USB stick - one can find the USB device using:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; dmesg | tail -10 | grep Attached  
 [ 2525.654620] sd 6:0:0:0: [sdb] Attached SCSI removable disk  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
..so the above example it is /dev/sdb, and copy using:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; sudo dd if=fwts-live-oneiric-*.img of=/dev/sdb  
 sync  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
..and then remove the USB stick.&lt;br /&gt;
&lt;br /&gt;
To run, insert the USB stick into the machine you want to test and then boot the machine.&amp;nbsp; This will start up fwts-live and then you will be shown a set of options - to either run all the fwts batch tests, to select individual tests to run, or abort testing and shutdown.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-uoZ4V-WVyfM/Tz4jAaA7ggI/AAAAAAAACNI/KkL3Ynz1gDc/s1600/fwts-live-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://1.bp.blogspot.com/-uoZ4V-WVyfM/Tz4jAaA7ggI/AAAAAAAACNI/KkL3Ynz1gDc/s400/fwts-live-2.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
If you chose to run all the fwts batch tests then fwts will automatically run through a series of tests which will take a few minutes to complete:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-wUCGu_0ccTE/Tz4jMuRVpUI/AAAAAAAACNQ/bHajWwTtJf8/s1600/fwts-live-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="297" src="http://1.bp.blogspot.com/-wUCGu_0ccTE/Tz4jMuRVpUI/AAAAAAAACNQ/bHajWwTtJf8/s400/fwts-live-3.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
and when complete one can chose to view the results log:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-C4tlDXr0F_Y/Tz4jgi_51ZI/AAAAAAAACNY/mTHJz8XvR3o/s1600/fwts-live-4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://2.bp.blogspot.com/-C4tlDXr0F_Y/Tz4jgi_51ZI/AAAAAAAACNY/mTHJz8XvR3o/s400/fwts-live-4.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
if "Yes" is selected then one can view the results. The cursor up/down and page up/down keys can be used to navigate the results log file.&amp;nbsp; When you have completed viewing the results log, fwts-live will inform you where the results have been saved on the USB stick (so that one can review them later by plugging the USB stick into a different machine).&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-hTF1g3ItTF8/Tz4kYH-VNeI/AAAAAAAACNo/MRh6KWi86eM/s1600/fwts-live-6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="http://3.bp.blogspot.com/-hTF1g3ItTF8/Tz4kYH-VNeI/AAAAAAAACNo/MRh6KWi86eM/s400/fwts-live-6.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
A full user guide to fwts-live is available at: &lt;a href="https://wiki.ubuntu.com/HardwareEnablementTeam/Documentation/FirmwareTestSuiteLive"&gt;https://wiki.ubuntu.com/HardwareEnablementTeam/Documentation/FirmwareTestSuiteLive&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
To help interpret any errors or warnings found by fwts we recommend visiting&amp;nbsp; &lt;a href="https://wiki.ubuntu.com/Kernel/Reference/fwts"&gt;fwts reference guide&lt;/a&gt; - this is has comprehensive description of each test and detailed explanations of warnings and error messages.&lt;br /&gt;
&lt;br /&gt;
Below is a demo of fwts-live running inside QEMU:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&amp;nbsp;&lt;object width="480" height="366" class="BLOG_video_class" id="BLOG_video-15ec03be8ad99a3b" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="//www.youtube.com/get_player"&gt;
&lt;param name="bgcolor" value="#FFFFFF"&gt;
&lt;param name="allowfullscreen" value="true"&gt;
&lt;param name="flashvars" value="flvurl=http://redirector.googlevideo.com/videoplayback?id%3D15ec03be8ad99a3b%26itag%3D5%26source%3Dblogger%26app%3Dblogger%26cmo%3Dsensitive_content%253Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1371033017%26sparams%3Did,itag,source,ip,ipbits,expire%26signature%3D265853ACDFF0DDD3F8AEB6E04450933B4EB0199F.56341C17C9FA4E3E36AA3CB5945B2529C2F8804D%26key%3Dck2&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D15ec03be8ad99a3b%26offsetms%3D5000%26itag%3Dw160%26sigh%3Dx9uIwGHjp346bbVCAPVMMmuKyoI&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;
&lt;embed src="//www.youtube.com/get_player" type="application/x-shockwave-flash"
width="480" height="366" bgcolor="#FFFFFF"
flashvars="flvurl=http://redirector.googlevideo.com/videoplayback?id%3D15ec03be8ad99a3b%26itag%3D5%26source%3Dblogger%26app%3Dblogger%26cmo%3Dsensitive_content%253Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1371033017%26sparams%3Did,itag,source,ip,ipbits,expire%26signature%3D265853ACDFF0DDD3F8AEB6E04450933B4EB0199F.56341C17C9FA4E3E36AA3CB5945B2529C2F8804D%26key%3Dck2&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D15ec03be8ad99a3b%26offsetms%3D5000%26itag%3Dw160%26sigh%3Dx9uIwGHjp346bbVCAPVMMmuKyoI&amp;autoplay=0&amp;ps=blogger"
allowFullScreen="true" /&gt;&lt;/object&gt;
&lt;/div&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;Kudos to Chris Van Hoof for producing fwts-live&lt;/pre&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=f1PQUUyXu1k:NELIx7j99XE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=f1PQUUyXu1k:NELIx7j99XE:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=f1PQUUyXu1k:NELIx7j99XE:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=f1PQUUyXu1k:NELIx7j99XE:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=f1PQUUyXu1k:NELIx7j99XE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=f1PQUUyXu1k:NELIx7j99XE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=f1PQUUyXu1k:NELIx7j99XE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=f1PQUUyXu1k:NELIx7j99XE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=f1PQUUyXu1k:NELIx7j99XE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=f1PQUUyXu1k:NELIx7j99XE:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=f1PQUUyXu1k:NELIx7j99XE:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=f1PQUUyXu1k:NELIx7j99XE:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/f1PQUUyXu1k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/312349202685747382/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/02/introducing-firmware-test-suite-live.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/312349202685747382?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/312349202685747382?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/f1PQUUyXu1k/introducing-firmware-test-suite-live.html" title="Introducing the Firmware Test Suite Live (fwts-live)" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-uoZ4V-WVyfM/Tz4jAaA7ggI/AAAAAAAACNI/KkL3Ynz1gDc/s72-c/fwts-live-2.png" height="72" width="72" /><thr:total>4</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/02/introducing-firmware-test-suite-live.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8ASXYzeip7ImA9WhRbGE4.&quot;"><id>tag:blogger.com,1999:blog-1016709139053396535.post-5219332294892942400</id><published>2012-02-01T15:19:00.001Z</published><updated>2012-02-10T00:30:48.882Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-10T00:30:48.882Z</app:edited><title>3G using a Huawei E1552/E1800 (HSPA modem) on Ubuntu</title><content type="html">So my internet service provider is rolling out a programme of speed upgrades and over the past few weeks I've suffered from various connectivity issues most probably because of infrastructure upgrades.&amp;nbsp;&amp;nbsp; I lost connectivity today at 6am and was told to expect to be connected by 9pm, so I popped down town and acquired a 3G USB dongle and a suitable data plan/ contract for my needs.&lt;br /&gt;
&lt;br /&gt;
Typically these USB dongles are designed to appear as USB media devices (e.g. pseudo CD-ROM) and one has to mode switch it to a USB modem.&amp;nbsp;&amp;nbsp; Unfortunately I had a Huawei E1552/E1800 which required some USB mode switching magic, but to find this I first required internet connectivity.&amp;nbsp;&amp;nbsp; Fortunately I had a sacrificial laptop which I installed an old version of Windows XP which allowed me to then connect to the internet using the 3G USB dongle and I was able to then track down the appropriate runes.&amp;nbsp; OK, I feel bad about installing Windows XP, but I was being pragmatic - I needed connectivity!&lt;br /&gt;
&lt;br /&gt;
The procedure to get this device working on Ubuntu wasn't too bad.&amp;nbsp; First I identified the USB dongle using lsusb to get the vendor and product IDs (12d1:1446):&lt;br /&gt;
&lt;br /&gt;
Bus 002 Device 013: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800 (HSPA modem)&lt;br /&gt;
&lt;br /&gt;
Then I added the following runes to /etc/usb_modeswitch.conf -&lt;br /&gt;
&lt;br /&gt;
&lt;pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"&gt;&lt;code style="color: black; word-wrap: normal;"&gt; DefaultVendor= 0x12d1  
 DefaultProduct=0x1446  
 TargetVendor= 0x12d1  
 TargetProductList="1001,1406,140b,140c,141b,14ac"  
 CheckSuccess=20  
 MessageContent="55534243123456780000000000000011060000000000000000000000000000"  
&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
..this appears in many forums on the internet, kudos to whoever figured this out.&lt;br /&gt;
&lt;br /&gt;
Then I ran "sudo usb_modeswitch -c /etc/usb_modeswitch.conf" and this switched the dongle into:&lt;br /&gt;
&lt;br /&gt;
Bus 002 Device 012: ID 12d1:14ac Huawei Technologies Co., Ltd. &lt;br /&gt;
&lt;br /&gt;
..and I was then able to simply connect using network manager.&amp;nbsp;&amp;nbsp; Result!&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;** UPDATE **&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Mathieu Trudel-Lapierre fixed this (9th Feb 2012) and now Ubuntu Precise works perfectly with the&amp;nbsp; Huawei E1552/E1800.&amp;nbsp; Thanks Mathieu!&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=r90WIzp8xrk:D_SBd5HFS_c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=r90WIzp8xrk:D_SBd5HFS_c:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=r90WIzp8xrk:D_SBd5HFS_c:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=r90WIzp8xrk:D_SBd5HFS_c:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=r90WIzp8xrk:D_SBd5HFS_c:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=r90WIzp8xrk:D_SBd5HFS_c:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=r90WIzp8xrk:D_SBd5HFS_c:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=r90WIzp8xrk:D_SBd5HFS_c:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=r90WIzp8xrk:D_SBd5HFS_c:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=r90WIzp8xrk:D_SBd5HFS_c:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?i=r90WIzp8xrk:D_SBd5HFS_c:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?a=r90WIzp8xrk:D_SBd5HFS_c:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/ASmackerelOfOpinion?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ASmackerelOfOpinion/~4/r90WIzp8xrk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://smackerelofopinion.blogspot.com/feeds/5219332294892942400/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://smackerelofopinion.blogspot.com/2012/02/3g-using-huawei-e1552e1800-hspa-modem.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5219332294892942400?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1016709139053396535/posts/default/5219332294892942400?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/ASmackerelOfOpinion/~3/r90WIzp8xrk/3g-using-huawei-e1552e1800-hspa-modem.html" title="3G using a Huawei E1552/E1800 (HSPA modem) on Ubuntu" /><author><name>Colin Ian King</name><uri>http://www.blogger.com/profile/06458723239721015750</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_ntZG0QtAV-A/Sox92Bkf-QI/AAAAAAAAAKQ/v02pT5ytNz8/S220/cik.gif" /></author><thr:total>5</thr:total><feedburner:origLink>http://smackerelofopinion.blogspot.com/2012/02/3g-using-huawei-e1552e1800-hspa-modem.html</feedburner:origLink></entry></feed>
