<?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>Note To Self &#187; osx</title>
	<atom:link href="http://www.hawksley.net/tag/osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hawksley.net</link>
	<description>John Hawksley &#124; www.hawksley.net</description>
	<lastBuildDate>Sun, 30 May 2010 14:13:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>OSX/Cocoa UI Event Spy</title>
		<link>http://www.hawksley.net/2009/10/osxcocoa-ui-event-spy/</link>
		<comments>http://www.hawksley.net/2009/10/osxcocoa-ui-event-spy/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 14:53:29 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.hawksley.net/?p=153</guid>
		<description><![CDATA[I recently had to profile an application, and one of the metrics I wanted to obtain was the performance of the GUI, without (if possible) resorting to GUI testing frameworks. This metric would be the duration of time from when the user commanded a redraw/update, until the render of that redraw actually completed (effectively a [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to profile an application, and one of the metrics I wanted to obtain was the performance of the GUI, without (if possible) resorting to GUI testing frameworks.  This metric would be the duration of time from when the user commanded a redraw/update, until the render of that redraw actually completed (effectively a complete client-server-client round-trip time).</p>
<p>To cut a long story short, there doesn&#8217;t seem to be a developer tool in OS X or XCode to spy on these UI events, but you can enable them on individual applications by supplying the <code>-NSTraceEvents YES</code> flag to the binary, which you must start from Terminal.</p>
<p>For example, here&#8217;s how you&#8217;d start TextEdit and spy on its events.</p>
<p><code>/Applications/TextEdit.app/Contents/MacOS/TextEdit -NSTraceEvents YES</code></p>
<p>In my case, I actually only wanted to have the mouse-up events which would trigger the refresh.  Here&#8217;s how I did it:</p>
<p><code>/Applications/TextEdit.app/Contents/MacOS/TextEdit -NSTraceEvents YES 2>&#038;1 | grep "Received event.*LMouseUp"</code></p>
<p>NSTraceEvents outputs the trace to the <code>stderr</code> stream, which is ignored by grep, so the <code>2&gt;&amp;1</code> is there to redirect <code>stderr</code> to <code>stdout</code>.  The &#8220;<code>Received event.*LMouseUp</code>&#8221; regular expression selects the mouse-up events from the complete stream.</p>
<p>Result:</p>
<p><code>2009-10-11 16:56:13.291 TextEdit[29990:903]<br />
Received event: LMouseUp at: 320.0,243.0 time: 199375872740000 flags: 0x100 win: 1832 ctxt: f0df data: 2531,1<br />
</code></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.hawksley.net/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.hawksley.net/2009/10/osxcocoa-ui-event-spy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
