<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>Nat!&apos;s Web Journal</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/" />
   <link rel="self" type="application/atom+xml" href="http://www.mulle-kybernetik.com/weblog/atom.xml" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7</id>
   <updated>2012-05-06T16:11:01Z</updated>
   
   <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.34-en</generator>


<entry>
   <title>Mettigel Apotheosis</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2012/05/mettigel_apotheosis.html" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7.1234</id>
   
   <published>2012-05-06T16:03:44Z</published>
   <updated>2012-05-06T16:11:01Z</updated>
   
   <summary> I achieved my last remaining goal. I made it! 999,999,999 in Ducks. It took a lot of practicing to get it. It&apos;s quite possible, that I will resign from playing Rocksmith now....</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[<img height="360" style="margin: 5px" width="480" alt="" src="http://www.mulle-kybernetik.com/weblog/ducks-999.jpg" />
<p>I achieved my last remaining goal. I made it! 999,999,999 in Ducks. It took a <strong>lot</strong> of practicing to get it. It's quite possible, that I will resign from playing Rocksmith now.</p>
<p></p>
]]>
      
   </content>
</entry>

<entry>
   <title>No more non-removable battery products for me</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2012/03/no_more_non-removable_battery.html" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7.1233</id>
   
   <published>2012-03-31T21:40:19Z</published>
   <updated>2012-03-31T21:44:59Z</updated>
   
   <summary>(unless I need it as a development target). I&apos;ve decided, that I will not buy another product with a battery that can not be removed or that doesn&apos;t have an on/off switch so that power can be cut. It&apos;s a...</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      (unless I need it as a development target). I&apos;ve decided, that I will not buy another product with a battery that can not be removed or that doesn&apos;t have an on/off switch so that power can be cut.

It&apos;s a matter of principle. If I want to turn of the juice, then I decide, and no buggy hardware can interfere. Right this moment I have a Macbook Air, which is just stuck. I know in about an hour it will be good enough to boot again. 


      
   </content>
</entry>

<entry>
   <title>Mettigel Supertrumpf</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2012/03/mettigel_supertrumpf.html" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7.1232</id>
   
   <published>2012-03-29T23:41:43Z</published>
   <updated>2012-03-31T09:09:38Z</updated>
   
   <summary>So now I am also the benign ruler of Big Swing Baseball, the last of the six Rocksmith games I wanted to dominate. This was a good fight with Ikel_The_Frog. My last remaining goal is to score 999.999.999. on Ducks....</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[So now I am also the benign ruler of Big Swing Baseball, the last of the six Rocksmith games I wanted to dominate. This was a good fight with Ikel_The_Frog.<p>
My last remaining goal is to score 999.999.999. on Ducks. Current highscore is 690.000.000 but it wasn't saved, because the internet connection failed :(
<p><img height="360" width="480" style="margin: 5px" alt="" src="http://www.mulle-kybernetik.com/weblog/DSCF7062.jpg" /></p>
]]>
      
   </content>
</entry>

<entry>
   <title>Reign in Mett</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2012/03/reign_in_mett.html" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7.1231</id>
   
   <published>2012-03-16T00:13:48Z</published>
   <updated>2012-03-16T00:13:54Z</updated>
   
   <summary>I am enjoying a comfortable reign in the Ducks game. I finally pushed through to level 39 and I can almost taste 40, where I hope, I hit 999.999.999. I added another game to my kingdom: Dawn of the Chordead....</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[I am enjoying a comfortable reign in the Ducks game. I finally pushed through to level 39 and I can almost taste 40, where I hope, I hit 999.999.999.

<img src="http://www.mulle-kybernetik.com/weblog//DSCF7042.JPG" alt="DSCF7042" title="DSCF7042.JPG" border="0" width="480" height="360" />

I added another game to my kingdom: Dawn of the Chordead. Not sure how long that will last though. I guess at some time I want to see level 100.

<img src="http://www.mulle-kybernetik.com/weblog//DSCF7039.JPG" alt="DSCF7039" title="DSCF7039.JPG" border="0" width="480" height="360" />

My goal of 1000 chains in Superslider was reached, a good thing because there's a revolt brewing…

<img src="http://www.mulle-kybernetik.com/weblog//DSCF7045.JPG" alt="DSCF7045" title="DSCF7045.JPG" border="0" width="480" height="360" />

I had to fight a bit to keep Scale Runner in my possession. I'd think in a pinch, there is a million or so I can still make.

<img src="http://www.mulle-kybernetik.com/weblog//DSCF7044.JPG" alt="DSCF7044" title="DSCF7044.JPG" border="0" width="480" height="360" />

The Superducks #1 slot is still secure, because I played to level #41.

<img src="http://www.mulle-kybernetik.com/weblog//DSCF7043.JPG" alt="DSCF7043" title="DSCF7043.JPG" border="0" width="480" height="360" />

Finally I am trying to conquer the sixth and most complicated mini-game Big Swing Baseball. but I am only #2:

 <img src="http://www.mulle-kybernetik.com/weblog//DSCF7041.JPG" alt="DSCF7041" title="DSCF7041.JPG" border="0" width="480" height="360" />

]]>
      
   </content>
</entry>

<entry>
   <title>LOL @ SPON</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2012/03/lol_spon.html" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7.1230</id>
   
   <published>2012-03-01T20:12:33Z</published>
   <updated>2012-03-01T20:33:18Z</updated>
   
   <summary>Ausgerechnet der SPIEGEL. Auf der einen Seite nervt einen Sohnemann Augstein mit seinem altjüngerferlichen Moralisierungsblog, das päpstlicher als der Papst ist. Aber hintenrum verkloppt der SPIEGEL einfach Promo-CDs, die ihm geschickt werden. Am besten wäre, jetzt jeden Tag einen neuen...</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[Ausgerechnet der SPIEGEL. Auf der einen Seite nervt einen Sohnemann Augstein mit seinem altjüngerferlichen Moralisierungsblog, das päpstlicher als der Papst ist. Aber hintenrum verkloppt <a href="http://www.36music.de/!/offenerBrief.html">der SPIEGEL einfach Promo-CDs, die ihm geschickt werden</a>.
<p>
Am besten wäre, jetzt jeden Tag einen neuen Artikel darüber zu schreiben. Der Fundus an verhökertem Promomaterial sollte ja unerschöpflich sein. Wenn es mal nichts neues gibt, dann halt Reaktionen zu den vorigen Artikeln von Gegnern und Geschädigten des SPIEGELs sammeln. Dann damit wieder den SPIEGEL konfrontieren.
<p>
Egal wie der SPIEGEL reagiert, es kann nur zuwenig oder ganz falsch sein. Da haben wir dann den nächsten Artikel. Ev. auch mal ein Artikel über Nepotismus einstreuen. Wieder Reaktionen sammeln, usw. pp.
<p>
Endgame wäre dann der Rücktritt eines Verantworlichen. Und die Welt wäre wieder ein besserer Ort.

 
]]>
      
   </content>
</entry>

<entry>
   <title>Mettigel Rising</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2012/02/mettigel_rising.html" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7.1229</id>
   
   <published>2012-02-17T00:45:51Z</published>
   <updated>2012-02-17T01:15:56Z</updated>
   
   <summary><![CDATA[(not Lucifer rising :) I finally got a score of 383M in Rocksmith's Guitarcade game &quot;Ducks&quot;, thats going to be hard to beat. It's hard for me to get even get near the score, though I score in 100M-200M range...]]></summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[(not <a href="http://video.google.com/videoplay?docid=1710883728662460695">Lucifer rising</a> :) 
<p>I finally got a score of 383M in Rocksmith's Guitarcade game &quot;Ducks&quot;, thats going to be hard to beat. It's hard for me to get even get near the score, though I score in 100M-200M range consistently. But i have a dream, and that's 999M.</p>
<p><img height="375" style="margin: 5px" width="500" alt="" src="http://www.mulle-kybernetik.com/weblog/ducks-2.jpg" /></p>
<p></p>
<p>With a lot of effort i finally nabbed first place in Scale Runner too. I think the theoretical maximum is 165M, so there is still room for improvement.</p>
<p><img height="375" style="margin: 5px" width="500" alt="" src="http://www.mulle-kybernetik.com/weblog/scalerunner.jpg" /></p>
<p></p>
<p>Finally Super Slider is all mine, though the next guy seems to be trying to change that. Playing to level 255 is an affair that takes an hour or so. There is no maximum in this game it's more a question of stamina. Maybe I should target 1000 chains here.</p>
<p><img height="375" style="margin: 5px" width="500" alt="" src="http://www.mulle-kybernetik.com/weblog/super_slider.jpg" /></p>
<p></p>
<p></p>
]]>
      
   </content>
</entry>

<entry>
   <title>Importing CVS into git on Mac OS X</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2012/02/importing_cvs_into_git_on_mac.html" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7.1228</id>
   
   <published>2012-02-15T12:04:21Z</published>
   <updated>2012-02-16T09:59:21Z</updated>
   
   <summary>It&apos;s pretty simple, but you need to set some git config variables to make the import go smoothly. First up, you need cvsps. The currently stable cvsps version 2.1 works better with the git version 1.7.4.4, that Xcode gave me,...</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[It's pretty simple, but you need to set some <a href="http://git-scm.com/">git</a> config variables to make the import go  smoothly.
<p>
First up, you need <a href="http://www.cobite.com/cvsps/">cvsps</a>. The currently stable <b>cvsps</b> version 2.1 works better with the <b>git</b> version 1.7.4.4, that <b>Xcode</b> gave me, so <a href="http://www.cobite.com/cvsps/cvsps-2.1.tar.gz">download</a> it.
<p>
Building <b>cvsps</b> is just <tt>make</tt> and installing into <tt>/usr/local</tt> is just <tt>sudo make install</tt>
<p>
Then get your <a href="http://durak.org/cvswebsites/howto-cvs/node9.html">CVSROOT</a> environment variable set properly.
<p>
Finally you need to configure some variables in <b>git</b>, as they may be set to values, that preclude a working import. Here 's a shell script, which isn't foolproof, but useful enough.
<pre>#! /bin/sh

rm -rf .git

#
# my settings
# core.autocrlf=input
# core.safecrlf=true
#

old_autocrlf=`git config --get core.autocrlf`
old_safecrlf=`git config --get core.safecrlf`
old_encoding=`git config --get i18n.commitencoding`

git config --global core.autocrlf  false
git config --global core.safecrlf  false
git config --global i18n.commitencoding MacRoman

git cvsimport $*

if [ "$old_autocrlf" != "" ]
then
   git config --global core.autocrlf "$old_autocrlf"
else
   git config --global --unset core.autocrlf
fi

if [ "$old_safecrlf" != "" ]
then
   git config --global core.safecrlf "$old_safecrlf"
else
   git config --global --unset core.safecrlf
fi

if [ "$old_encoding" != "" ]
then
   git config --global i18n.commitencoding "$old_encoding"
else
   git config --global --unset i18n.commitencoding
fi
</pre>
]]>
      
   </content>
</entry>

<entry>
   <title>My Kimble Moment with Ducks and Superducks in Rocksmith (PS3)</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2012/02/my_kimble_moment_with_ducks_an.html" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7.1227</id>
   
   <published>2012-02-09T00:18:50Z</published>
   <updated>2012-02-09T00:40:02Z</updated>
   
   <summary><![CDATA[But I didn't get no cake.  Actually a score &lt; 100 million is not that great for me, but it seems to be good enough for the world. Ok. 999.999.999 is pretty much unbeatable, but getting it in Superducks is...]]></summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[But I didn't <a href="http://www.youtube.com/watch?v=l-ltcCF_cAQ">get no cake</a>.  
<p><img height="390" style="margin: 5px" width="500" alt="" src="http://www.mulle-kybernetik.com/weblog/ducks.jpg" /></p>
<p>Actually a score &lt; 100 million is not that great for me, but it seems to be good enough for the world. </p>
<p><img height="367" style="margin: 5px" width="500" alt="" src="http://www.mulle-kybernetik.com/weblog/superducks.jpg" /></p>
<p>Ok. 999.999.999 is pretty much unbeatable, but getting it in Superducks is not really that hard. But I don't want to second guess these results too much :)</p>
I stole my moniker from <a href="http://www.youtube.com/watch?v=ZAnwMgzl0pY">these guys</a>.
]]>
      
   </content>
</entry>

<entry>
   <title>Using --eh-frame-header when using -fobjc-exceptions GNU/Linux: good, but not necessarily good enough</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2012/01/using_--eh-frame-header_when_u.html" />
   <id>tag:www.mulle-kybernetik.com,2012:/weblog//7.1226</id>
   
   <published>2012-01-06T16:41:37Z</published>
   <updated>2012-01-07T12:14:09Z</updated>
   
   <summary>This is on Linux, with the gcc compiler (4.6). Not OS X. When you compile code with -fobjc-exceptions, you presumably do that to somewhere execute a throw. Lets say, this is my callstack: abort// glibc objc_exception_throw// libobjc -[MyClass methodThrowingAnException]// myclass.so...</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[<i>This is on Linux, with the gcc compiler (4.6). Not OS X.</i>
<p>
When you compile code with <tt>-fobjc-exceptions</tt>, you presumably do that to somewhere execute a throw. Lets say, this is my callstack:
<p>
<table border=0 cellspacing=0>
<tr><td><font color="gray"><tt>abort</tt></font></td><td>// glibc</td></tr>
<tr><td><font color="gray"><tt>objc_exception_throw</td></font></td><td>// libobjc</td></tr>
<tr><td><b><tt>-[MyClass methodThrowingAnException]</td></b></td><td>// myclass.so</td></tr>
<tr><td><b><tt>myClassMethodBouncer</td></b></td><td>// myclass.so</td></tr>
<tr><td><font color="red"><tt>function_with_a_callback</td></font></td><td>// thirdparty.so</td></tr>
<tr><td><b><tt>-[MyClass waitingForAnException]</td></b></td><td>// myclass.so</td></tr>
<tr><td><tt>main</td></td><td>// main</td></tr>
</table>
<p>
What has happened ? I compiled all the <b>MyClass</b> code with <tt>-fobjc-exceptions</tt> and even did not forget to link the resulting shared library with <tt>--eh-frame-header</tt>. So all my code and <tt>libobjc.so</tt> has <tt>PT_GNU_EH_FRAME</tt> information, which is necessary for the "modern" C++ like stack unwinding.
<p>
Still not good enough. The third party library code <font color="red"><tt>function_with_a_callback</tt></font>, was not linked with <tt>--eh-frame-header</tt> and the unwinding stops right there. No catch handler can be found and <tt>objc_exception_throw</tt> treats this as an uncaught exception.
<p>

An example for the rule, that with every increase of complexity, there is also an increase in brittleness.
]]>
      
   </content>
</entry>

<entry>
   <title>Measuring context switches :: a small expedition. Part IV</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2011/12/measuring_context_switches_a_s_3.html" />
   <id>tag:www.mulle-kybernetik.com,2011:/weblog//7.1224</id>
   
   <published>2011-12-02T00:33:09Z</published>
   <updated>2011-12-06T21:21:23Z</updated>
   
   <summary><![CDATA[The results are all similiar for the other CPUs/Cores except for CPU0, where it's deterministically different each time: (27 -&gt; 540) 0.002849s 18859 : 0 19009 : 0 19197 : 0 19306 : 0 19438 : 0 19444 : 0...]]></summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[The results are all similiar for the other CPUs/Cores except for CPU0, where it's deterministically different each time:

<pre>(27 -&gt; 540) 0.002849s

18859 : 0
19009 : 0
19197 : 0
19306 : 0
19438 : 0
19444 : 0
19444 : 0
19600 : 0
19650 : 0
19765 : 0
19874 : 0
19903 : 0
19912 : 0
19941 : 0
19965 : 0
20441 : 0
20547 : 0
20617 : 0
20629 : 0
20880 : 0
21409 : 0
21862 : 0
23376 : 0
</pre>

First thing to notice, the program only runs for 0.0028s. That means the frequency of context switches is much higher on CPU 0. 100 times higher in this case. The duration of each context switch is also longer, lets say the average is 20000 cycles making that about 7 times longer.]]>
      
   </content>
</entry>

<entry>
   <title>Measuring context switches :: a small expedition. Part III</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2011/12/measuring_context_switches_a_s_2.html" />
   <id>tag:www.mulle-kybernetik.com,2011:/weblog//7.1223</id>
   
   <published>2011-12-01T22:06:25Z</published>
   <updated>2011-12-02T00:34:46Z</updated>
   
   <summary><![CDATA[Lets see some results: (24 -&gt; 480) 0.229874s 3356 : 18 3365 : 18 3376 : 18 3382 : 18 3388 : 18 3397 : 18 3403 : 18 3409 : 18 3412 : 18 3412 : 18 3415 :...]]></summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[Lets see some results:

<pre>(24 -&gt; 480) 0.229874s

3356 : 18
3365 : 18
3376 : 18
3382 : 18
3388 : 18
3397 : 18
3403 : 18
3409 : 18
3412 : 18
3412 : 18
3415 : 18
3421 : 18
3429 : 18
3429 : 18
3432 : 18
3456 : 18
3479 : 18
3585 : 18
3647 : 18
3691 : 18
4471 : 18
4756 : 18
8265 : 18
</pre>

The program took about 0.23s to run, in that time it received 23 context switches. That means a context switch happened every 0.1s i.e. 10Hz. Thats not suprisingly the documented preemption time slice for Mac OS X.
<p>
A context switch on CPU 18 took on average about 3.400 cycles. One may assume at these times, that the CPU is otherwise idle.
<p>
10 times 3.400 cycles is the approximate number of cycles lost per second: 34.000 cycles. Since my CPU is running at about 3.4GHz with Turboboost, that means - in relation to 3.400.000.000 cycles - context switching lost me about 0.001 % performance.
<p>
Thinking about this opens up some interesting questions, but lets gather another CPUs results to get some more data... Next time.]]>
      
   </content>
</entry>

<entry>
   <title>Measuring context switches :: a small expedition. Part II</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2011/12/measuring_context_switches_a_s_1.html" />
   <id>tag:www.mulle-kybernetik.com,2011:/weblog//7.1222</id>
   
   <published>2011-12-01T00:44:20Z</published>
   <updated>2011-12-01T10:20:43Z</updated>
   
   <summary>Here is the main routine, that is used for testing. Can&apos;t really say more than what&apos;s in the comments. The program will wait until a number (currently 23) context switches have hit it. It then prints out the number of...</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[Here is the main routine, that is used for testing. Can't really say more than what's in the comments. The program will wait until a number (currently 23) context switches have hit it. It then prints out the number of seconds elapsed and a list with the durations of said context switches.

<pre>#include &lt;assert.h&gt;
#include &lt;limits.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;sys/time.h&gt;
#include &lt;time.h&gt;


extern unsigned long long   _rdtsc();
extern unsigned int         _apicID();


typedef struct
{
   unsigned int   gap;
   unsigned int   apicID;
} context_switch_record;


static int   compare_context_switch_record( context_switch_record *a, 
                                            context_switch_record *b)
{
   return( (int) a-&gt;gap - (int) b-&gt;gap);
}


int   main( int argc, char *argv[]) 
{
   context_switch_record   infos[ 23];
   unsigned long long  a, b;
   unsigned long long  normal;
   unsigned long long  diff;
   unsigned int        i;
   struct timeval      start;
   struct timeval      stop;
   struct timeval      elapsed;
   
   gettimeofday( &amp;start, NULL);

   //
   // establish a "gap" between two rdtsc() calls, that 
   // should be considered as normal (no interrupt)
   //
   a      = _rdtsc();
   b      = _rdtsc();
   normal = (b - a) * 20;
   printf( "(%qd -&gt; %qd) ", b - a, normal);
   
   for( i = 0; i &lt; sizeof( infos) / sizeof( context_switch_record); i++)
   {
      b  = _rdtsc();
      for(;;)
      {
         a    = b;
         b    = _rdtsc();
         diff = b - a;

	 //
	 // if the delay between a and b is to large
	 // then record it
	 //
         if( diff &gt; normal)
            break;
      }
      assert( diff &lt;= INT_MAX);
      
      // 
      // record cycles spent and current cpuID
      // 
      infos[ i].gap    = diff;
      infos[ i].apicID = _apicID();
   }
   
   gettimeofday( &amp;stop, NULL);

   //
   // compute time spent waiting for n context switches
   //   
   elapsed.tv_sec  = stop.tv_sec - start.tv_sec;
   elapsed.tv_usec = stop.tv_usec - start.tv_usec;
   if( stop.tv_usec &lt; start.tv_usec)
   {
      elapsed.tv_sec -= 1;
      elapsed.tv_usec = 1000000L - start.tv_usec + stop.tv_usec;
   }
   printf( "%d.%06lds\n\n", (int) elapsed.tv_sec, (long) elapsed.tv_usec);
   
   //
   // output data and done
   //   
   qsort( &amp;infos, sizeof( infos) / sizeof( context_switch_record), 
          sizeof( context_switch_record), 
          (void *) compare_context_switch_record);
   
   for( i = 0; i &lt; sizeof( infos) / sizeof( context_switch_record); i++)
      printf( "%u : %u\n", infos[ i].gap, infos[ i].apicID);

   return( 0);
}
</pre>

Here is the <a href="/weblog/files/mulle-ctxt-switches.tgz">Xcode Project</a>.]]>
      
   </content>
</entry>

<entry>
   <title>Measuring context switches :: a small expedition. Part I</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2011/12/measuring_context_switches_a_s.html" />
   <id>tag:www.mulle-kybernetik.com,2011:/weblog//7.1221</id>
   
   <published>2011-12-01T00:30:07Z</published>
   <updated>2011-12-01T00:43:08Z</updated>
   
   <summary>First up some assembler code. It just works for i386 currently. The first routine gives me the core number the code is currently executing under (see Intel Application Note 485 for more details) .text .globl __apicID __apicID: push %ebx movl...</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[First up some assembler code. It just works for i386 currently. The first routine gives me the core number the code is currently executing under (see <a href="http://www.intel.com/content/www/us/en/processors/processor-identification-cpuid-instruction-note.html">Intel Application Note 485</a> for more details)

<pre>   .text
   .globl __apicID
__apicID:
   push     %ebx

   movl     $0x1,%eax
   cpuid

   mov      %ebx, %eax
   shr      $24,%eax

   popl     %ebx
   
   ret
</pre>

and the second function  returns the number of cycles elapsed since power on

<pre>	.text
.globl __rdtsc
__rdtsc:
	rdtsc
	ret
</pre>

I haven't coded i386 assembler much, it probably shows :)
]]>
      
   </content>
</entry>

<entry>
   <title>Small shell script to generate passwords</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2011/11/small_shell_script_to_generate.html" />
   <id>tag:www.mulle-kybernetik.com,2011:/weblog//7.1220</id>
   
   <published>2011-11-11T11:36:39Z</published>
   <updated>2011-11-11T11:38:41Z</updated>
   
   <summary> #! /bin/sh # # Coded 2011 by Nat! - Mulle kybernetiK # # Public Domain # # Creates a password with pwgen # # http://sourceforge.net/projects/pwgen # # Advantages of passwords generated with this # code: # # 1) are...</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[<pre>
#! /bin/sh
#
# Coded 2011 by Nat! - Mulle kybernetiK
#
# Public Domain
#
# Creates a password with pwgen 
#
#    http://sourceforge.net/projects/pwgen
#
# Advantages of passwords generated with this
# code:
# 
# 1) are "green" in Mac OS X password security 
#    check
# 2) do not contain characters that can be 
#    easily confused with one another in 
#    non-serif fonts
# 3) do not contain z and y or any special 
#    characters, so german or english keyboard 
#    doesn't make a difference
# 
OPTS="-s -B -c -n"

LENGTH=${1:-24}
shift

USER_OPTS="$*"
if [ "$USER_OPTS" != "" ]
then
   OPTS="$USER_OPTS"
fi

pw=""

while [ "$pw" = "" ]
do
    candidate=`pwgen $OPTS -1 $LENGTH 1`
    pw=`echo "$candidate" | grep -v '[zZyY0OlI1]'`
done

echo "$pw"
</pre>]]>
      
   </content>
</entry>

<entry>
   <title>UnitKit fixes updated on bitbucket.org</title>
   <link rel="alternate" type="text/html" href="http://www.mulle-kybernetik.com/weblog/2011/11/unitkit_fixes_updated_on_bitbu.html" />
   <id>tag:www.mulle-kybernetik.com,2011:/weblog//7.1219</id>
   
   <published>2011-11-10T13:53:35Z</published>
   <updated>2011-11-10T13:57:52Z</updated>
   
   <summary>I updated my bitbucket.org project unitkit-fixes so that UnitKit works more nicely with the current Xcode. And for me the current Xcode is 3 :) It&apos;s one of a few experimental projects I put on bitbucket.org. Eventually I will probably...</summary>
   <author>
      <name>Nat!</name>
      <uri>http://www.mulle-kybernetik.com</uri>
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.mulle-kybernetik.com/weblog/">
      <![CDATA[I updated my <a href="http://bitbucket.org">bitbucket.org</a> project <a href="https://bitbucket.org/mulle_nat/unitkit-fixes">unitkit-fixes</a> so that UnitKit works more nicely with the current Xcode. And for me the current Xcode is 3 :)
<p>
It's one of a few experimental projects I put on <a href="http://bitbucket.org">bitbucket.org</a>. Eventually I will probably migrate it back to Mulle kybernetiK, because the added "social" doesn't really do anything for me.

]]>
      
   </content>
</entry>

</feed>

