15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

488 ❘ ChaPTer 19 instrumentAtiOn<br />

}<br />

{<br />

}<br />

buttonCount.IsEnabled = true;<br />

timer = new DispatcherTimer(TimeSpan.FromSeconds(1),<br />

DispatcherPriority.Background,<br />

delegate<br />

{<br />

this.performanceCounterButtonClicksPerSec.RawValue =<br />

this.clickCountPerSec;<br />

this.clickCountPerSec = 0;<br />

this.performanceCounterMouseMoveEventsPerSec.RawValue =<br />

this.mouseMoveCountPerSec;<br />

this.mouseMoveCountPerSec = 0;<br />

},<br />

Dispatcher.CurrentDispatcher);<br />

timer.Start();<br />

perfmon.exe<br />

Now you can monitor the application. You can start the Performance Monitor from the Administrative<br />

Tools. Within the Performance Monitor, click the + button in the toolbar; there, you can add performance<br />

counts. Wrox Performance Counters shows up as a performance object. All the counters that have been<br />

configured appear in the counter list, as shown in Figure 19-8.<br />

figure 19-8<br />

After you have added the counters to the performance monitor, you can see the actual values of the service<br />

over time (see Figure 19-9). Using this performance tool, you can also create log files to analyze the performance<br />

at a later time.<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!