<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DelphiTools.info &#187; Command</title>
	<atom:link href="http://delphitools.info/tag/command/feed/" rel="self" type="application/rss+xml" />
	<link>http://delphitools.info</link>
	<description>SamplingProfiler, DWS and other Delphi tools</description>
	<lastBuildDate>Thu, 02 Feb 2012 11:33:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ZJDBGPack 2.0 improved &#8220;batch-ability&#8221;</title>
		<link>http://delphitools.info/2009/07/10/zjdbgpack-2-0-improved-batch-ability/</link>
		<comments>http://delphitools.info/2009/07/10/zjdbgpack-2-0-improved-batch-ability/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 14:52:15 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[ZJDBGPack]]></category>

		<guid isPermaLink="false">http://delphitools.info/?p=419</guid>
		<description><![CDATA[An improved version of ZJDBGPack has been released, with better error messages and non-zero exit codes when an error occurs. This makes it more usable for batches and automated builds.]]></description>
			<content:encoded><![CDATA[<p>An improved version of <a href="http://delphitools.info/other-tools/zjdbgpack/">ZJDBGPack</a> has been released, with better error messages and non-zero exit codes when an error occurs. This makes it more usable for batches and automated builds.</p>
]]></content:encoded>
			<wfw:commentRss>http://delphitools.info/2009/07/10/zjdbgpack-2-0-improved-batch-ability/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Profiling multi-threaded applications</title>
		<link>http://delphitools.info/2009/05/27/profiling-multi-threaded-applications/</link>
		<comments>http://delphitools.info/2009/05/27/profiling-multi-threaded-applications/#comments</comments>
		<pubDate>Wed, 27 May 2009 12:02:28 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Bottleneck]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[Monte-Carlo]]></category>
		<category><![CDATA[Multithreading]]></category>
		<category><![CDATA[OutputDebugString]]></category>
		<category><![CDATA[Profiler]]></category>
		<category><![CDATA[threadID]]></category>

		<guid isPermaLink="false">http://delphitools.info/?p=397</guid>
		<description><![CDATA[SamplingProfiler has a few options to help profile a multi-threaded application which I&#8217;ll go over here. In the current version, those options allow identifying CPU-related bottlenecks, as in &#8220;threads taking too much CPU resources or execution time&#8221;. However, they do not provide much clues yet to pinpoint bottlenecks arising from thread synchronization issues or serialization [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://delphitools.info/samplingprofiler/">SamplingProfiler</a> has a few options to help profile a multi-threaded application which I&#8217;ll go over here.</p>
<p>In the current version, those options allow identifying <em>CPU-related bottlenecks</em>, as in &#8220;threads taking too much CPU resources or execution time&#8221;. However, they do not provide much clues yet to pinpoint bottlenecks arising from thread synchronization issues or serialization (insufficient parallelism). Hopefully, more support for profiling multi-threaded applications will come in future versions.</p>
<p><strong>Single-threaded profiling</strong></p>
<p>By default, SamplingProfiler only looks at one thread, the main application thread, but you can manually (and dynamically) specify another thread. This is done via <em>OutputDebugString</em> (see <a href="http://delphitools.info/2009/03/02/control-sampling-from-your-code/">Control sampling from your code</a>)</p>
<pre style="padding-left: 30px;">OutputDebugString('SAMPLING THREAD threadID');
</pre>
<p>with <em>threadID</em> the thread ID (as returned from the WinAPI function <em>GetCurrentThreadID</em> f.i.). If you specify an invalid <em>threadID</em>, or if the thread dies, no more samples will be collected until you specify a new thread or &#8220;return&#8221; the sampling focus to the main thread, which can be accomplished with</p>
<pre style="padding-left: 30px;">OutputDebugString('SAMPLING THREAD 0');</pre>
<p>This command is mostly useful if you already have a clue which thread is proving troublesome, like when a worker thread is used in GUI interface. If you have several worker threads in a <a rel="nofollow" href="http://en.wikipedia.org/wiki/Thread_pool">thread pool</a>, which serve random workloads (or assumed random),  you can pick one of those threads (at random) and have it profiled.</p>
<p>However, this involves a fair amount of bias and guessing where the bottleneck could be, and is not really applicable if you have a high number of threads working (or sleeping) simultaneously on multiple CPUs. This is where comes in&#8230;</p>
<p><strong>Monte-Carlo Samples Gathering</strong></p>
<p><a href="http://en.wikipedia.org/wiki/Monte_Carlo_method">Monte-Carlo</a> sampling is specified via the samples gathering mode option, when set, SamplingProfiler will pick a random thread of the profiled application at each sampling, and use it for the sample. Bias and guessing are eliminated.</p>
<p>The good news is that with this method, the sampling load is not increased, and its impact is random: concurrency issues and UI bottlenecks can still be spotted. Hot-spots in a server running at production speed can be spotted too.</p>
<p>The bad news is that if you have a high number of inactive threads, you&#8217;ll have to gather more samples to get meaningful results on the active threads (as each time an inactive thread is picked at random, the sample will be meaningless, and thus lost).</p>
<p>Interpreting the profiling results can however be a little more difficult, as several multi-threading effects can come into play, for instance a drop in CPU cache efficiency (code stressed in highly threaded situations can behave quite differently from what it looks when stressed in single-threaded situation). This will be food for future articles.</p>
<p>To decide if a thread is active or not, SamplingProfiler looks at its registers: if all the registers are unchanged between two samplings, the thread is deemed inactive and the sample dropped. Inactivity can thus result from the thread being sleeping or waiting on some event, or just from having not gotten its share of CPU time since the last time it was sampled (this can be quite common if you have a much higher number of threads than you have CPU cores, even if all the threads are busy).</p>
<p><strong>CPU Affinity</strong></p>
<p>The last set of options is the one for <a rel="nofollow" href="http://en.wikipedia.org/wiki/Processor_affinity">processor affinities</a>. You can choose on which CPUs SamplingProfiler is constrained, and on which CPUs the profiled application is constrained.</p>
<p>Affinities can be used either to further isolate the profiled application from the profiler, or to easily simulate your application running on a machine with less cores. In more advanced scenarios, if you have enough CPU cores, you can also leave CPU cores entirely unused by both the profiler or the profiled, and thus reserve them to a third application (such as a database server).</p>
]]></content:encoded>
			<wfw:commentRss>http://delphitools.info/2009/05/27/profiling-multi-threaded-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ZJDBGPack re-release</title>
		<link>http://delphitools.info/2009/05/04/zjdbgpack-re-release/</link>
		<comments>http://delphitools.info/2009/05/04/zjdbgpack-re-release/#comments</comments>
		<pubDate>Mon, 04 May 2009 08:35:42 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[JCL]]></category>
		<category><![CDATA[Profiler]]></category>
		<category><![CDATA[Size]]></category>
		<category><![CDATA[ZJDBGPack]]></category>

		<guid isPermaLink="false">http://delphitools.info/?p=376</guid>
		<description><![CDATA[ZJDBGPack is again available, but as an independent download (it used to be bundled with SamplingProfiler). This is a command-line utility intended for use in a build process or from the Delphi tools menu, whose purpose is to integrate debug information into an executable. The debug information format  is a compressed version of JCL&#8216;s JDBG. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://delphitools.info/other-tools/zjdbgpack/">ZJDBGPack</a> is again available, but as an independent download (it used to be bundled with SamplingProfiler).</p>
<p>This is a command-line utility intended for use in a build process or from the Delphi tools menu, whose purpose is to integrate debug information into an executable. The debug information format  is a compressed version of <a href="http://jcl.delphi-jedi.org/">JCL</a>&#8216;s JDBG.</p>
<p>As of know, <a href="http://delphitools.info/samplingprofiler/">SamplingProfiler</a> is the only published utility that understands this format, so you can use it either to reduce the size of the executables you deploy for profiling purposes, or if you do not want to deploy directly-readable debug information files.</p>
]]></content:encoded>
			<wfw:commentRss>http://delphitools.info/2009/05/04/zjdbgpack-re-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delphi 2009 hidden compiler switch?</title>
		<link>http://delphitools.info/2009/04/01/delphi-2009-hidden-compiler-switch/</link>
		<comments>http://delphitools.info/2009/04/01/delphi-2009-hidden-compiler-switch/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 11:46:26 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[asm]]></category>
		<category><![CDATA[CodeGear]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Site]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://delphitools.info/?p=269</guid>
		<description><![CDATA[This morning while debugging a statistical ichthyo-parser I stumbled upon what looked like a Delphi 2009 compiler bug: the compiler was outputting gibberish ASM opcodes&#8230; But after further investigations, it appeared this wasn&#8217;t completely gibberish, but that it was (somewhat) correct MSIL bytecode! What&#8217;s more, a quick hexadecimal examination of dcc32.exe yelded that this MSIL [...]]]></description>
			<content:encoded><![CDATA[<p>This morning while debugging a statistical ichthyo-parser I stumbled upon what looked like a Delphi 2009 compiler bug: the compiler was outputting gibberish ASM opcodes&#8230; But after further investigations, it appeared this wasn&#8217;t completely gibberish, but that it was (somewhat) correct MSIL bytecode!</p>
<p>What&#8217;s more, a quick hexadecimal examination of dcc32.exe yelded that this MSIL codegen looks like it can be forced by using an undocumented command-line compiler switch: <em>-af</em></p>
<p>The resulting exe won&#8217;t run because it&#8217;s a mismatch of Win32 headers and MSIL bytecode&#8230; What do you think?<br />
 Did CodeGear plan supporting unmanaged code in managed executables or managed code in native executables?</p>
<p><strong>Update:</strong> here is a <a rel="nofollow" href="http://delphitools.info/wp-content/uploads/2009/04/d2009-msil.jpg">screenshot</a> of the switch in action.</p>
]]></content:encoded>
			<wfw:commentRss>http://delphitools.info/2009/04/01/delphi-2009-hidden-compiler-switch/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Control sampling from your code</title>
		<link>http://delphitools.info/2009/03/02/control-sampling-from-your-code/</link>
		<comments>http://delphitools.info/2009/03/02/control-sampling-from-your-code/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 10:07:23 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[OutputDebugString]]></category>
		<category><![CDATA[Profiler]]></category>
		<category><![CDATA[Reproducibility]]></category>
		<category><![CDATA[threadID]]></category>

		<guid isPermaLink="false">http://delphitools.info/?p=54</guid>
		<description><![CDATA[One issue when trying to profile a &#8220;live&#8221; application is that you may be getting a lot of noise, resulting from a particular library or section of code being executed from multiple contexts. You may also be after profiling only one particular case, and want some reproducibility between runs&#8230; in short: you want a finer [...]]]></description>
			<content:encoded><![CDATA[<p>One issue when trying to profile a &#8220;live&#8221; application is that you may be getting a lot of noise, resulting from a particular library or section of code being executed from multiple contexts. You may also be after profiling only one particular case, and want some reproducibility between runs&#8230; in short: you want a finer grained control on when or for what the profiling will take place.</p>
<p>In those cases, you can control SamplingProfiler&#8217;s samples collection from your code with the following:</p>
<pre style="padding-left: 30px;">OutputDebugString('SAMPLING ON');
 ...whatever needs to be profiled...
 OutputDebugString('SAMPLING OFF');</pre>
<p>Those calls to OutputDebugString() are understood as commands to turn sampling ON or OFF. Usually you&#8217;ll want to use this in conjunction with the &#8220;Start sampling on command only&#8221; option, but it can also be used in reverse to &#8220;pause&#8221; sample collection. OutputDebugString() is declared in the Windows.pas unit.</p>
<p>As of version 1.5.2, another command that is accepted via OutputDebugString() is &#8216;SAMPLING THREAD threadID&#8217;, which is used to define from which threadID samples must be collected. This is useful when you want to profile a particular thread in multi-threaded application&#8230; but that&#8217;s another can o&#8217;worms for another day!</p>
]]></content:encoded>
			<wfw:commentRss>http://delphitools.info/2009/03/02/control-sampling-from-your-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.delphitools.info/tag/command/feed/ ) in 0.80623 seconds, on Feb 4th, 2012 at 12:33 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 5th, 2012 at 12:33 pm UTC -->
