<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Samurai Programmer.com - Perfmon</title>
    <link>http://www.samuraiprogrammer.com/blog/</link>
    <description>I know kung fu</description>
    <language>en-us</language>
    <copyright>Greg Varveris</copyright>
    <lastBuildDate>Sat, 19 Nov 2011 13:45:14 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>greg@samuraiprogrammer.com</managingEditor>
    <webMaster>greg@samuraiprogrammer.com</webMaster>
    <item>
      <trackback:ping>http://www.samuraiprogrammer.com/blog/Trackback.aspx?guid=640974ce-fd96-4cad-bcd0-6c45ed248018</trackback:ping>
      <pingback:server>http://www.samuraiprogrammer.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.samuraiprogrammer.com/blog/PermaLink,guid,640974ce-fd96-4cad-bcd0-6c45ed248018.aspx</pingback:target>
      <dc:creator>Greg Varveris</dc:creator>
      <wfw:comment>http://www.samuraiprogrammer.com/blog/CommentView,guid,640974ce-fd96-4cad-bcd0-6c45ed248018.aspx</wfw:comment>
      <wfw:commentRss>http://www.samuraiprogrammer.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=640974ce-fd96-4cad-bcd0-6c45ed248018</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
So in a code-base I was working in yesterday, we use PInvoke to call out to the Performance
Data Helper (PDH) API’s to collect performance information for machines without using
Perfmon.  One of those PInvoke calls looked like this:
</p>
        <pre class="c#" name="code">/*<br />
PDH_STATUS PdhExpandCounterPath(<br />
LPCTSTR szWildCardPath,<br />
LPTSTR mszExpandedPathList,<br />
LPDWORD pcchPathListLength<br />
);<br />
*/<br />
[DllImport("pdh.dll", CharSet = CharSet.Unicode)]<br />
private static extern PdhStatus PdhExpandCounterPath(<br />
string szWildCardPath,<br />
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] char[] mszExpandedPathList,<br />
ref uint pcchPathListLength<br />
);</pre>
        <p>
In .NET 3.5 and below, this PInvoke call works perfectly fine.  In .NET 4.0,
though, I saw this exception:
</p>
        <pre>System.Runtime.InteropServices.MarshalDirectiveException: 
<br />
Cannot marshal 'parameter #2': Array size control parameter index is out of range. 
<br />
at System.Runtime.InteropServices.Marshal.InternalPrelink(IRuntimeMethodInfo m) 
<br />
at System.Runtime.InteropServices.Marshal.Prelink(MethodInfo m)</pre>
        <p>
So, can you identify what’s wrong in the code above?
</p>
        <p>
Well, the Array size control parameter index indicates the zero-based parameter that
contains the count of the array elements, similar to size_is in COM.  Because
the marshaler cannot determine the size of an unmanaged array, you have to pass it
in as a separate parameter.  So in the call above, parameter #2, we specify “SizeParamIndex
= 3” to reference the pcchPathListLength parameter to set the length of the array. 
So what’s the catch?
</p>
        <p>
Well, since the SizeParamIndex is a zero-based index, the 3rd parameter doesn’t really
exist.  So, to fix this, we just change the “SizeParamIndex=3” to “SizeParamIndex=2”
to reference the pcchPathListLength:
</p>
        <pre class="c#" name="code">/*<br />
PDH_STATUS PdhExpandCounterPath(<br />
LPCTSTR szWildCardPath,<br />
LPTSTR mszExpandedPathList,<br />
LPDWORD pcchPathListLength<br />
);<br />
*/<br />
[DllImport("pdh.dll", CharSet = CharSet.Unicode)]<br />
private static extern PdhStatus PdhExpandCounterPath(<br />
string szWildCardPath,<br />
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] char[] mszExpandedPathList,<br />
ref uint pcchPathListLength<br />
);</pre>
        <p>
It looks like in .NET 3.5 and below, though, we allowed you to reference either 1-based
index or a zero-based index but in .NET 4.0, we buttoned that up a bit and force you
to use the zero-based index.    Big thanks to my co-worker and frequent
collaborator, <a href="http://blogs.msdn.com/b/pfedev/" target="_blank">Zach Kramer</a> for
his assistance in looking at this issue.
</p>
        <p>
Until Next Time!
</p>
      </body>
      <title>PInvoke Error in .NET 4: Array size control parameter index is out of range</title>
      <guid isPermaLink="false">http://www.samuraiprogrammer.com/blog/PermaLink,guid,640974ce-fd96-4cad-bcd0-6c45ed248018.aspx</guid>
      <link>http://www.samuraiprogrammer.com/blog/2011/11/19/PInvokeErrorInNET4ArraySizeControlParameterIndexIsOutOfRange.aspx</link>
      <pubDate>Sat, 19 Nov 2011 13:45:14 GMT</pubDate>
      <description>&lt;p&gt;
So in a code-base I was working in yesterday, we use PInvoke to call out to the Performance
Data Helper (PDH) API’s to collect performance information for machines without using
Perfmon.&amp;#160; One of those PInvoke calls looked like this:
&lt;/p&gt;
&lt;pre class="c#" name="code"&gt;/*&lt;br /&gt;
PDH_STATUS PdhExpandCounterPath(&lt;br /&gt;
LPCTSTR szWildCardPath,&lt;br /&gt;
LPTSTR mszExpandedPathList,&lt;br /&gt;
LPDWORD pcchPathListLength&lt;br /&gt;
);&lt;br /&gt;
*/&lt;br /&gt;
[DllImport(&amp;quot;pdh.dll&amp;quot;, CharSet = CharSet.Unicode)]&lt;br /&gt;
private static extern PdhStatus PdhExpandCounterPath(&lt;br /&gt;
string szWildCardPath,&lt;br /&gt;
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] char[] mszExpandedPathList,&lt;br /&gt;
ref uint pcchPathListLength&lt;br /&gt;
);&lt;/pre&gt;
&lt;p&gt;
In .NET 3.5 and below, this PInvoke call works perfectly fine.&amp;#160; In .NET 4.0,
though, I saw this exception:
&lt;/p&gt;
&lt;pre&gt;System.Runtime.InteropServices.MarshalDirectiveException: 
&lt;br /&gt;
Cannot marshal 'parameter #2': Array size control parameter index is out of range. 
&lt;br /&gt;
at System.Runtime.InteropServices.Marshal.InternalPrelink(IRuntimeMethodInfo m) 
&lt;br /&gt;
at System.Runtime.InteropServices.Marshal.Prelink(MethodInfo m)&lt;/pre&gt;
&lt;p&gt;
So, can you identify what’s wrong in the code above?
&lt;/p&gt;
&lt;p&gt;
Well, the Array size control parameter index indicates the zero-based parameter that
contains the count of the array elements, similar to size_is in COM.&amp;#160; Because
the marshaler cannot determine the size of an unmanaged array, you have to pass it
in as a separate parameter.&amp;#160; So in the call above, parameter #2, we specify “SizeParamIndex
= 3” to reference the pcchPathListLength parameter to set the length of the array.&amp;#160;
So what’s the catch?
&lt;/p&gt;
&lt;p&gt;
Well, since the SizeParamIndex is a zero-based index, the 3rd parameter doesn’t really
exist.&amp;#160; So, to fix this, we just change the “SizeParamIndex=3” to “SizeParamIndex=2”
to reference the pcchPathListLength:
&lt;/p&gt;
&lt;pre class="c#" name="code"&gt;/*&lt;br /&gt;
PDH_STATUS PdhExpandCounterPath(&lt;br /&gt;
LPCTSTR szWildCardPath,&lt;br /&gt;
LPTSTR mszExpandedPathList,&lt;br /&gt;
LPDWORD pcchPathListLength&lt;br /&gt;
);&lt;br /&gt;
*/&lt;br /&gt;
[DllImport(&amp;quot;pdh.dll&amp;quot;, CharSet = CharSet.Unicode)]&lt;br /&gt;
private static extern PdhStatus PdhExpandCounterPath(&lt;br /&gt;
string szWildCardPath,&lt;br /&gt;
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] char[] mszExpandedPathList,&lt;br /&gt;
ref uint pcchPathListLength&lt;br /&gt;
);&lt;/pre&gt;
&lt;p&gt;
It looks like in .NET 3.5 and below, though, we allowed you to reference either 1-based
index or a zero-based index but in .NET 4.0, we buttoned that up a bit and force you
to use the zero-based index.&amp;#160;&amp;#160;&amp;#160; Big thanks to my co-worker and frequent
collaborator, &lt;a href="http://blogs.msdn.com/b/pfedev/" target="_blank"&gt;Zach Kramer&lt;/a&gt; for
his assistance in looking at this issue.
&lt;/p&gt;
&lt;p&gt;
Until Next Time!
&lt;/p&gt;</description>
      <comments>http://www.samuraiprogrammer.com/blog/CommentView,guid,640974ce-fd96-4cad-bcd0-6c45ed248018.aspx</comments>
      <category>.NET 4</category>
      <category>Perfmon</category>
      <category>Performance</category>
    </item>
    <item>
      <trackback:ping>http://www.samuraiprogrammer.com/blog/Trackback.aspx?guid=3acb3cdd-ccc7-4e87-a812-da7b080682a6</trackback:ping>
      <pingback:server>http://www.samuraiprogrammer.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.samuraiprogrammer.com/blog/PermaLink,guid,3acb3cdd-ccc7-4e87-a812-da7b080682a6.aspx</pingback:target>
      <dc:creator>Greg Varveris</dc:creator>
      <wfw:comment>http://www.samuraiprogrammer.com/blog/CommentView,guid,3acb3cdd-ccc7-4e87-a812-da7b080682a6.aspx</wfw:comment>
      <wfw:commentRss>http://www.samuraiprogrammer.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3acb3cdd-ccc7-4e87-a812-da7b080682a6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.samuraiprogrammer.com/blog/2010/08/03/AzureWhyDidMyRoleCrash.aspx">I’ve
blogged before about how some things are different in the cloud, namely Azure</a>. 
That post dealt with finding out why your Azure Role crashed by using some of the
logging facilities and storage available in Azure.  That’s kind of a worst case
scenario, though.  Often, you’ll just want to gauge the health of your application. 
In the non-cloud world, you’d just use the <a href="http://technet.microsoft.com/en-us/library/cc749249.aspx">Windows
Performance Monitor</a> to capture performance counters that tell you things like
your CPU utilization, memory usage, request execution time, etc.  All of these
counters are great to determine your overall application and server health as well
as helping you troubleshoot problems that may have arisen with your application.  
</p>
        <blockquote>
          <p>
            <em>I’m often surprised at how many developers have never used Perfmon before or think
that it is purely a task that administrators need to care about.  Performance
is everyone’s responsibility and a tool like Perfmon is invaluable if you need to
gain an accurate understanding of your application’s performance.</em>  
</p>
        </blockquote>
        <p>
When you’ve needed to log counters in the past, you would have probably become familiar
with this dialog:
</p>
        <p>
          <a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_2.png">
            <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb.png" width="524" height="391" />
          </a>
        </p>
        <p>
In the Azure world, you can add counters to be collected in a variety of ways. 
A popular way is just to add the counters you want in your OnStart() event.  
</p>
        <pre class="c#" name="code">public override bool OnStart()<br />
{<br />
DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();<br /><br />
// Add counter(s) to collect.<br />
dmc.PerformanceCounters.DataSources.Add(<br />
new PerformanceCounterConfiguration()<br />
{<br />
CounterSpecifier = @"\Processor(*)\*",<br />
SampleRate = TimeSpan.FromSeconds(5)<br />
});<br /><br />
// Set transfer period and filter.<br />
dmc.PerformanceCounters.ScheduledTransferPeriod = TimeSpan.FromMinutes(5);<br /><br />
// Start logging, using the connection string in your config file.<br />
DiagnosticMonitor.Start("DiagnosticsConnectionString", dmc);<br /><br />
...<br /><br />
return base.OnStart();<br />
}</pre>
        <p>
This gets the job done quite nicely and even though we’re sampling our performance
counter every 5 seconds, the data won’t get written to our persistent storage until
we hit the 5 minute mark.
</p>
        <p>
So, let’s fast forward a bit.  You’ve added counters to monitor and now you want
to view some of this data.   Fortunately, there are a few tools at your
disposal:
</p>
        <ul>
          <li>
            <a href="http://code.msdn.microsoft.com/windowsazuremmc">Windows Azure Management
Tool (MMC)</a>
          </li>
          <li>
            <a href="http://www.cerebrata.com/Default.aspx">Cloud Storage Studio/Azure Diagnostics
Manager</a>
          </li>
        </ul>
        <p>
For example, using the Azure Management Tool, you can navigate to the Diagnostics/Analysis
section to view the performance monitor counters you stored.  
</p>
        <p>
          <a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_4.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_1.png" width="644" height="273" />
          </a>
        </p>
        <p>
Herein lies one of the challenges you may encounter.  Azure is kind of a different
beast and it doesn’t store the data in storage using the typical BLG format. 
Instead, if you look at the raw data, it will be in an XML or tabular format and may
look like:
</p>
        <p>
          <a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_8.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_3.png" width="644" height="177" />
          </a>
        </p>
        <p>
While this is nice and clean, the problem you’ll hit is the visualization of the data. 
Most organizations use Perfmon to visualize the counter data you record.  Alas,
in this case you can’t use it that way right out of the box.  Fortunately, my
friend <a href="http://blogs.msdn.com/b/developertofu/">Tom Fuller</a> and I realized
this gap and he wrote a plug-in to the Azure Management Tool that will transform this
data from the format above into a native BLG format.  <a href="http://blogs.msdn.com/b/developertofu/archive/2010/08/17/announcing-the-perfmon-friendly-azure-log-viewer-plug-in.aspx">He
wrote up a great blog entry with step-by-step instructions and the source code here</a>.
You can also <a href="http://code.msdn.microsoft.com/windowsazuremmc/Release/ProjectReleases.aspx?ReleaseId=4342">download
a compiled version of the extension here (along with the Windows Azure MMC) here</a>. 
To install the plugin, just copy the DLL into the \WindowsAzureMMC\release folder:
</p>
        <p>
          <a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_10.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_4.png" width="342" height="238" />
          </a>
        </p>
        <p>
Then, when you open up the tool, you’ll see another option in that dropdown in the
Diagnostics &gt; Analysis window:
</p>
        <p>
          <a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_12.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_5.png" width="640" height="226" />
          </a>
        </p>
        <p>
Then, when you click show, you’ll get a nice popup telling you to click here to view
your data in Perfmon:
</p>
        <p>
          <a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_14.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_6.png" width="173" height="188" />
          </a>
        </p>
        <p>
Then, when you click on it, Perfmon will start with all of the counters added to the
display:
</p>
        <p>
          <a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_16.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_7.png" width="644" height="481" />
          </a>
        </p>
        <p>
A few things to note:
</p>
        <ul>
          <li>
It will store the resulting BLG file at the following path:</li>
        </ul>
        <blockquote>
          <p>
            <strong>
              <em>c:\Users\&lt;user name&gt;\AppData\Local\Temp\&lt;File Name&gt;.blg</em>
            </strong>
          </p>
          <p>
The BLG can be used in a variety of applications.  For example, <a href="http://pal.codeplex.com/">you
can use it with the great PAL tool</a>.   
</p>
        </blockquote>
        <ul>
          <li>
All of the counters will appear in the graph by default.  Depending upon the
amount of data you’re capturing, this could give you data overload.  Just something
to be aware of.</li>
        </ul>
        <p>
Until next time.
</p>
      </body>
      <title>Visualizing Azure performance counters…</title>
      <guid isPermaLink="false">http://www.samuraiprogrammer.com/blog/PermaLink,guid,3acb3cdd-ccc7-4e87-a812-da7b080682a6.aspx</guid>
      <link>http://www.samuraiprogrammer.com/blog/2010/09/27/VisualizingAzurePerformanceCounters.aspx</link>
      <pubDate>Mon, 27 Sep 2010 05:19:44 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.samuraiprogrammer.com/blog/2010/08/03/AzureWhyDidMyRoleCrash.aspx"&gt;I’ve
blogged before about how some things are different in the cloud, namely Azure&lt;/a&gt;.&amp;#160;
That post dealt with finding out why your Azure Role crashed by using some of the
logging facilities and storage available in Azure.&amp;#160; That’s kind of a worst case
scenario, though.&amp;#160; Often, you’ll just want to gauge the health of your application.&amp;#160;
In the non-cloud world, you’d just use the &lt;a href="http://technet.microsoft.com/en-us/library/cc749249.aspx"&gt;Windows
Performance Monitor&lt;/a&gt; to capture performance counters that tell you things like
your CPU utilization, memory usage, request execution time, etc.&amp;#160; All of these
counters are great to determine your overall application and server health as well
as helping you troubleshoot problems that may have arisen with your application.&amp;#160; 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;em&gt;I’m often surprised at how many developers have never used Perfmon before or think
that it is purely a task that administrators need to care about.&amp;#160; Performance
is everyone’s responsibility and a tool like Perfmon is invaluable if you need to
gain an accurate understanding of your application’s performance.&lt;/em&gt;&amp;#160; 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
When you’ve needed to log counters in the past, you would have probably become familiar
with this dialog:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb.png" width="524" height="391" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In the Azure world, you can add counters to be collected in a variety of ways.&amp;#160;
A popular way is just to add the counters you want in your OnStart() event.&amp;#160; 
&lt;/p&gt;
&lt;pre class="c#" name="code"&gt;public override bool OnStart()&lt;br /&gt;
{&lt;br /&gt;
DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();&lt;br /&gt;
&lt;br /&gt;
// Add counter(s) to collect.&lt;br /&gt;
dmc.PerformanceCounters.DataSources.Add(&lt;br /&gt;
new PerformanceCounterConfiguration()&lt;br /&gt;
{&lt;br /&gt;
CounterSpecifier = @&amp;quot;\Processor(*)\*&amp;quot;,&lt;br /&gt;
SampleRate = TimeSpan.FromSeconds(5)&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
// Set transfer period and filter.&lt;br /&gt;
dmc.PerformanceCounters.ScheduledTransferPeriod = TimeSpan.FromMinutes(5);&lt;br /&gt;
&lt;br /&gt;
// Start logging, using the connection string in your config file.&lt;br /&gt;
DiagnosticMonitor.Start(&amp;quot;DiagnosticsConnectionString&amp;quot;, dmc);&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
return base.OnStart();&lt;br /&gt;
}&lt;/pre&gt;
&lt;p&gt;
This gets the job done quite nicely and even though we’re sampling our performance
counter every 5 seconds, the data won’t get written to our persistent storage until
we hit the 5 minute mark.
&lt;/p&gt;
&lt;p&gt;
So, let’s fast forward a bit.&amp;#160; You’ve added counters to monitor and now you want
to view some of this data.&amp;#160;&amp;#160; Fortunately, there are a few tools at your
disposal:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://code.msdn.microsoft.com/windowsazuremmc"&gt;Windows Azure Management
Tool (MMC)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.cerebrata.com/Default.aspx"&gt;Cloud Storage Studio/Azure Diagnostics
Manager&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
For example, using the Azure Management Tool, you can navigate to the Diagnostics/Analysis
section to view the performance monitor counters you stored.&amp;#160; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_1.png" width="644" height="273" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Herein lies one of the challenges you may encounter.&amp;#160; Azure is kind of a different
beast and it doesn’t store the data in storage using the typical BLG format.&amp;#160;
Instead, if you look at the raw data, it will be in an XML or tabular format and may
look like:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_8.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_3.png" width="644" height="177" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
While this is nice and clean, the problem you’ll hit is the visualization of the data.&amp;#160;
Most organizations use Perfmon to visualize the counter data you record.&amp;#160; Alas,
in this case you can’t use it that way right out of the box.&amp;#160; Fortunately, my
friend &lt;a href="http://blogs.msdn.com/b/developertofu/"&gt;Tom Fuller&lt;/a&gt; and I realized
this gap and he wrote a plug-in to the Azure Management Tool that will transform this
data from the format above into a native BLG format.&amp;#160; &lt;a href="http://blogs.msdn.com/b/developertofu/archive/2010/08/17/announcing-the-perfmon-friendly-azure-log-viewer-plug-in.aspx"&gt;He
wrote up a great blog entry with step-by-step instructions and the source code here&lt;/a&gt;.
You can also &lt;a href="http://code.msdn.microsoft.com/windowsazuremmc/Release/ProjectReleases.aspx?ReleaseId=4342"&gt;download
a compiled version of the extension here (along with the Windows Azure MMC) here&lt;/a&gt;.&amp;#160;
To install the plugin, just copy the DLL into the \WindowsAzureMMC\release folder:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_10.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_4.png" width="342" height="238" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Then, when you open up the tool, you’ll see another option in that dropdown in the
Diagnostics &amp;gt; Analysis window:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_12.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_5.png" width="640" height="226" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Then, when you click show, you’ll get a nice popup telling you to click here to view
your data in Perfmon:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_14.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_6.png" width="173" height="188" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Then, when you click on it, Perfmon will start with all of the counters added to the
display:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_16.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.samuraiprogrammer.com/blog/content/binary/Windows-Live-Writer/67a06ba55268_8DEA/image_thumb_7.png" width="644" height="481" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
A few things to note:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
It will store the resulting BLG file at the following path:&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;&lt;em&gt;c:\Users\&amp;lt;user name&amp;gt;\AppData\Local\Temp\&amp;lt;File Name&amp;gt;.blg&lt;/em&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
The BLG can be used in a variety of applications.&amp;#160; For example, &lt;a href="http://pal.codeplex.com/"&gt;you
can use it with the great PAL tool&lt;/a&gt;.&amp;#160;&amp;#160; 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;ul&gt;
&lt;li&gt;
All of the counters will appear in the graph by default.&amp;#160; Depending upon the
amount of data you’re capturing, this could give you data overload.&amp;#160; Just something
to be aware of.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Until next time.
&lt;/p&gt;</description>
      <comments>http://www.samuraiprogrammer.com/blog/CommentView,guid,3acb3cdd-ccc7-4e87-a812-da7b080682a6.aspx</comments>
      <category>Azure</category>
      <category>Perfmon</category>
    </item>
  </channel>
</rss>