<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>Windows Phone Power Tools</title><link>http://wptools.codeplex.com/project/feeds/rss</link><description>The Windows Phone Toolbox is an extension to the regular XAP deployer tools that come with the Windows Phone SDK which adds features like the ability to update a xap and to browse the IsolatedStorage of an installed &amp;#40;developer&amp;#41; xap.</description><item><title>Updated Wiki: Using ETW Events within a Windows Phone 8 Application</title><link>https://wptools.codeplex.com/wikipage?title=Using ETW Events within a Windows Phone 8 Application&amp;version=8</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;&lt;font size="4"&gt;&lt;strong&gt;Using ETW Events within a Windows Phone 8 Application&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;The sample code used in this article can be found &amp;lt;here&amp;gt; and is based on the standard “Windows Phone Direct 3D with XAML App” project template from Visual Studio.
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;The Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Your ETW manifest is an XML file which defines what your events look like so that event viewers can intelligently display your events once you've collected them in a log.
&lt;/p&gt;
&lt;p&gt;Windows Phone uses the same manifests as Windows, so the regular documentation applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Writing an Instrumentation Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Sample Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The sample manifest that we'll be using can be found &amp;lt;here&amp;gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br&gt;
&lt;font size="3"&gt;Provider GUID&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;If you're developing a regular application you will want to use the developer GUID for your provider:
&lt;font size="2" face="Consolas"&gt;7A68C8E0-BE90-4039-9048-2A69F64BDF3C&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;If you're writing a library you're going to want to select your own GUID that doesn't clash with the standard app developer one and then publicize it so that developers can collect it when they use your library.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Compiling the Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;In order to decode your events from the ETL (Event Trace Log) the system needs to read your manifest out of a binary that has your manifest compiled into it as a resource. While you can register arbitrary providers (and their associated manifests) on your
 local machine, you can't do this on the Phone, so the Phone won't be able to recognize your events. To work around this we will be post-processing your events on your local machine using an x86 (or x64) resource only dll that includes your manifest.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, add a new project to your solution: &lt;br&gt;
&lt;br&gt;
File -&amp;gt; Add -&amp;gt; New Project -&amp;gt; Other Languages -&amp;gt; Visual C&amp;#43;&amp;#43; -&amp;gt; Win32 -&amp;gt; Win32 Project&lt;br&gt;
&lt;br&gt;
While the name is generally unimportant for clarity sake we’ll go with the name of the provider, In this case &amp;quot;Phone-Direct3DXaml-App&amp;quot;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In the wizard select an &amp;quot;Application Type&amp;quot; of &amp;quot;DLL&amp;quot;, &amp;quot;Empty Project&amp;quot; and clear any other check boxes:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679358"&gt;&lt;img title="clip_image001" border="0" alt="clip_image001" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679359" width="404" height="314" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Add the manifest to your project (so that it appears in your solution and you can edit it in VS)
&lt;/li&gt;&lt;li&gt;Add the following pre-build command (substitute your manifest name:&lt;br&gt;
&lt;br&gt;
&lt;font face="Consolas"&gt;mc -um Phone-Direct3DXaml-App.man&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679360"&gt;&lt;img title="clip_image002" border="0" alt="clip_image002" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679361" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Specify the &amp;quot;No Entry Point&amp;quot; option in the linker (since this will be a resource only dll):
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679362"&gt;&lt;img title="clip_image003" border="0" alt="clip_image003" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679363" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Make sure the project is set to build with everything else by going to Build -&amp;gt; Configuration Manager and selecting &amp;quot;Build&amp;quot; next to your project:&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679364"&gt;&lt;img title="clip_image004" border="0" alt="clip_image004" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679365" width="404" height="255" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Registering Your Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Registering your manifest on your local machine allows you to decode your events so that they don't show up as &amp;quot;unknown&amp;quot;. If you run VS as admin you can have you can do this as part of the compile step, otherwise you can do it manually using the same commands
 as below (just expand the paths):&amp;nbsp; &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click your project -&amp;gt; Properties -&amp;gt; Config… -&amp;gt; Build Events -&amp;gt; Post-Build Events -&amp;gt; Command Line (hit the little down arrow and click &amp;lt;edit&amp;gt;)
&lt;/li&gt;&lt;li&gt;Paste in the follow lines:&lt;br&gt;
&lt;br&gt;
&lt;font size="2" face="Consolas"&gt;wevtutil um &amp;quot;$(ProjectDir)Phone-Direct3DXaml-App.man&amp;quot;&lt;br&gt;
wevtutil im $(ProjectDir)Phone-Direct3DXaml-App.man /mf:&amp;quot;$(TargetPath)&amp;quot; /rf:&amp;quot;$(TargetPath)&amp;quot;&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679366"&gt;&lt;img title="clip_image005" border="0" alt="clip_image005" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679367" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The above lines unregister your provider (which may, or may not already be registered) and then reregister it providing full paths to your resource dll. Unregistering is required to update your provider with any new changes you may have made.
&lt;/li&gt;&lt;li&gt;Next, make sure that the resource project is set to build first in your solution (so that it generates it's files before anyone can use them) by right clicking on your solution -&amp;gt; Project Build Order -&amp;gt; Dependencies. Under your native project select
 the manifest project and then verify in the &amp;quot;Build Order&amp;quot; tab that it will build first.&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679368"&gt;&lt;img title="clip_image006" border="0" alt="clip_image006" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679369" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679370"&gt;&lt;img title="clip_image007" border="0" alt="clip_image007" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679371" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Finally&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;So we have our resource events, now, let's use them! &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Optional Step - easy header access:
&lt;ol type="a"&gt;
&lt;li&gt;Add the header file generated from your manfiest to your project. If you are using the above steps to compile your manifest then you should find the header in the root of your manifest project. The file will be added with a small link icon to indicate that
 the file is in a different location to the rest of your project files&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679372"&gt;&lt;img title="clip_image008" border="0" alt="clip_image008" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679373" width="244" height="112" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In case you ever change anything, and so that you don't have to #include the full path to the header file every time create a EtwEvents.h file that includes your generated header file:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#pragma once&lt;/font&gt; &lt;br&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;&amp;quot;..\..\Phone-Direct3DXaml-App\Phone-Direct3DXaml-App.h&amp;quot;&lt;/font&gt;&lt;/font&gt;
&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventRegister*&lt;/font&gt; macro before using any of the marker macros for the first time
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventUnregister*&lt;/font&gt; macro during your shutdown code
&lt;/li&gt;&lt;li&gt;You can now include &amp;quot;&lt;font face="Consolas"&gt;EtwEvents.h&lt;/font&gt;&amp;quot; wherever needed and simply call&lt;font face="Consolas"&gt; EventWrite&amp;lt;func&amp;gt;&lt;/font&gt; (you can find the names in your ETW header).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Writing Events from Managed Code&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Our first order of business will be creating a WinRT class to expose the events to Managed code:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click on your existing Native WinRT project (or, if you don't have one, add a new one) -&amp;gt; Add -&amp;gt; Class.
&lt;/li&gt;&lt;li&gt;In the wizard give your class whatever name you like (we'll be using Etw) &lt;/li&gt;&lt;li&gt;Since we need this to be a WinRT class you'll need to sprinkle some WinRT sugar around your class definition (Etw.h) to make it visible to managed code. At the same time we're going to make the constructor private and remove the destructor since the Etw
 class won't maintain any state and all of its members will be static.&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font style="background-color:#ffff00"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt;
&lt;font color="#9e7c7c"&gt;&amp;quot;EtwEvents.h&amp;quot;&lt;/font&gt;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font style="background-color:#ffff00"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="background-color:#ffff00"&gt;public ref&lt;/font&gt; class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff" style="background-color:#ffff00"&gt;
sealed&lt;/font&gt; &lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;/font&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;public: &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font style="background-color:#ffff00"&gt;&lt;font size="2"&gt;}&lt;/font&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Don’t forget to add the namespace declaration to &lt;font face="Consolas"&gt;Etw.cpp&lt;/font&gt; as well.
&lt;/p&gt;
&lt;/li&gt;&lt;li&gt;Now add functions for provider registration and deregistration and a function that represents each event macro in your header (search for &amp;quot;&lt;font face="Consolas"&gt;EventWrite&lt;/font&gt;&amp;quot;).
&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Recommendation:&lt;/strong&gt; make your functions static (which matches the private constructor above) so that you don't have to instantiate the
&lt;font face="Consolas"&gt;Etw&lt;/font&gt; object everywhere.&lt;br&gt;
&lt;br&gt;
&lt;table cellspacing="0" cellpadding="2" width="744" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="332"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.h &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;EtwEvents.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public ref class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff"&gt;sealed&lt;/font&gt; &lt;br&gt;
{ &lt;br&gt;
&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;br&gt;
&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public: &lt;br&gt;
&amp;nbsp; static void &lt;/font&gt;RegisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; UnregisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteInitialized(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteFramerate(float fps); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameStart(); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameEnd(); &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="410"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.cpp: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;pch.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;Etw.h&amp;quot;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::RegisterProvider() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventRegisterPhone_Direct3DXaml_App();&lt;/font&gt; &lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::UnregisterProvider() |&lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventUnregisterPhone_Direct3DXaml_App(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteInitialized() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteInitialized(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFramerate(float fps) &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFramerate(fps); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameStart() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameStart(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameEnd() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameEnd(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br&gt;
Word to the wise: your function names cannot match your task names. In the example above you cannot have a function named simply &amp;quot;Initialized&amp;quot; since that is the same name as one of my tasks (you'll know you've done this when you get Template cast errors).
&lt;/li&gt;&lt;li&gt;Now, in your app constructor / initializer code you can run &lt;font size="2" face="Consolas"&gt;
Etw.RegisterProvider()&lt;/font&gt; and in your shutdown code you can call &lt;font size="2"&gt;
Etw.UnregisterProvider()&lt;/font&gt;.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;And we’re done! &lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Mon, 13 May 2013 09:47:10 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using ETW Events within a Windows Phone 8 Application 20130513094710A</guid></item><item><title>Updated Wiki: Using ETW Events within a Windows Phone 8 Application</title><link>https://wptools.codeplex.com/wikipage?title=Using ETW Events within a Windows Phone 8 Application&amp;version=7</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;&lt;font size="4"&gt;&lt;strong&gt;Using ETW Events within a Windows Phone 8 Application&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;The sample code used in this article can be found &amp;lt;here&amp;gt; and is based on the standard “Windows Phone Direct 3D with XAML App” project template from Visual Studio.
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;The Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Your ETW manifest is an XML file which defines what your events look like so that event viewers can intelligently display your events once you've collected them in a log.
&lt;/p&gt;
&lt;p&gt;Windows Phone uses the same manifests as Windows, so the regular documentation applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Writing an Instrumentation Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Sample Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The sample manifest that we'll be using can be found &amp;lt;here&amp;gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br&gt;
Provider GUID&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;If you're developing a regular application you will want to use the developer GUID for your provider:
&lt;font size="2" face="Consolas"&gt;7A68C8E0-BE90-4039-9048-2A69F64BDF3C&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;If you're writing a library you're going to want to select your own GUID that doesn't clash with the standard app developer one and then publicize it so that developers can collect it when they use your library.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Compiling the Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;In order to decode your events from the ETL (Event Trace Log) the system needs to read your manifest out of a binary that has your manifest compiled into it as a resource. While you can register arbitrary providers (and their associated manifests) on your
 local machine, you can't do this on the Phone, so the Phone won't be able to recognize your events. To work around this we will be post-processing your events on your local machine using an x86 (or x64) resource only dll that includes your manifest.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, add a new project to your solution: &lt;br&gt;
&lt;br&gt;
File -&amp;gt; Add -&amp;gt; New Project -&amp;gt; Other Languages -&amp;gt; Visual C&amp;#43;&amp;#43; -&amp;gt; Win32 -&amp;gt; Win32 Project&lt;br&gt;
&lt;br&gt;
While the name is generally unimportant for clarity sake we’ll go with the name of the provider, In this case &amp;quot;Phone-Direct3DXaml-App&amp;quot;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In the wizard select an &amp;quot;Application Type&amp;quot; of &amp;quot;DLL&amp;quot;, &amp;quot;Empty Project&amp;quot; and clear any other check boxes:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679358"&gt;&lt;img title="clip_image001" border="0" alt="clip_image001" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679359" width="404" height="314" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Add the manifest to your project (so that it appears in your solution and you can edit it in VS)
&lt;/li&gt;&lt;li&gt;Add the following pre-build command (substitute your manifest name:&lt;br&gt;
&lt;br&gt;
&lt;font face="Consolas"&gt;mc -um Phone-Direct3DXaml-App.man&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679360"&gt;&lt;img title="clip_image002" border="0" alt="clip_image002" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679361" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Specify the &amp;quot;No Entry Point&amp;quot; option in the linker (since this will be a resource only dll):
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679362"&gt;&lt;img title="clip_image003" border="0" alt="clip_image003" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679363" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Make sure the project is set to build with everything else by going to Build -&amp;gt; Configuration Manager and selecting &amp;quot;Build&amp;quot; next to your project:&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679364"&gt;&lt;img title="clip_image004" border="0" alt="clip_image004" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679365" width="404" height="255" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Registering Your Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Registering your manifest on your local machine allows you to decode your events so that they don't show up as &amp;quot;unknown&amp;quot;. If you run VS as admin you can have you can do this as part of the compile step, otherwise you can do it manually using the same commands
 as below (just expand the paths):&amp;nbsp; &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click your project -&amp;gt; Properties -&amp;gt; Config… -&amp;gt; Build Events -&amp;gt; Post-Build Events -&amp;gt; Command Line (hit the little down arrow and click &amp;lt;edit&amp;gt;)
&lt;/li&gt;&lt;li&gt;Paste in the follow lines:&lt;br&gt;
&lt;br&gt;
&lt;font size="2" face="Consolas"&gt;wevtutil um &amp;quot;$(ProjectDir)Phone-Direct3DXaml-App.man&amp;quot;&lt;br&gt;
wevtutil im $(ProjectDir)Phone-Direct3DXaml-App.man /mf:&amp;quot;$(TargetPath)&amp;quot; /rf:&amp;quot;$(TargetPath)&amp;quot;&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679366"&gt;&lt;img title="clip_image005" border="0" alt="clip_image005" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679367" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The above lines unregister your provider (which may, or may not already be registered) and then reregister it providing full paths to your resource dll. Unregistering is required to update your provider with any new changes you may have made.
&lt;/li&gt;&lt;li&gt;Next, make sure that the resource project is set to build first in your solution (so that it generates it's files before anyone can use them) by right clicking on your solution -&amp;gt; Project Build Order -&amp;gt; Dependencies. Under your native project select
 the manifest project and then verify in the &amp;quot;Build Order&amp;quot; tab that it will build first.&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679368"&gt;&lt;img title="clip_image006" border="0" alt="clip_image006" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679369" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679370"&gt;&lt;img title="clip_image007" border="0" alt="clip_image007" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679371" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Finally&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;So we have our resource events, now, let's use them! &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Optional Step - easy header access:
&lt;ol type="a"&gt;
&lt;li&gt;Add the header file generated from your manfiest to your project. If you are using the above steps to compile your manifest then you should find the header in the root of your manifest project. The file will be added with a small link icon to indicate that
 the file is in a different location to the rest of your project files&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679372"&gt;&lt;img title="clip_image008" border="0" alt="clip_image008" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679373" width="244" height="112" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In case you ever change anything, and so that you don't have to #include the full path to the header file every time create a EtwEvents.h file that includes your generated header file:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#pragma once&lt;/font&gt; &lt;br&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;&amp;quot;..\..\Phone-Direct3DXaml-App\Phone-Direct3DXaml-App.h&amp;quot;&lt;/font&gt;&lt;/font&gt;
&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventRegister*&lt;/font&gt; macro before using any of the marker macros for the first time
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventUnregister*&lt;/font&gt; macro during your shutdown code
&lt;/li&gt;&lt;li&gt;You can now include &amp;quot;&lt;font face="Consolas"&gt;EtwEvents.h&lt;/font&gt;&amp;quot; wherever needed and simply call&lt;font face="Consolas"&gt; EventWrite&amp;lt;func&amp;gt;&lt;/font&gt; (you can find the names in your ETW header).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Writing Events from Managed Code&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Our first order of business will be creating a WinRT class to expose the events to Managed code:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click on your existing Native WinRT project (or, if you don't have one, add a new one) -&amp;gt; Add -&amp;gt; Class.
&lt;/li&gt;&lt;li&gt;In the wizard give your class whatever name you like (we'll be using Etw) &lt;/li&gt;&lt;li&gt;Since we need this to be a WinRT class you'll need to sprinkle some WinRT sugar around your class definition (Etw.h) to make it visible to managed code. At the same time we're going to make the constructor private and remove the destructor since the Etw
 class won't maintain any state and all of its members will be static.&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font style="background-color:#ffff00"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt;
&lt;font color="#9e7c7c"&gt;&amp;quot;EtwEvents.h&amp;quot;&lt;/font&gt;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font style="background-color:#ffff00"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="background-color:#ffff00"&gt;public ref&lt;/font&gt; class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff" style="background-color:#ffff00"&gt;
sealed&lt;/font&gt; &lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;/font&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;public: &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font style="background-color:#ffff00"&gt;&lt;font size="2"&gt;}&lt;/font&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Don’t forget to add the namespace declaration to &lt;font face="Consolas"&gt;Etw.cpp&lt;/font&gt; as well.
&lt;/p&gt;
&lt;/li&gt;&lt;li&gt;Now add functions for provider registration and deregistration and a function that represents each event macro in your header (search for &amp;quot;&lt;font face="Consolas"&gt;EventWrite&lt;/font&gt;&amp;quot;).
&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Recommendation:&lt;/strong&gt; make your functions static (which matches the private constructor above) so that you don't have to instantiate the
&lt;font face="Consolas"&gt;Etw&lt;/font&gt; object everywhere.&lt;br&gt;
&lt;br&gt;
&lt;table cellspacing="0" cellpadding="2" width="744" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="332"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.h &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;EtwEvents.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public ref class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff"&gt;sealed&lt;/font&gt; &lt;br&gt;
{ &lt;br&gt;
&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;br&gt;
&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public: &lt;br&gt;
&amp;nbsp; static void &lt;/font&gt;RegisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; UnregisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteInitialized(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteFramerate(float fps); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameStart(); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameEnd(); &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="410"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.cpp: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;pch.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;Etw.h&amp;quot;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::RegisterProvider() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventRegisterPhone_Direct3DXaml_App();&lt;/font&gt; &lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::UnregisterProvider() |&lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventUnregisterPhone_Direct3DXaml_App(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteInitialized() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteInitialized(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFramerate(float fps) &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFramerate(fps); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameStart() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameStart(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameEnd() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameEnd(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br&gt;
Word to the wise: your function names cannot match your task names. In the example above you cannot have a function named simply &amp;quot;Initialized&amp;quot; since that is the same name as one of my tasks (you'll know you've done this when you get Template cast errors).
&lt;/li&gt;&lt;li&gt;Now, in your app constructor / initializer code you can run &lt;font size="2" face="Consolas"&gt;
Etw.RegisterProvider()&lt;/font&gt; and in your shutdown code you can call &lt;font size="2"&gt;
Etw.UnregisterProvider()&lt;/font&gt;.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;And we’re done! &lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Mon, 13 May 2013 09:44:54 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using ETW Events within a Windows Phone 8 Application 20130513094454A</guid></item><item><title>Updated Wiki: Using ETW Events within a Windows Phone 8 Application</title><link>https://wptools.codeplex.com/wikipage?title=Using ETW Events within a Windows Phone 8 Application&amp;version=6</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;&lt;font size="4"&gt;&lt;strong&gt;Using ETW Events within a Windows Phone 8 Application&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;The sample code used in this article can be found &amp;lt;here&amp;gt; and is based on the standard “Windows Phone Direct 3D with XAML App” project template from Visual Studio.
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;The Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Your ETW manifest is an XML file which defines what your events look like so that event viewers can intelligently display your events once you've collected them in a log.
&lt;/p&gt;
&lt;p&gt;Windows Phone uses the same manifests as Windows, so the regular documentation applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Writing an Instrumentation Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Sample Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The sample manifest that we'll be using can be found &amp;lt;here&amp;gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br&gt;
Provider GUID&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;If you're developing a regular application you will want to use the developer GUID for your provider:
&lt;font size="2" face="Consolas"&gt;7A68C8E0-BE90-4039-9048-2A69F64BDF3C&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;If you're writing a library you're going to want to select your own GUID that doesn't clash with the standard app developer one and then publicize it so that developers can collect it when they use your library.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Compiling the Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;In order to decode your events from the ETL (Event Trace Log) the system needs to read your manifest out of a binary that has your manifest compiled into it as a resource. While you can register arbitrary providers (and their associated manifests) on your
 local machine, you can't do this on the Phone, so the Phone won't be able to recognize your events. To work around this we will be post-processing your events on your local machine using an x86 (or x64) resource only dll that includes your manifest.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, add a new project to your solution: &lt;br&gt;
&lt;br&gt;
File -&amp;gt; Add -&amp;gt; New Project -&amp;gt; Other Languages -&amp;gt; Visual C&amp;#43;&amp;#43; -&amp;gt; Win32 -&amp;gt; Win32 Project&lt;br&gt;
&lt;br&gt;
While the name is generally unimportant for clarity sake we’ll go with the name of the provider, In this case &amp;quot;Phone-Direct3DXaml-App&amp;quot;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In the wizard select an &amp;quot;Application Type&amp;quot; of &amp;quot;DLL&amp;quot;, &amp;quot;Empty Project&amp;quot; and clear any other check boxes:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679358"&gt;&lt;img title="clip_image001" border="0" alt="clip_image001" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679359" width="404" height="314" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Add the manifest to your project (so that it appears in your solution and you can edit it in VS)
&lt;/li&gt;&lt;li&gt;Add the following pre-build command (substitute your manifest name:&lt;br&gt;
&lt;br&gt;
&lt;font face="Consolas"&gt;mc -um Phone-Direct3DXaml-App.man&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679360"&gt;&lt;img title="clip_image002" border="0" alt="clip_image002" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679361" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Specify the &amp;quot;No Entry Point&amp;quot; option in the linker (since this will be a resource only dll):
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679362"&gt;&lt;img title="clip_image003" border="0" alt="clip_image003" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679363" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Make sure the project is set to build with everything else by going to Build -&amp;gt; Configuration Manager and selecting &amp;quot;Build&amp;quot; next to your project:&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679364"&gt;&lt;img title="clip_image004" border="0" alt="clip_image004" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679365" width="404" height="255" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Registering Your Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Registering your manifest on your local machine allows you to decode your events so that they don't show up as &amp;quot;unknown&amp;quot;. If you run VS as admin you can have you can do this as part of the compile step, otherwise you can do it manually using the same commands
 as below (just expand the paths):&amp;nbsp; &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click your project -&amp;gt; Properties -&amp;gt; Config… -&amp;gt; Build Events -&amp;gt; Post-Build Events -&amp;gt; Command Line (hit the little down arrow and click &amp;lt;edit&amp;gt;)
&lt;/li&gt;&lt;li&gt;Paste in the follow lines:&lt;br&gt;
&lt;br&gt;
&lt;font size="2" face="Consolas"&gt;wevtutil um &amp;quot;$(ProjectDir)Phone-Direct3DXaml-App.man&amp;quot;&lt;br&gt;
wevtutil im $(ProjectDir)Phone-Direct3DXaml-App.man /mf:&amp;quot;$(TargetPath)&amp;quot; /rf:&amp;quot;$(TargetPath)&amp;quot;&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679366"&gt;&lt;img title="clip_image005" border="0" alt="clip_image005" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679367" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The above lines unregister your provider (which may, or may not already be registered) and then reregister it providing full paths to your resource dll. Unregistering is required to update your provider with any new changes you may have made.
&lt;/li&gt;&lt;li&gt;Next, make sure that the resource project is set to build first in your solution (so that it generates it's files before anyone can use them) by right clicking on your solution -&amp;gt; Project Build Order -&amp;gt; Dependencies. Under your native project select
 the manifest project and then verify in the &amp;quot;Build Order&amp;quot; tab that it will build first.&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679368"&gt;&lt;img title="clip_image006" border="0" alt="clip_image006" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679369" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679370"&gt;&lt;img title="clip_image007" border="0" alt="clip_image007" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679371" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Finally&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;So we have our resource events, now, let's use them! &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Optional Step - easy header access:
&lt;ol type="a"&gt;
&lt;li&gt;Add the header file generated from your manfiest to your project. If you are using the above steps to compile your manifest then you should find the header in the root of your manifest project. The file will be added with a small link icon to indicate that
 the file is in a different location to the rest of your project files&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679372"&gt;&lt;img title="clip_image008" border="0" alt="clip_image008" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679373" width="244" height="112" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In case you ever change anything, and so that you don't have to #include the full path to the header file every time create a EtwEvents.h file that includes your generated header file:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#pragma once&lt;/font&gt; &lt;br&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;&amp;quot;..\..\Phone-Direct3DXaml-App\Phone-Direct3DXaml-App.h&amp;quot;&lt;/font&gt;&lt;/font&gt;
&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventRegister*&lt;/font&gt; macro before using any of the marker macros for the first time
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventUnregister*&lt;/font&gt; macro during your shutdown code
&lt;/li&gt;&lt;li&gt;You can now include &amp;quot;&lt;font face="Consolas"&gt;EtwEvents.h&lt;/font&gt;&amp;quot; wherever needed and simply call&lt;font face="Consolas"&gt; EventWrite&amp;lt;func&amp;gt;&lt;/font&gt; (you can find the names in your ETW header).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Writing Events from Managed Code&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Our first order of business will be creating a WinRT class to expose the events to Managed code:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click on your existing Native WinRT project (or, if you don't have one, add a new one) -&amp;gt; Add -&amp;gt; Class.
&lt;/li&gt;&lt;li&gt;In the wizard give your class whatever name you like (we'll be using Etw) &lt;/li&gt;&lt;li&gt;Since we need this to be a WinRT class you'll need to sprinkle some WinRT sugar around your class definition (Etw.h) to make it visible to managed code. At the same time we're going to make the constructor private and remove the destructor since the Etw
 class won't maintain any state and all of its members will be static.&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font style="background-color:#ffff00"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt;
&lt;font color="#9e7c7c"&gt;&amp;quot;EtwEvents.h&amp;quot;&lt;/font&gt;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font style="background-color:#ffff00"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font style="background-color:#ffff00"&gt;public ref&lt;/font&gt; class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff" style="background-color:#ffff00"&gt;
sealed&lt;/font&gt; &lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;/font&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;public: &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font style="background-color:#ffff00"&gt;&lt;font size="2"&gt;}&lt;/font&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Don’t forget to add the namespace declaration to &lt;font face="Consolas"&gt;Etw.cpp&lt;/font&gt; as well.
&lt;/p&gt;
&lt;/li&gt;&lt;li&gt;Now add functions for provider registration and deregistration and a function that represents each event macro in your header (search for &amp;quot;&lt;font face="Consolas"&gt;EventWrite&lt;/font&gt;&amp;quot;).
&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Recommendation:&lt;/strong&gt; make your functions static (which matches the private constructor above) so that you don't have to instantiate the
&lt;font face="Consolas"&gt;Etw&lt;/font&gt; object everywhere.&lt;br&gt;
&lt;br&gt;
&lt;table cellspacing="0" cellpadding="2" width="744" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="332"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.h &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;EtwEvents.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public ref class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff"&gt;sealed&lt;/font&gt; &lt;br&gt;
{ &lt;br&gt;
&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;br&gt;
&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public: &lt;br&gt;
&amp;nbsp; static void &lt;/font&gt;RegisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; UnregisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteInitialized(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteFramerate(float fps); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameStart(); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameEnd(); &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="410"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.cpp: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;pch.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;Etw.h&amp;quot;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::RegisterProvider() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventRegisterPhone_Direct3DXaml_App();&lt;/font&gt; &lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::UnregisterProvider() |&lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventUnregisterPhone_Direct3DXaml_App(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteInitialized() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteInitialized(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFramerate(float fps) &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFramerate(fps); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameStart() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameStart(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameEnd() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameEnd(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br&gt;
Word to the wise: your function names cannot match your task names. In the example above you cannot have a function named simply &amp;quot;Initialized&amp;quot; since that is the same name as one of my tasks (you'll know you've done this when you get Template cast errors).
&lt;/li&gt;&lt;li&gt;Now, in your app constructor / initializer code you can run &lt;font size="2" face="Consolas"&gt;
Etw.RegisterProvider()&lt;/font&gt; and in your shutdown code you can call &lt;font size="2"&gt;
Etw.UnregisterProvider()&lt;/font&gt;.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;And we’re done! &lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Mon, 13 May 2013 09:39:50 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using ETW Events within a Windows Phone 8 Application 20130513093950A</guid></item><item><title>Updated Wiki: Using ETW Events within a Windows Phone 8 Application</title><link>https://wptools.codeplex.com/wikipage?title=Using ETW Events within a Windows Phone 8 Application&amp;version=5</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;&lt;font size="4"&gt;&lt;strong&gt;Using ETW Events within a Windows Phone 8 Application&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;The sample code used in this article can be found &amp;lt;here&amp;gt; and is based on the standard “Windows Phone Direct 3D with XAML App” project template from Visual Studio.
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;The Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Your ETW manifest is an XML file which defines what your events look like so that event viewers can intelligently display your events once you've collected them in a log.
&lt;/p&gt;
&lt;p&gt;Windows Phone uses the same manifests as Windows, so the regular documentation applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Writing an Instrumentation Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Sample Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The sample manifest that we'll be using can be found &amp;lt;here&amp;gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br&gt;
Provider GUID&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;If you're developing a regular application you will want to use the developer GUID for your provider:
&lt;font size="2" face="Consolas"&gt;7A68C8E0-BE90-4039-9048-2A69F64BDF3C&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;If you're writing a library you're going to want to select your own GUID that doesn't clash with the standard app developer one and then publicize it so that developers can collect it when they use your library.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Compiling the Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;In order to decode your events from the ETL (Event Trace Log) the system needs to read your manifest out of a binary that has your manifest compiled into it as a resource. While you can register arbitrary providers (and their associated manifests) on your
 local machine, you can't do this on the Phone, so the Phone won't be able to recognize your events. To work around this we will be post-processing your events on your local machine using an x86 (or x64) resource only dll that includes your manifest.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, add a new project to your solution: &lt;br&gt;
&lt;br&gt;
File -&amp;gt; Add -&amp;gt; New Project -&amp;gt; Other Languages -&amp;gt; Visual C&amp;#43;&amp;#43; -&amp;gt; Win32 -&amp;gt; Win32 Project&lt;br&gt;
&lt;br&gt;
I usually set the name to the name of my provider. In this case &amp;quot;Phone-Direct3DXaml-App&amp;quot;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In the wizard select an &amp;quot;Application Type&amp;quot; of &amp;quot;DLL&amp;quot;, &amp;quot;Empty Project&amp;quot; and clear any other check boxes:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679358"&gt;&lt;img title="clip_image001" border="0" alt="clip_image001" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679359" width="404" height="314" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Add the manifest to your project (so that it appears in your solution and you can edit it in VS)
&lt;/li&gt;&lt;li&gt;Add the following pre-build command:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679360"&gt;&lt;img title="clip_image002" border="0" alt="clip_image002" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679361" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Specify the &amp;quot;No Entry Point&amp;quot; option in the linker (since this will be a resource only dll):
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679362"&gt;&lt;img title="clip_image003" border="0" alt="clip_image003" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679363" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Make sure the project is set to build with everything else by going to Build -&amp;gt; Configuration Manager and selecting &amp;quot;Build&amp;quot; next to your project:&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679364"&gt;&lt;img title="clip_image004" border="0" alt="clip_image004" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679365" width="404" height="255" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Registering Your Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Registering your manifest on your local machine allows you to decode your events so that they don't show up as &amp;quot;unknown&amp;quot;. If you run VS as admin you can have you can do this as part of the compile step, otherwise you can do it manually using the same commands
 as below (just expand the paths):&amp;nbsp; &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click your project -&amp;gt; Properties -&amp;gt; Config… -&amp;gt; Build Events -&amp;gt; Post-Build Events -&amp;gt; Command Line (hit the little down arrow and click &amp;lt;edit&amp;gt;)
&lt;/li&gt;&lt;li&gt;Paste in the follow lines:&lt;br&gt;
&lt;br&gt;
&lt;font size="2" face="Consolas"&gt;wevtutil um &amp;quot;$(ProjectDir)Phone-Direct3DXaml-App.man&amp;quot;&lt;br&gt;
wevtutil im $(ProjectDir)Phone-Direct3DXaml-App.man /mf:&amp;quot;$(TargetPath)&amp;quot; /rf:&amp;quot;$(TargetPath)&amp;quot;&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679366"&gt;&lt;img title="clip_image005" border="0" alt="clip_image005" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679367" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The above lines unregister your provider (which may, or may not already be registered) and then reregister it providing full paths to your resource dll. Unregistering is required to update your provider with any new changes you may have made.
&lt;/li&gt;&lt;li&gt;Next, make sure that the resource project is set to build first in your solution (so that it generates it's files before anyone can use them) by right clicking on your solution -&amp;gt; Project Build Order -&amp;gt; Dependencies. Under your native project select
 the manifest project and then verify in the &amp;quot;Build Order&amp;quot; tab that it will build first.&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679368"&gt;&lt;img title="clip_image006" border="0" alt="clip_image006" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679369" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679370"&gt;&lt;img title="clip_image007" border="0" alt="clip_image007" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679371" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Finally&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;So we have our resource events, now, let's use them! &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Optional Step - easy header access:
&lt;ol&gt;
&lt;li&gt;Add the header file generated from your manfiest to your project. If you are using the above steps to compile your manifest then you should find the header in the root of your manifest project. The file will be added with a small link icon to indicate that
 the file is in a different location to the rest of your project files&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679372"&gt;&lt;img title="clip_image008" border="0" alt="clip_image008" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679373" width="244" height="112" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In case you ever change anything, and so that you don't have to #include the full path to the header file every time create a EtwEvents.h file that includes your generated header file:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;font color="#0000ff"&gt;#pragma once&lt;/font&gt; &lt;br&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;&amp;quot;..\..\Phone-Direct3DXaml-App\Phone-Direct3DXaml-App.h&amp;quot;&lt;/font&gt;
&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventRegister*&lt;/font&gt; macro before using any of the marker macros for the first time
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventUnregister*&lt;/font&gt; macro during your shutdown code
&lt;/li&gt;&lt;li&gt;You can now include &amp;quot;&lt;font face="Consolas"&gt;EtwEvents.h&lt;/font&gt;&amp;quot; wherever needed and simply call&lt;font face="Consolas"&gt; EventWrite&amp;lt;func&amp;gt;&lt;/font&gt; (you can find the names in your ETW header).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Writing Events from Managed Code&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Our first order of business will be creating a WinRT class to expose the events to Managed code:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click on your existing Native WinRT project (or, if you don't have one, add a new one) -&amp;gt; Add -&amp;gt; Class.
&lt;/li&gt;&lt;li&gt;In the wizard give your class whatever name you like (we'll be using Etw) &lt;/li&gt;&lt;li&gt;Since we need this to be a WinRT class you'll need to sprinkle some WinRT sugar around your class definition (Etw.h) to make it visible to managed code. At the same time we're going to make the constructor private and remove the destructor since the Etw
 class won't maintain any state and all of its members will be static.&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;EtwEvents.h&amp;quot;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;public ref class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff"&gt;sealed&lt;/font&gt; &lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;/font&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;public: &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;}&lt;/font&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Don’t forget to add the namespace declaration to &lt;font face="Consolas"&gt;Etw.cpp&lt;/font&gt; as well.
&lt;/p&gt;
&lt;/li&gt;&lt;li&gt;Now add functions for provider registration and deregistration and a function that represents each event macro in your header (search for &amp;quot;&lt;font face="Consolas"&gt;EventWrite&lt;/font&gt;&amp;quot;).
&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Recommendation:&lt;/strong&gt; make your functions static (which matches the private constructor above) so that you don't have to instantiate the
&lt;font face="Consolas"&gt;Etw&lt;/font&gt; object everywhere.&lt;br&gt;
&lt;br&gt;
&lt;table cellspacing="0" cellpadding="2" width="744" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="332"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.h &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;EtwEvents.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public ref class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff"&gt;sealed&lt;/font&gt; &lt;br&gt;
{ &lt;br&gt;
&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;br&gt;
&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public: &lt;br&gt;
&amp;nbsp; static void &lt;/font&gt;RegisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; UnregisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteInitialized(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteFramerate(float fps); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameStart(); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameEnd(); &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="410"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.cpp: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;pch.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;Etw.h&amp;quot;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::RegisterProvider() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventRegisterPhone_Direct3DXaml_App();&lt;/font&gt; &lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::UnregisterProvider() |&lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventUnregisterPhone_Direct3DXaml_App(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteInitialized() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteInitialized(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFramerate(float fps) &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFramerate(fps); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameStart() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameStart(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameEnd() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameEnd(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br&gt;
Word to the wise: your function names cannot match your task names. In the example above you cannot have a function named simply &amp;quot;Initialized&amp;quot; since that is the same name as one of my tasks (you'll know you've done this when you get Template cast errors).
&lt;/li&gt;&lt;li&gt;Now, in your app constructor / initializer code you can run &lt;font size="2" face="Consolas"&gt;
Etw.RegisterProvider()&lt;/font&gt; and in your shutdown code you can call &lt;font size="2"&gt;
Etw.UnregisterProvider()&lt;/font&gt;.&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Mon, 13 May 2013 09:21:32 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using ETW Events within a Windows Phone 8 Application 20130513092132A</guid></item><item><title>Updated Wiki: Using ETW Events within a Windows Phone 8 Application</title><link>https://wptools.codeplex.com/wikipage?title=Using ETW Events within a Windows Phone 8 Application&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;&lt;font size="4"&gt;&lt;strong&gt;Using ETW Events within a Windows Phone 8 Application&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;The sample code used in this article can be found &amp;lt;here&amp;gt; and is based on the standard “Windows Phone Direct 3D with XAML App” project template from Visual Studio,
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;The Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Your ETW manifest is an XML file which defines what your events look like so that event viewers can intelligently display your events once you've collected them in a log.
&lt;/p&gt;
&lt;p&gt;Windows Phone uses the same manifests as Windows, so the regular documentation applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Writing an Instrumentation Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Sample Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The sample manifest that we'll be using can be found &amp;lt;here&amp;gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br&gt;
Provider GUID&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;If you're developing a regular application you will want to use the developer GUID for your provider:
&lt;font size="2" face="Consolas"&gt;7A68C8E0-BE90-4039-9048-2A69F64BDF3C&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;If you're writing a library you're going to want to select your own GUID that doesn't clash with the standard app developer one and then publicize it so that developers can collect it when they use your library.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Compiling the Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;In order to decode your events from the ETL (Event Trace Log) the system needs to read your manifest out of a binary that has your manifest compiled into it as a resource. While you can register arbitrary providers (and their associated manifests) on your
 local machine, you can't do this on the Phone, so the Phone won't be able to recognize your events. To work around this we will be post-processing your events on your local machine using an x86 (or x64) resource only dll that includes your manifest.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, add a new project to your solution: &lt;br&gt;
&lt;br&gt;
File -&amp;gt; Add -&amp;gt; New Project -&amp;gt; Other Languages -&amp;gt; Visual C&amp;#43;&amp;#43; -&amp;gt; Win32 -&amp;gt; Win32 Project&lt;br&gt;
&lt;br&gt;
I usually set the name to the name of my provider. In this case &amp;quot;Phone-Direct3DXaml-App&amp;quot;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In the wizard select an &amp;quot;Application Type&amp;quot; of &amp;quot;DLL&amp;quot;, &amp;quot;Empty Project&amp;quot; and clear any other check boxes:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679358"&gt;&lt;img title="clip_image001" border="0" alt="clip_image001" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679359" width="404" height="314" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Add the manifest to your project (so that it appears in your solution and you can edit it in VS)
&lt;/li&gt;&lt;li&gt;Add the following pre-build command:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679360"&gt;&lt;img title="clip_image002" border="0" alt="clip_image002" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679361" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Specify the &amp;quot;No Entry Point&amp;quot; option in the linker (since this will be a resource only dll):
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679362"&gt;&lt;img title="clip_image003" border="0" alt="clip_image003" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679363" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Make sure the project is set to build with everything else by going to Build -&amp;gt; Configuration Manager and selecting &amp;quot;Build&amp;quot; next to your project:&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679364"&gt;&lt;img title="clip_image004" border="0" alt="clip_image004" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679365" width="404" height="255" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Registering Your Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Registering your manifest on your local machine allows you to decode your events so that they don't show up as &amp;quot;unknown&amp;quot;. If you run VS as admin you can have you can do this as part of the compile step, otherwise you can do it manually using the same commands
 as below (just expand the paths):&amp;nbsp; &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click your project -&amp;gt; Properties -&amp;gt; Config… -&amp;gt; Build Events -&amp;gt; Post-Build Events -&amp;gt; Command Line (hit the little down arrow and click &amp;lt;edit&amp;gt;)
&lt;/li&gt;&lt;li&gt;Paste in the follow lines:&lt;br&gt;
&lt;br&gt;
&lt;font size="2" face="Consolas"&gt;wevtutil um &amp;quot;$(ProjectDir)Phone-Direct3DXaml-App.man&amp;quot;&lt;br&gt;
wevtutil im $(ProjectDir)Phone-Direct3DXaml-App.man /mf:&amp;quot;$(TargetPath)&amp;quot; /rf:&amp;quot;$(TargetPath)&amp;quot;&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679366"&gt;&lt;img title="clip_image005" border="0" alt="clip_image005" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679367" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The above lines unregister your provider (which may, or may not already be registered) and then reregister it providing full paths to your resource dll. Unregistering is required to update your provider with any new changes you may have made.
&lt;/li&gt;&lt;li&gt;Next, make sure that the resource project is set to build first in your solution (so that it generates it's files before anyone can use them) by right clicking on your solution -&amp;gt; Project Build Order -&amp;gt; Dependencies. Under your native project select
 the manifest project and then verify in the &amp;quot;Build Order&amp;quot; tab that it will build first.&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679368"&gt;&lt;img title="clip_image006" border="0" alt="clip_image006" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679369" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679370"&gt;&lt;img title="clip_image007" border="0" alt="clip_image007" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679371" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Finally&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;So we have our resource events, now, let's use them! &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Optional Step - easy header access:
&lt;ol&gt;
&lt;li&gt;Add the header file generated from your manfiest to your project. If you are using the above steps to compile your manifest then you should find the header in the root of your manifest project. The file will be added with a small link icon to indicate that
 the file is in a different location to the rest of your project files&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679372"&gt;&lt;img title="clip_image008" border="0" alt="clip_image008" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679373" width="244" height="112" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In case you ever change anything, and so that you don't have to #include the full path to the header file every time create a EtwEvents.h file that includes your generated header file:&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;font color="#0000ff"&gt;#pragma once&lt;/font&gt; &lt;br&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;&amp;quot;..\..\Phone-Direct3DXaml-App\Phone-Direct3DXaml-App.h&amp;quot;&lt;/font&gt;
&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventRegister*&lt;/font&gt; macro before using any of the marker macros for the first time
&lt;/li&gt;&lt;li&gt;Add a call to the &lt;font face="Consolas"&gt;EventUnregister*&lt;/font&gt; macro during your shutdown code
&lt;/li&gt;&lt;li&gt;You can now include &amp;quot;&lt;font face="Consolas"&gt;EtwEvents.h&lt;/font&gt;&amp;quot; wherever needed and simply call&lt;font face="Consolas"&gt; EventWrite&amp;lt;func&amp;gt;&lt;/font&gt; (you can find the names in your ETW header).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Writing Events from Managed Code&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Our first order of business will be creating a WinRT class to expose the events to Managed code:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click on your existing Native WinRT project (or, if you don't have one, add a new one) -&amp;gt; Add -&amp;gt; Class.
&lt;/li&gt;&lt;li&gt;In the wizard give your class whatever name you like (we'll be using Etw) &lt;/li&gt;&lt;li&gt;Since we need this to be a WinRT class you'll need to sprinkle some WinRT sugar around your class definition (Etw.h) to make it visible to managed code. At the same time we're going to make the constructor private and remove the destructor since the Etw
 class won't maintain any state and all of its members will be static.&lt;br&gt;
&lt;br&gt;
&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;EtwEvents.h&amp;quot;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;public ref class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff"&gt;sealed&lt;/font&gt; &lt;br&gt;
&lt;/font&gt;&lt;font face="Consolas"&gt;{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;/font&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;public: &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;}&lt;/font&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Don’t forget to add the namespace declaration to &lt;font face="Consolas"&gt;Etw.cpp&lt;/font&gt; as well.
&lt;/p&gt;
&lt;/li&gt;&lt;li&gt;Now add functions for provider registration and deregistration and a function that represents each event macro in your header (search for &amp;quot;&lt;font face="Consolas"&gt;EventWrite&lt;/font&gt;&amp;quot;).
&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;Recommendation:&lt;/strong&gt; make your functions static (which matches the private constructor above) so that you don't have to instantiate the
&lt;font face="Consolas"&gt;Etw&lt;/font&gt; object everywhere.&lt;br&gt;
&lt;br&gt;
&lt;table cellspacing="0" cellpadding="2" width="744" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="332"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.h &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;#pragma once &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;EtwEvents.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent
&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public ref class&lt;/font&gt;
&lt;font color="#4bacc6"&gt;Etw&lt;/font&gt; &lt;font color="#0000ff"&gt;sealed&lt;/font&gt; &lt;br&gt;
{ &lt;br&gt;
&lt;font color="#0000ff"&gt;private:&lt;/font&gt; &lt;br&gt;
&amp;nbsp; Etw() {}; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;public: &lt;br&gt;
&amp;nbsp; static void &lt;/font&gt;RegisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; UnregisterProvider(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteInitialized(); &lt;br&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;static void&lt;/font&gt; WriteFramerate(float fps); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameStart(); &lt;br&gt;
&lt;font color="#0000ff"&gt;&amp;nbsp; static void&lt;/font&gt; WriteFrameEnd(); &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;}; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="410"&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2" face="Consolas"&gt;Etw.cpp: &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;pch.h&amp;quot; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;#include&lt;/font&gt; &lt;font color="#9e7c7c"&gt;
&amp;quot;Etw.h&amp;quot;&lt;/font&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;namespace&lt;/font&gt; PhoneDirect3DXamlAppComponent&lt;br&gt;
{ &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::RegisterProvider() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventRegisterPhone_Direct3DXaml_App();&lt;/font&gt; &lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::UnregisterProvider() |&lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventUnregisterPhone_Direct3DXaml_App(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteInitialized() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteInitialized(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFramerate(float fps) &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFramerate(fps); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameStart() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameStart(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; &lt;font color="#4bacc6"&gt;
Etw&lt;/font&gt;::WriteFrameEnd() &lt;br&gt;
{ &lt;br&gt;
&amp;nbsp; &lt;font color="#9b00d3"&gt;EventWriteFrameEnd(); &lt;/font&gt;&lt;br&gt;
} &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;} &lt;/font&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br&gt;
Word to the wise: your function names cannot match your task names. In the example above you cannot have a function named simply &amp;quot;Initialized&amp;quot; since that is the same name as one of my tasks (you'll know you've done this when you get Template cast errors).
&lt;/li&gt;&lt;li&gt;Now, in your app constructor / initializer code you can run &lt;font size="2" face="Consolas"&gt;
Etw.RegisterProvider()&lt;/font&gt; and in your shutdown code you can call &lt;font size="2"&gt;
Etw.UnregisterProvider()&lt;/font&gt;.&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Mon, 13 May 2013 09:20:36 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using ETW Events within a Windows Phone 8 Application 20130513092036A</guid></item><item><title>Updated Wiki: Using ETW Events within a Windows Phone 8 Application</title><link>https://wptools.codeplex.com/wikipage?title=Using ETW Events within a Windows Phone 8 Application&amp;version=3</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;&lt;font size="4"&gt;&lt;strong&gt;Using ETW Events within a Windows Phone 8 Application&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;The sample code used in this article can be found &amp;lt;here&amp;gt; and is based on the standard “Windows Phone Direct 3D with XAML App” project template from Visual Studio,
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;The Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Your ETW manifest is an XML file which defines what your events look like so that event viewers can intelligently display your events once you've collected them in a log.
&lt;/p&gt;
&lt;p&gt;Windows Phone uses the same manifests as Windows, so the regular documentation applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Writing an Instrumentation Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Sample Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The sample manifest that we'll be using can be found &amp;lt;here&amp;gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br&gt;
Provider GUID&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;If you're developing a regular application you will want to use the developer GUID for your provider:
&lt;font size="2" face="Consolas"&gt;7A68C8E0-BE90-4039-9048-2A69F64BDF3C&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;If you're writing a library you're going to want to select your own GUID that doesn't clash with the standard app developer one and then publicize it so that developers can collect it when they use your library.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Compiling the Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;In order to decode your events from the ETL (Event Trace Log) the system needs to read your manifest out of a binary that has your manifest compiled into it as a resource. While you can register arbitrary providers (and their associated manifests) on your
 local machine, you can't do this on the Phone, so the Phone won't be able to recognize your events. To work around this we will be post-processing your events on your local machine using an x86 (or x64) resource only dll that includes your manifest.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, add a new project to your solution: &lt;br&gt;
&lt;br&gt;
File -&amp;gt; Add -&amp;gt; New Project -&amp;gt; Other Languages -&amp;gt; Visual C&amp;#43;&amp;#43; -&amp;gt; Win32 -&amp;gt; Win32 Project&lt;br&gt;
&lt;br&gt;
I usually set the name to the name of my provider. In this case &amp;quot;Phone-Direct3DXaml-App&amp;quot;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In the wizard select an &amp;quot;Application Type&amp;quot; of &amp;quot;DLL&amp;quot;, &amp;quot;Empty Project&amp;quot; and clear any other check boxes:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679358"&gt;&lt;img title="clip_image001" border="0" alt="clip_image001" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679359" width="404" height="314" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Add the manifest to your project (so that it appears in your solution and you can edit it in VS)
&lt;/li&gt;&lt;li&gt;Add the following pre-build command:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679360"&gt;&lt;img title="clip_image002" border="0" alt="clip_image002" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679361" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Specify the &amp;quot;No Entry Point&amp;quot; option in the linker (since this will be a resource only dll):
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679362"&gt;&lt;img title="clip_image003" border="0" alt="clip_image003" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679363" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Make sure the project is set to build with everything else by going to Build -&amp;gt; Configuration Manager and selecting &amp;quot;Build&amp;quot; next to your project:&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679364"&gt;&lt;img title="clip_image004" border="0" alt="clip_image004" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679365" width="404" height="255" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Registering Your Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Registering your manifest on your local machine allows you to decode your events so that they don't show up as &amp;quot;unknown&amp;quot;. If you run VS as admin you can have you can do this as part of the compile step, otherwise you can do it manually using the same commands
 as below (just expand the paths):&amp;nbsp; &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click your project -&amp;gt; Properties -&amp;gt; Config… -&amp;gt; Build Events -&amp;gt; Post-Build Events -&amp;gt; Command Line (hit the little down arrow and click &amp;lt;edit&amp;gt;)
&lt;/li&gt;&lt;li&gt;Paste in the follow lines:&lt;br&gt;
&lt;br&gt;
&lt;font size="2" face="Consolas"&gt;wevtutil um &amp;quot;$(ProjectDir)Phone-Direct3DXaml-App.man&amp;quot;&lt;br&gt;
wevtutil im $(ProjectDir)Phone-Direct3DXaml-App.man /mf:&amp;quot;$(TargetPath)&amp;quot; /rf:&amp;quot;$(TargetPath)&amp;quot;&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679366"&gt;&lt;img title="clip_image005" border="0" alt="clip_image005" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679367" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The above lines unregister your provider (which may, or may not already be registered) and then reregister it providing full paths to your resource dll. Unregistering is required to update your provider with any new changes you may have made.
&lt;/li&gt;&lt;li&gt;Next, make sure that the resource project is set to build first in your solution (so that it generates it's files before anyone can use them) by right clicking on your solution -&amp;gt; Project Build Order -&amp;gt; Dependencies. Under your native project select
 the manifest project and then verify in the &amp;quot;Build Order&amp;quot; tab that it will build first.&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679368"&gt;&lt;img title="clip_image006" border="0" alt="clip_image006" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679369" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679370"&gt;&lt;img title="clip_image007" border="0" alt="clip_image007" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679371" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Finally&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;So we have our resource events, now, let's use them! &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Optional Step - easy header access:
&lt;ol&gt;
&lt;li&gt;Add the header file generated from your manfiest to your project. If you are using the above steps to compile your manifest then you should find the header in the root of your manifest project. The file will be added with a small link icon to indicate that
 the file is in a different location to the rest of your project files&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679372"&gt;&lt;img title="clip_image008" border="0" alt="clip_image008" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679373" width="244" height="112" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In case you ever change anything, and so that you don't have to #include the full path to the header file every time create a EtwEvents.h file that includes your generated header file:&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;blockquote&gt;
&lt;pre&gt;&lt;pre&gt;#pragma once &lt;br&gt;&lt;br&gt;#include &amp;quot;..\..\Phone-Direct3DXaml-App\Phone-Direct3DXaml-App.h&amp;quot;&lt;br&gt;
&lt;/pre&gt;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Add a call to the EventRegister* macro before using any of the marker macros for the first time
&lt;/li&gt;&lt;li&gt;Add a call to the EventUnregister* macro during your shutdown code &lt;/li&gt;&lt;li&gt;You can now include &amp;quot;EtwEvents.h&amp;quot; wherever needed and simply call EventWrite&amp;lt;func&amp;gt; (you can find the names in your ETW header).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Creating a WinRT Wrapper for Managed code &lt;/p&gt;
&lt;p&gt;I'd like to be able to use to my events from Managed code, so my first order of business will be creating a WinRT class to expose the events to Managed code.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click on your existing WinRT project (or, if you don't have one, add a new one) -&amp;gt; Add -&amp;gt; Class.
&lt;/li&gt;&lt;li&gt;In the wizard give your class whatever name you like (we'll be using Etw) &lt;/li&gt;&lt;li&gt;Since we need this to be a WinRT class you'll need to sprinkle some WinRT sugar around your class definition (Etw.h) to make it visible to managed code. At the same time we're going to make the constructor private and remove the destructor since the Etw
 class won't maintain any state and all of its members will be static.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;#pragma once &lt;/p&gt;
&lt;p&gt;#include &amp;quot;EtwEvents.h&amp;quot; &lt;/p&gt;
&lt;p&gt;namespace PhoneDirect3DXamlAppComponent &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;public ref class Etw sealed &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;private: &lt;/p&gt;
&lt;p&gt;Etw(void) {}; &lt;/p&gt;
&lt;p&gt;public: &lt;/p&gt;
&lt;p&gt;}; &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;Also make sure to add the namespace declaration to Etw.cpp &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Now add functions for provider registration and deregistration and a function that represents each event macro in your header (search for &amp;quot;EventWrite&amp;quot;).
&lt;br&gt;
Recommendation: make your functions static (which matches the private constructor above) so that you don't have to instantiate the Etw object everywhere.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Etw.h &lt;/p&gt;
&lt;p&gt;#pragma once &lt;/p&gt;
&lt;p&gt;#include &amp;quot;EtwEvents.h&amp;quot; &lt;/p&gt;
&lt;p&gt;namespace PhoneDirect3DXamlAppComponent &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;public ref class Etw sealed &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;private: &lt;/p&gt;
&lt;p&gt;Etw(void) {}; &lt;/p&gt;
&lt;p&gt;public: &lt;/p&gt;
&lt;p&gt;static void RegisterProvider(); &lt;/p&gt;
&lt;p&gt;static void UnregisterProvider(); &lt;/p&gt;
&lt;p&gt;static void WriteInitialized(); &lt;/p&gt;
&lt;p&gt;static void WriteFramerate(float fps); &lt;/p&gt;
&lt;p&gt;static void WriteFrameStart(); &lt;/p&gt;
&lt;p&gt;static void WriteFrameEnd(); &lt;/p&gt;
&lt;p&gt;}; &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;Etw.cpp: &lt;/p&gt;
&lt;p&gt;#include &amp;quot;pch.h&amp;quot; &lt;/p&gt;
&lt;p&gt;#include &amp;quot;Etw.h&amp;quot; &lt;/p&gt;
&lt;p&gt;namespace PhoneDirect3DXamlAppComponent &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;void Etw::RegisterProvider() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventRegisterPhone_Direct3DXaml_App(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::UnregisterProvider() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventUnregisterPhone_Direct3DXaml_App(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteInitialized() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteInitialized(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteFramerate(float fps) &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteFramerate(fps); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteFrameStart() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteFrameStart(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteFrameEnd() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteFrameEnd(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;Word to the wise: your function names cannot match your task names. In the example above you cannot have a function named simply &amp;quot;Initialized&amp;quot; since that is the same name as one of my tasks (you'll know you've done this when you get Template cast errors).
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Now, in your app constructor / initializor code you can run Etw.RegisterProvider() and in your shutdown code you can call Etw.UnregisterProvider().&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Mon, 13 May 2013 08:37:42 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using ETW Events within a Windows Phone 8 Application 20130513083742A</guid></item><item><title>Updated Wiki: Using ETW Events within a Windows Phone 8 Application</title><link>https://wptools.codeplex.com/wikipage?title=Using ETW Events within a Windows Phone 8 Application&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;&lt;font size="4"&gt;&lt;strong&gt;Using ETW Events within a Windows Phone 8 Application&lt;/strong&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;The sample code used in this article can be found &amp;lt;here&amp;gt; and is based on the standard “Windows Phone Direct 3D with XAML App” project template from Visual Studio,
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;The Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Your ETW manifest is an XML file which defines what your events look like so that event viewers can intelligently display your events once you've collected them in a log.
&lt;/p&gt;
&lt;p&gt;Windows Phone uses the same manifests as Windows, so the regular documentation applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Writing an Instrumentation Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Sample Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The sample manifest that we'll be using can be found &amp;lt;here&amp;gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br&gt;
Provider GUID&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;If you're developing a regular application you will want to use the developer GUID for your provider:
&lt;font size="2" face="Consolas"&gt;7A68C8E0-BE90-4039-9048-2A69F64BDF3C&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;If you're writing a library you're going to want to select your own GUID that doesn't clash with the standard app developer one and then publicize it so that developers can collect it when they use your library.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Compiling the Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;In order to decode your events from the ETL (Event Trace Log) the system needs to read your manifest out of a binary that has your manifest compiled into it as a resource. While you can register arbitrary providers (and their associated manifests) on your
 local machine, you can't do this on the Phone, so the Phone won't be able to recognize your events. To work around this we will be post-processing your events on your local machine using an x86 (or x64) resource only dll that includes your manifest.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, add a new project to your solution: &lt;br&gt;
&lt;br&gt;
File -&amp;gt; Add -&amp;gt; New Project -&amp;gt; Other Languages -&amp;gt; Visual C&amp;#43;&amp;#43; -&amp;gt; Win32 -&amp;gt; Win32 Project&lt;br&gt;
&lt;br&gt;
I usually set the name to the name of my provider. In this case &amp;quot;Phone-Direct3DXaml-App&amp;quot;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In the wizard select an &amp;quot;Application Type&amp;quot; of &amp;quot;DLL&amp;quot;, &amp;quot;Empty Project&amp;quot; and clear any other check boxes:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679358"&gt;&lt;img title="clip_image001" border="0" alt="clip_image001" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679359" width="404" height="314" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Add the manifest to your project (so that it appears in your solution and you can edit it in VS)
&lt;/li&gt;&lt;li&gt;Add the following pre-build command:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679360"&gt;&lt;img title="clip_image002" border="0" alt="clip_image002" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679361" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Specify the &amp;quot;No Entry Point&amp;quot; option in the linker (since this will be a resource only dll):
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679362"&gt;&lt;img title="clip_image003" border="0" alt="clip_image003" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679363" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Make sure the project is set to build with everything else by going to Build -&amp;gt; Configuration Manager and selecting &amp;quot;Build&amp;quot; next to your project:&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679364"&gt;&lt;img title="clip_image004" border="0" alt="clip_image004" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679365" width="404" height="255" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Registering Your Manifest&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Registering your manifest on your local machine allows you to decode your events so that they don't show up as &amp;quot;unknown&amp;quot;. If you run VS as admin you can have you can do this as part of the compile step, otherwise you can do it manually using the same commands
 as below (just expand the paths):&amp;nbsp; &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click your project -&amp;gt; Properties -&amp;gt; Config… -&amp;gt; Build Events -&amp;gt; Post-Build Events -&amp;gt; Command Line (hit the little down arrow and click &amp;lt;edit&amp;gt;)
&lt;/li&gt;&lt;li&gt;Paste in the follow lines:&lt;br&gt;
&lt;br&gt;
&lt;font size="2" face="Consolas"&gt;wevtutil um &amp;quot;$(ProjectDir)Phone-Direct3DXaml-App.man&amp;quot;&lt;br&gt;
wevtutil im $(ProjectDir)Phone-Direct3DXaml-App.man /mf:&amp;quot;$(TargetPath)&amp;quot; /rf:&amp;quot;$(TargetPath)&amp;quot;&lt;/font&gt;&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679366"&gt;&lt;img title="clip_image005" border="0" alt="clip_image005" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679367" width="404" height="288" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
The above lines unregister your provider (which may, or may not already be registered) and then reregister it providing full paths to your resource dll. Unregistering is required to update your provider with any new changes you may have made.
&lt;/li&gt;&lt;li&gt;Next, make sure that the resource project is set to build first in your solution (so that it generates it's files before anyone can use them) by right clicking on your solution -&amp;gt; Project Build Order -&amp;gt; Dependencies. Under your native project select
 the manifest project and then verify in the &amp;quot;Build Order&amp;quot; tab that it will build first.&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679368"&gt;&lt;img title="clip_image006" border="0" alt="clip_image006" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679369" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679370"&gt;&lt;img title="clip_image007" border="0" alt="clip_image007" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679371" width="404" height="376" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Finally&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;So we have our resource events, now, let's use them! &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Optional Step - easy header access:
&lt;ol&gt;
&lt;li&gt;Add the header file generated from your manfiest to your project. If you are using the above steps to compile your manifest then you should find the header in the root of your manifest project. The file will be added with a small link icon to indicate that
 the file is in a different location to the rest of your project files&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679372"&gt;&lt;img title="clip_image008" border="0" alt="clip_image008" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679373" width="244" height="112" style="border-left-width:0px; border-right-width:0px; border-bottom-width:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; display:block; padding-right:0px; border-top-width:0px; margin-right:auto"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In case you ever change anything, and so that you don't have to #include the full path to the header file every time create a EtwEvents.h file that includes your generated header file:&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;blockquote&gt;
&lt;pre&gt;#pragma once &lt;br&gt;&lt;br&gt;#include &amp;quot;..\..\Phone-Direct3DXaml-App\Phone-Direct3DXaml-App.h&amp;quot;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;&lt;font size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Add a call to the EventRegister* macro before using any of the marker macros for the first time
&lt;/li&gt;&lt;li&gt;Add a call to the EventUnregister* macro during your shutdown code &lt;/li&gt;&lt;li&gt;You can now include &amp;quot;EtwEvents.h&amp;quot; wherever needed and simply call EventWrite&amp;lt;func&amp;gt; (you can find the names in your ETW header).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Creating a WinRT Wrapper for Managed code &lt;/p&gt;
&lt;p&gt;I'd like to be able to use to my events from Managed code, so my first order of business will be creating a WinRT class to expose the events to Managed code.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click on your existing WinRT project (or, if you don't have one, add a new one) -&amp;gt; Add -&amp;gt; Class.
&lt;/li&gt;&lt;li&gt;In the wizard give your class whatever name you like (we'll be using Etw) &lt;/li&gt;&lt;li&gt;Since we need this to be a WinRT class you'll need to sprinkle some WinRT sugar around your class definition (Etw.h) to make it visible to managed code. At the same time we're going to make the constructor private and remove the destructor since the Etw
 class won't maintain any state and all of its members will be static.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;#pragma once &lt;/p&gt;
&lt;p&gt;#include &amp;quot;EtwEvents.h&amp;quot; &lt;/p&gt;
&lt;p&gt;namespace PhoneDirect3DXamlAppComponent &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;public ref class Etw sealed &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;private: &lt;/p&gt;
&lt;p&gt;Etw(void) {}; &lt;/p&gt;
&lt;p&gt;public: &lt;/p&gt;
&lt;p&gt;}; &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;Also make sure to add the namespace declaration to Etw.cpp &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Now add functions for provider registration and deregistration and a function that represents each event macro in your header (search for &amp;quot;EventWrite&amp;quot;).
&lt;br&gt;
Recommendation: make your functions static (which matches the private constructor above) so that you don't have to instantiate the Etw object everywhere.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Etw.h &lt;/p&gt;
&lt;p&gt;#pragma once &lt;/p&gt;
&lt;p&gt;#include &amp;quot;EtwEvents.h&amp;quot; &lt;/p&gt;
&lt;p&gt;namespace PhoneDirect3DXamlAppComponent &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;public ref class Etw sealed &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;private: &lt;/p&gt;
&lt;p&gt;Etw(void) {}; &lt;/p&gt;
&lt;p&gt;public: &lt;/p&gt;
&lt;p&gt;static void RegisterProvider(); &lt;/p&gt;
&lt;p&gt;static void UnregisterProvider(); &lt;/p&gt;
&lt;p&gt;static void WriteInitialized(); &lt;/p&gt;
&lt;p&gt;static void WriteFramerate(float fps); &lt;/p&gt;
&lt;p&gt;static void WriteFrameStart(); &lt;/p&gt;
&lt;p&gt;static void WriteFrameEnd(); &lt;/p&gt;
&lt;p&gt;}; &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;Etw.cpp: &lt;/p&gt;
&lt;p&gt;#include &amp;quot;pch.h&amp;quot; &lt;/p&gt;
&lt;p&gt;#include &amp;quot;Etw.h&amp;quot; &lt;/p&gt;
&lt;p&gt;namespace PhoneDirect3DXamlAppComponent &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;void Etw::RegisterProvider() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventRegisterPhone_Direct3DXaml_App(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::UnregisterProvider() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventUnregisterPhone_Direct3DXaml_App(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteInitialized() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteInitialized(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteFramerate(float fps) &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteFramerate(fps); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteFrameStart() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteFrameStart(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteFrameEnd() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteFrameEnd(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;Word to the wise: your function names cannot match your task names. In the example above you cannot have a function named simply &amp;quot;Initialized&amp;quot; since that is the same name as one of my tasks (you'll know you've done this when you get Template cast errors).
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Now, in your app constructor / initializor code you can run Etw.RegisterProvider() and in your shutdown code you can call Etw.UnregisterProvider().&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Mon, 13 May 2013 08:35:09 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using ETW Events within a Windows Phone 8 Application 20130513083509A</guid></item><item><title>Updated Wiki: Using ETW Events within a Windows Phone 8 Application</title><link>https://wptools.codeplex.com/wikipage?title=Using ETW Events within a Windows Phone 8 Application&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;The sample code used in this article can be found &amp;lt;here&amp;gt; and is based on the standard “Windows Phone Direct 3D with XAML App” project template from Visual Studio,
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Manifest&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;Your ETW manifest is an XML file which defines what your events look like so that event viewers can intelligently display your events once you've collected them in a log.
&lt;/p&gt;
&lt;p&gt;Windows Phone uses the same manifests as Windows, so the regular documentation applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Writing an Instrumentation Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996930(v=vs.85).aspx&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Sample Manifest: &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx"&gt;
http://msdn.microsoft.com/en-us/library/windows/desktop/dd996912(v=vs.85).aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The sample manifest that we'll be using can be found &amp;lt;here&amp;gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br&gt;
Provider GUID&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;If you're developing a regular application you will want to use the developer GUID for your provider:
&lt;font size="2" face="Consolas"&gt;7A68C8E0-BE90-4039-9048-2A69F64BDF3C&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;If you're writing a library you're going to want to select your own GUID that doesn't clash with the standard app developer one and then publicize it so that developers can collect it when they use your library.
&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Compiling the Manifest&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;In order to decode your events from the ETL (Event Trace Log) the system needs to read your manifest out of a binary that has your manifest compiled into it as a resource. While you can register arbitrary providers (and their associated manifests) on your
 local machine, you can't do this on the Phone, so the Phone won't be able to recognize your events. To work around this we will be post-processing your events on your local machine using an x86 (or x64) resource only dll that includes your manifest.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First, add a new project to your solution: &lt;br&gt;
&lt;br&gt;
File -&amp;gt; Add -&amp;gt; New Project -&amp;gt; Other Languages -&amp;gt; Visual C&amp;#43;&amp;#43; -&amp;gt; Win32 -&amp;gt; Win32 Project&lt;br&gt;
&lt;br&gt;
I usually set the name to the name of my provider. In this case &amp;quot;Phone-Direct3DXaml-App&amp;quot;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;In the wizard select an &amp;quot;Application Type&amp;quot; of &amp;quot;DLL&amp;quot;, &amp;quot;Empty Project&amp;quot; and clear any other check boxes:&lt;br&gt;
&lt;br&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679335"&gt;&lt;img title="clip_image001" border="0" alt="clip_image001" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679336" width="244" height="190" style="border-top:0px; border-right:0px; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; display:inline; padding-right:0px"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/li&gt;&lt;li&gt;Add the manifest to your project (so that it appears in your solution and you can edit it in VS)
&lt;/li&gt;&lt;li&gt;Add the following pre-build command:&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679337"&gt;&lt;img title="clip_image002" border="0" alt="clip_image002" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679338" width="244" height="174" style="border-top:0px; border-right:0px; border-bottom:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; border-left:0px; display:block; padding-right:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;Specify the &amp;quot;No Entry Point&amp;quot; option in the linker (since this will be a resource only dll):
&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679339"&gt;&lt;img title="clip_image003" border="0" alt="clip_image003" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679340" width="244" height="174" style="border-top:0px; border-right:0px; border-bottom:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; border-left:0px; display:block; padding-right:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;Make sure the project is set to build with everything else by going to Build -&amp;gt; Configuration Manager and selecting &amp;quot;Build&amp;quot; next to your project:&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679341"&gt;&lt;img title="clip_image004" border="0" alt="clip_image004" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679342" width="244" height="155" style="border-top:0px; border-right:0px; border-bottom:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; border-left:0px; display:block; padding-right:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;Registering Your Manifest &lt;/p&gt;
&lt;p&gt;Registering your manifest on your local machine allows you to decode your events so that they don't show up as &amp;quot;unknown&amp;quot;. If you run VS as admin you can have VS do this every time you make a compile, otherwise you can expand the macros below and run this
 yourself from an elevated command prompt: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click your project -&amp;gt; Properties -&amp;gt; Config… -&amp;gt; Build Events -&amp;gt; Post-Build Events -&amp;gt; Command Line (hit the little down arrow and click &amp;lt;edit&amp;gt;)
&lt;/li&gt;&lt;li&gt;Paste in the follow lines:&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;wevtutil um &amp;quot;$(ProjectDir)Phone-Direct3DXaml-App.man&amp;quot; &lt;/p&gt;
&lt;p&gt;wevtutil im $(ProjectDir)Phone-Direct3DXaml-App.man /mf:&amp;quot;$(TargetPath)&amp;quot; /rf:&amp;quot;$(TargetPath)&amp;quot;
&lt;/p&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679343"&gt;&lt;img title="clip_image005" border="0" alt="clip_image005" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679344" width="244" height="174" style="border-top:0px; border-right:0px; border-bottom:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; border-left:0px; display:block; padding-right:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;The above lines unregister your provider (which may, or may not already be registered) and then reregister it providing full paths to your resource dll. Unregistering is required to update your provider with any new changes you may have made.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Next, make sure that the resource project is set to build first in your solution (so that it generates it's files before anyone can use them) by right clicking on your solution -&amp;gt; Project Build Order -&amp;gt; Dependencies. Under your native project select
 the manifest project and then verify in the &amp;quot;Build Order&amp;quot; tab that it will build first.&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679345"&gt;&lt;img title="clip_image006" border="0" alt="clip_image006" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679346" width="244" height="227" style="border-top:0px; border-right:0px; border-bottom:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; border-left:0px; display:block; padding-right:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;p&gt;&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679347"&gt;&lt;img title="clip_image007" border="0" alt="clip_image007" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679348" width="244" height="227" style="border-top:0px; border-right:0px; border-bottom:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; border-left:0px; display:block; padding-right:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;Finally &lt;/p&gt;
&lt;p&gt;So we have our resource events, now, let's use them! &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Optional Step - easy header access:
&lt;ol&gt;
&lt;li&gt;Add the header file generated from your manfiest to your project. If you are using the above steps to compile your manifest then you should find the header in the root of your manifest project. The file will be added with a small link icon to indicate that
 the file is in a different location to the rest of your project files&lt;/li&gt;&lt;/ol&gt;
&lt;/li&gt;&lt;/ol&gt;
&lt;a href="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679349"&gt;&lt;img title="clip_image008" border="0" alt="clip_image008" src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=wptools&amp;DownloadId=679350" width="244" height="112" style="border-top:0px; border-right:0px; border-bottom:0px; float:none; padding-top:0px; padding-left:0px; margin-left:auto; border-left:0px; display:block; padding-right:0px; margin-right:auto"&gt;&lt;/a&gt;
&lt;ol&gt;
&lt;li&gt;In case you ever change anything, and so that you don't have to #include the full path to the header file every time create a EtwEvents.h file with the following contents:&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;#pragma once &lt;/p&gt;
&lt;p&gt;#include &amp;quot;..\..\Phone-Direct3DXaml-App\Phone-Direct3DXaml-App.h&amp;quot; &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add a call to the EventRegister* macro before using any of the marker macros for the first time
&lt;/li&gt;&lt;li&gt;Add a call to the EventUnregister* macro during your shutdown code &lt;/li&gt;&lt;li&gt;You can now include &amp;quot;EtwEvents.h&amp;quot; wherever needed and simply call EventWrite&amp;lt;func&amp;gt; (you can find the names in your ETW header).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Creating a WinRT Wrapper for Managed code &lt;/p&gt;
&lt;p&gt;I'd like to be able to use to my events from Managed code, so my first order of business will be creating a WinRT class to expose the events to Managed code.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Right click on your existing WinRT project (or, if you don't have one, add a new one) -&amp;gt; Add -&amp;gt; Class.
&lt;/li&gt;&lt;li&gt;In the wizard give your class whatever name you like (we'll be using Etw) &lt;/li&gt;&lt;li&gt;Since we need this to be a WinRT class you'll need to sprinkle some WinRT sugar around your class definition (Etw.h) to make it visible to managed code. At the same time we're going to make the constructor private and remove the destructor since the Etw
 class won't maintain any state and all of its members will be static.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;#pragma once &lt;/p&gt;
&lt;p&gt;#include &amp;quot;EtwEvents.h&amp;quot; &lt;/p&gt;
&lt;p&gt;namespace PhoneDirect3DXamlAppComponent &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;public ref class Etw sealed &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;private: &lt;/p&gt;
&lt;p&gt;Etw(void) {}; &lt;/p&gt;
&lt;p&gt;public: &lt;/p&gt;
&lt;p&gt;}; &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;Also make sure to add the namespace declaration to Etw.cpp &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Now add functions for provider registration and deregistration and a function that represents each event macro in your header (search for &amp;quot;EventWrite&amp;quot;).
&lt;br&gt;
Recommendation: make your functions static (which matches the private constructor above) so that you don't have to instantiate the Etw object everywhere.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Etw.h &lt;/p&gt;
&lt;p&gt;#pragma once &lt;/p&gt;
&lt;p&gt;#include &amp;quot;EtwEvents.h&amp;quot; &lt;/p&gt;
&lt;p&gt;namespace PhoneDirect3DXamlAppComponent &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;public ref class Etw sealed &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;private: &lt;/p&gt;
&lt;p&gt;Etw(void) {}; &lt;/p&gt;
&lt;p&gt;public: &lt;/p&gt;
&lt;p&gt;static void RegisterProvider(); &lt;/p&gt;
&lt;p&gt;static void UnregisterProvider(); &lt;/p&gt;
&lt;p&gt;static void WriteInitialized(); &lt;/p&gt;
&lt;p&gt;static void WriteFramerate(float fps); &lt;/p&gt;
&lt;p&gt;static void WriteFrameStart(); &lt;/p&gt;
&lt;p&gt;static void WriteFrameEnd(); &lt;/p&gt;
&lt;p&gt;}; &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;Etw.cpp: &lt;/p&gt;
&lt;p&gt;#include &amp;quot;pch.h&amp;quot; &lt;/p&gt;
&lt;p&gt;#include &amp;quot;Etw.h&amp;quot; &lt;/p&gt;
&lt;p&gt;namespace PhoneDirect3DXamlAppComponent &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;void Etw::RegisterProvider() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventRegisterPhone_Direct3DXaml_App(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::UnregisterProvider() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventUnregisterPhone_Direct3DXaml_App(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteInitialized() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteInitialized(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteFramerate(float fps) &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteFramerate(fps); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteFrameStart() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteFrameStart(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;void Etw::WriteFrameEnd() &lt;/p&gt;
&lt;p&gt;{ &lt;/p&gt;
&lt;p&gt;EventWriteFrameEnd(); &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;} &lt;/p&gt;
&lt;p&gt;Word to the wise: your function names cannot match your task names. In the example above you cannot have a function named simply &amp;quot;Initialized&amp;quot; since that is the same name as one of my tasks (you'll know you've done this when you get Template cast errors).
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Now, in your app constructor / initializor code you can run Etw.RegisterProvider() and in your shutdown code you can call Etw.UnregisterProvider().&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Mon, 13 May 2013 08:06:00 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Using ETW Events within a Windows Phone 8 Application 20130513080600A</guid></item><item><title>Updated Wiki: Temporary Post Used For Theme Detection (845bc7d9-b28b-4948-8b92-ee0240ccafe6 - 3bfe001a-32de-4114-a6b4-4005b770f6d7)</title><link>https://wptools.codeplex.com/wikipage?title=Temporary Post Used For Theme Detection (845bc7d9-b28b-4948-8b92-ee0240ccafe6 - 3bfe001a-32de-4114-a6b4-4005b770f6d7)&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;This is a temporary post that was not deleted. Please delete this manually. (f72a1017-6ad4-405f-b6cc-1494d6a6fd03 - 3bfe001a-32de-4114-a6b4-4005b770f6d7)&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Mon, 13 May 2013 07:35:08 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Temporary Post Used For Theme Detection (845bc7d9-b28b-4948-8b92-ee0240ccafe6 - 3bfe001a-32de-4114-a6b4-4005b770f6d7) 20130513073508A</guid></item><item><title>Commented Unassigned: can not select a device [37]</title><link>http://wptools.codeplex.com/workitem/37</link><description>When I have the device is connected,  the drop-down box is empty..&lt;br /&gt;version&amp;#58;2.05.486289&lt;br /&gt;Comments: To be honest, I have not had this problem ever since.</description><author>MoonRaven</author><pubDate>Tue, 07 May 2013 12:21:11 GMT</pubDate><guid isPermaLink="false">Commented Unassigned: can not select a device [37] 20130507122111P</guid></item><item><title>New Post: Microsoft.Web.Infrastructure Version 1.0.0.0 be installed in the Global Assembly Cache first</title><link>http://wptools.codeplex.com/discussions/441953</link><description>&lt;div style="line-height: normal;"&gt;Thanks a lot. It works! :)  :)&lt;br /&gt;
&lt;/div&gt;</description><author>liisa57</author><pubDate>Thu, 02 May 2013 14:15:23 GMT</pubDate><guid isPermaLink="false">New Post: Microsoft.Web.Infrastructure Version 1.0.0.0 be installed in the Global Assembly Cache first 20130502021523P</guid></item><item><title>Updated Release: Windows Phone Power Tools 2.5.07 for WP 8 (Apr 30, 2013)</title><link>https://wptools.codeplex.com/releases/view/97029</link><description>&lt;div class="wikidoc"&gt;Newly updated version of the tools that supports Windows 8 and the Windows Phone 8 SDK. This version should work with both WP 7.5 devices / emulators and the WP8 devices and emulators.&lt;br /&gt;&lt;br /&gt;Please note! The profiler feature is in Beta and is missing some basic fit, finish and polish, please report bugs and feature requests on our issue tracker (&lt;a href="http://wptools.codeplex.com/workitem/list/basic"&gt;http://wptools.codeplex.com/workitem/list/basic&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Changelist&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;v2.5.07&lt;/u&gt;
&lt;ul&gt;&lt;li&gt;Removed all references to System.Web&lt;/li&gt;
&lt;li&gt;Cut down download size from 3.2MB to 0.4MB&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;u&gt;v2.5.06&lt;/u&gt;
&lt;ul&gt;&lt;li&gt;Removed dependency on Web.Mvc&lt;/li&gt;
&lt;li&gt;Fixed escaping of etl paths when opening them in wpa&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;u&gt;v2.5.01-5&lt;/u&gt;
&lt;ul&gt;&lt;li&gt;Removed debug code that was causing a crash when configuring the profiler for the first time&lt;/li&gt;
&lt;li&gt;Slight tweak to the standard trace session to collect CPU usage&lt;/li&gt;
&lt;li&gt;Added prompt to restart the Power Tools after profiler installation (CoreCon needs to be refreshed)&lt;/li&gt;
&lt;li&gt;Fixed profiler analytics&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;u&gt;v2.5&lt;/u&gt;
&lt;ul&gt;&lt;li&gt;After quite a bit of work the profiler is finally here! It&amp;#39;s a full(ish) ETW profiler that gives you near complete control over your profiling sessions. It&amp;#39;s still in Beta, here are some caveats / coming features which should all be fixed in future versions:
&lt;ul&gt;&lt;li&gt;ETLs are saved to My Documents&lt;/li&gt;
&lt;li&gt;ETLs are always, automatically, opened in WPA&lt;/li&gt;
&lt;li&gt;There is no way to add custom providers&lt;/li&gt;
&lt;li&gt;There is no way of saving a custom scenario to use again&lt;/li&gt;
&lt;li&gt;You can stop an in-progress profiler, but you can&amp;#39;t cancel one&lt;/li&gt;
&lt;li&gt;There isn&amp;#39;t much documentation - but I&amp;#39;m working on it. Volunteers?&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Bug 35: Fixed incorrect url for reporting issues - thanks OmegaMan!&lt;/li&gt;
&lt;li&gt;Some small amounts of code cleanup and performance fixes&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;u&gt;v2.041&lt;/u&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;BUG 28: The fix to bug 27 caused an internal exception when trying to get file data for WP7 which broke the IsolatedStorage explorer for WP7. This is now fixed, though WP7 is stuck with limited file information (while WP8 has the full set).&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;u&gt;v2.04&lt;/u&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;BUG 27: Fixed issue where some file properties were not being displayed in the Remote Isolated Storage explorer&lt;/li&gt;
&lt;li&gt;BUG 26: Cap number of remembered xaps at a reasonable cap (100). There is also infrastructure to make this configurable in the future.&lt;/li&gt;
&lt;li&gt;Some slight tweaks to the elevate button to make it more visible&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;Since we haven&amp;#39;t heard about any blocking issues this version is also being marked as release. yay!&lt;br /&gt;&lt;br /&gt;&lt;u&gt;v 2.03 Beta&lt;/u&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Removed dependency on Microsoft.Web.Infrastructure that was blocking some installs (bug #25)&lt;/li&gt;
&lt;li&gt;UI tweaks&lt;/li&gt;
&lt;li&gt;All previous xaps are remembered and displayed in a ListBox for your future selection&lt;/li&gt;
&lt;li&gt;Analytics are now disabled for debug builds or when running under debugger&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;u&gt;v 2.02 Beta&lt;/u&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Added analytics to figure out what areas are most used and need more attention&lt;/li&gt;
&lt;li&gt;1st round of feedback from David Rickard	(thanks!)
&lt;ul&gt;&lt;li&gt;File selection textbox now stretches with the window&lt;/li&gt;
&lt;li&gt;Tweaked unhandled exception message&lt;/li&gt;
&lt;li&gt;Window size and position are now restored on launch &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;u&gt;v 2.0.1 Beta&lt;/u&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Removed manifest signing to clear up future upgrade paths&lt;/li&gt;
&lt;li&gt;Fixed Bug #23 which blocked the tool running on ZH-CN&lt;/li&gt;
&lt;li&gt;Rewrote IsolatedStorage Drag and Drop to make it a lot more robust&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;u&gt;v 2.0 Beta&lt;/u&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Support for both WP7.5 and WP8 (device + emulator)&lt;/li&gt;
&lt;li&gt;New UI (still rough around the edges)&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;&lt;u&gt;Planned items&lt;/u&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Actions on a background thread&lt;/li&gt;
&lt;li&gt;More UI refinement&lt;/li&gt;
&lt;li&gt;More detailed error messages to match new error codes&lt;/li&gt;
&lt;li&gt;Profiler&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>nachmore</author><pubDate>Wed, 01 May 2013 16:47:46 GMT</pubDate><guid isPermaLink="false">Updated Release: Windows Phone Power Tools 2.5.07 for WP 8 (Apr 30, 2013) 20130501044746P</guid></item><item><title>Released: Windows Phone Power Tools 2.5.07 for WP 8 (Apr 30, 2013)</title><link>http://wptools.codeplex.com/releases/view/97029</link><description>
&lt;div class="wikidoc"&gt;Newly updated version of the tools that supports Windows 8 and the Windows Phone 8 SDK. This version should work with both WP 7.5 devices / emulators and the WP8 devices and emulators.&lt;br&gt;
&lt;br&gt;
Please note! The profiler feature is in Beta and is missing some basic fit, finish and polish, please report bugs and feature requests on our issue tracker (&lt;a href="http://wptools.codeplex.com/workitem/list/basic"&gt;http://wptools.codeplex.com/workitem/list/basic&lt;/a&gt;).&lt;br&gt;
&lt;br&gt;
&lt;u&gt;Changelist&lt;/u&gt;&lt;br&gt;
&lt;br&gt;
&lt;u&gt;v2.5.07&lt;/u&gt;
&lt;ul&gt;
&lt;li&gt;Removed all references to System.Web &lt;/li&gt;&lt;li&gt;Cut down download size from 3.2MB to 0.4MB&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
&lt;u&gt;v2.5.06&lt;/u&gt;
&lt;ul&gt;
&lt;li&gt;Removed dependency on Web.Mvc &lt;/li&gt;&lt;li&gt;Fixed escaping of etl paths when opening them in wpa&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
&lt;u&gt;v2.5.01-5&lt;/u&gt;
&lt;ul&gt;
&lt;li&gt;Removed debug code that was causing a crash when configuring the profiler for the first time
&lt;/li&gt;&lt;li&gt;Slight tweak to the standard trace session to collect CPU usage &lt;/li&gt;&lt;li&gt;Added prompt to restart the Power Tools after profiler installation (CoreCon needs to be refreshed)
&lt;/li&gt;&lt;li&gt;Fixed profiler analytics&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
&lt;u&gt;v2.5&lt;/u&gt;
&lt;ul&gt;
&lt;li&gt;After quite a bit of work the profiler is finally here! It&amp;#39;s a full(ish) ETW profiler that gives you near complete control over your profiling sessions. It&amp;#39;s still in Beta, here are some caveats / coming features which should all be fixed in future
 versions:
&lt;ul&gt;
&lt;li&gt;ETLs are saved to My Documents &lt;/li&gt;&lt;li&gt;ETLs are always, automatically, opened in WPA &lt;/li&gt;&lt;li&gt;There is no way to add custom providers &lt;/li&gt;&lt;li&gt;There is no way of saving a custom scenario to use again &lt;/li&gt;&lt;li&gt;You can stop an in-progress profiler, but you can&amp;#39;t cancel one &lt;/li&gt;&lt;li&gt;There isn&amp;#39;t much documentation - but I&amp;#39;m working on it. Volunteers?&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Bug 35: Fixed incorrect url for reporting issues - thanks OmegaMan! &lt;/li&gt;&lt;li&gt;Some small amounts of code cleanup and performance fixes&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
&lt;u&gt;v2.041&lt;/u&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;BUG 28: The fix to bug 27 caused an internal exception when trying to get file data for WP7 which broke the IsolatedStorage explorer for WP7. This is now fixed, though WP7 is stuck with limited file information (while WP8 has the full set).&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
&lt;u&gt;v2.04&lt;/u&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;BUG 27: Fixed issue where some file properties were not being displayed in the Remote Isolated Storage explorer
&lt;/li&gt;&lt;li&gt;BUG 26: Cap number of remembered xaps at a reasonable cap (100). There is also infrastructure to make this configurable in the future.
&lt;/li&gt;&lt;li&gt;Some slight tweaks to the elevate button to make it more visible&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
Since we haven&amp;#39;t heard about any blocking issues this version is also being marked as release. yay!&lt;br&gt;
&lt;br&gt;
&lt;u&gt;v 2.03 Beta&lt;/u&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;Removed dependency on Microsoft.Web.Infrastructure that was blocking some installs (bug #25)
&lt;/li&gt;&lt;li&gt;UI tweaks &lt;/li&gt;&lt;li&gt;All previous xaps are remembered and displayed in a ListBox for your future selection
&lt;/li&gt;&lt;li&gt;Analytics are now disabled for debug builds or when running under debugger&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
&lt;u&gt;v 2.02 Beta&lt;/u&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;Added analytics to figure out what areas are most used and need more attention
&lt;/li&gt;&lt;li&gt;1st round of feedback from David Rickard (thanks!)
&lt;ul&gt;
&lt;li&gt;File selection textbox now stretches with the window &lt;/li&gt;&lt;li&gt;Tweaked unhandled exception message &lt;/li&gt;&lt;li&gt;Window size and position are now restored on launch &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
&lt;u&gt;v 2.0.1 Beta&lt;/u&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;Removed manifest signing to clear up future upgrade paths &lt;/li&gt;&lt;li&gt;Fixed Bug #23 which blocked the tool running on ZH-CN &lt;/li&gt;&lt;li&gt;Rewrote IsolatedStorage Drag and Drop to make it a lot more robust&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
&lt;u&gt;v 2.0 Beta&lt;/u&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;Support for both WP7.5 and WP8 (device &amp;#43; emulator) &lt;/li&gt;&lt;li&gt;New UI (still rough around the edges)&lt;/li&gt;&lt;/ul&gt;
&lt;br&gt;
&lt;u&gt;Planned items&lt;/u&gt;&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;Actions on a background thread &lt;/li&gt;&lt;li&gt;More UI refinement &lt;/li&gt;&lt;li&gt;More detailed error messages to match new error codes &lt;/li&gt;&lt;li&gt;Profiler&lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
</description><author></author><pubDate>Wed, 01 May 2013 16:47:46 GMT</pubDate><guid isPermaLink="false">Released: Windows Phone Power Tools 2.5.07 for WP 8 (Apr 30, 2013) 20130501044746P</guid></item><item><title>Commented Issue: Failure to launch, requiring Microsoft.Web.Infrastructure  [25]</title><link>http://wptools.codeplex.com/workitem/25</link><description>As reported by toaderadrian&amp;#58;&lt;br /&gt;&lt;br /&gt;I&amp;#39;m having some problems with Power Tools for Windows Phone 8 platform since yesterday. Suddenly it stopped working and when I try to install it again I get an error saying that I need a System Update and I require the assembly Microsoft.Web.Infrastructure Version 1.0.0.0 install in GAC. Don&amp;#39;t know how to do that..&lt;br /&gt;&lt;br /&gt;This also occurred to other two colleagues of mine. Do you have a solution for this&amp;#63;&lt;br /&gt;Comments: It was fixed in 2.5.07 &amp;#40;see https&amp;#58;&amp;#47;&amp;#47;wptools.codeplex.com&amp;#47;workitem&amp;#47;38&amp;#41;.</description><author>mstorsjo</author><pubDate>Wed, 01 May 2013 10:04:22 GMT</pubDate><guid isPermaLink="false">Commented Issue: Failure to launch, requiring Microsoft.Web.Infrastructure  [25] 20130501100422A</guid></item><item><title>New Post: Microsoft.Web.Infrastructure Version 1.0.0.0 be installed in the Global Assembly Cache first</title><link>http://wptools.codeplex.com/discussions/441953</link><description>&lt;div style="line-height: normal;"&gt;Hey Liisa57,&lt;br /&gt;
&lt;br /&gt;
This is now fixed in 2.5.07 :)&lt;br /&gt;
&lt;br /&gt;
Oren&lt;br /&gt;
&lt;/div&gt;</description><author>nachmore</author><pubDate>Wed, 01 May 2013 06:22:06 GMT</pubDate><guid isPermaLink="false">New Post: Microsoft.Web.Infrastructure Version 1.0.0.0 be installed in the Global Assembly Cache first 20130501062206A</guid></item><item><title>Closed Unassigned: web.infrastructure [38]</title><link>http://wptools.codeplex.com/workitem/38</link><description>See attached.&lt;br /&gt;Comments: Closed in 2.5.07</description><author>nachmore</author><pubDate>Wed, 01 May 2013 06:21:26 GMT</pubDate><guid isPermaLink="false">Closed Unassigned: web.infrastructure [38] 20130501062126A</guid></item><item><title>Commented Unassigned: web.infrastructure [38]</title><link>http://wptools.codeplex.com/workitem/38</link><description>See attached.&lt;br /&gt;Comments: Awesome&amp;#33; Great to hear that this fixed it.</description><author>nachmore</author><pubDate>Wed, 01 May 2013 06:21:11 GMT</pubDate><guid isPermaLink="false">Commented Unassigned: web.infrastructure [38] 20130501062111A</guid></item><item><title>Commented Unassigned: web.infrastructure [38]</title><link>http://wptools.codeplex.com/workitem/38</link><description>See attached.&lt;br /&gt;Comments: Thanks - now I&amp;#39;ve finally managed to install this&amp;#33;</description><author>mstorsjo</author><pubDate>Wed, 01 May 2013 00:12:37 GMT</pubDate><guid isPermaLink="false">Commented Unassigned: web.infrastructure [38] 20130501121237A</guid></item><item><title>Commented Unassigned: can not select a device [37]</title><link>http://wptools.codeplex.com/workitem/37</link><description>When I have the device is connected,  the drop-down box is empty..&lt;br /&gt;version&amp;#58;2.05.486289&lt;br /&gt;Comments: Weird - is this consistent&amp;#63;</description><author>nachmore</author><pubDate>Tue, 30 Apr 2013 23:51:54 GMT</pubDate><guid isPermaLink="false">Commented Unassigned: can not select a device [37] 20130430115154P</guid></item><item><title>Commented Unassigned: web.infrastructure [38]</title><link>http://wptools.codeplex.com/workitem/38</link><description>See attached.&lt;br /&gt;Comments: Ok - this should, hopefully, be fixed in 2.5.07 which I just pushed. Sorry for the rundaround and thanks for all the info&amp;#33;</description><author>nachmore</author><pubDate>Tue, 30 Apr 2013 23:51:12 GMT</pubDate><guid isPermaLink="false">Commented Unassigned: web.infrastructure [38] 20130430115112P</guid></item></channel></rss>