title: Monitoring application code
body: <p>Ι am using visual studio 2015 rc community.</p>
  
  <p>Ι write simple function that should download html source pages, and show the result richtextbox.</p>
  
  <p>For Example:</p>
  
  <pre><code>Imports System.Text
  
  Public Class frmMain
      Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
          RichTextBox1.Text = PagesDownloader(4, 8) ' Download Pages from 4 to 8
      End Sub
  
      Private Function PagesDownloader(StartPage As Integer, EndPage As Integer)
          Const SiteUrl As String = "http://MySite.co.il/TestPage.php?id={0}" ' Every Html Page size is 30MB
          Dim WebClnt As New System.Net.WebClient
          Dim SourceResults As New StringBuilder
  
          For i = StartPage To EndPage - 1
              SourceResults.AppendLine("Page: " &amp; i)
              SourceResults.AppendLine(String.Format(WebClnt.DownloadString(SiteUrl), i))
              SourceResults.AppendLine("-------------" &amp; vbNewLine)
          Next
  
          Return SourceResults.ToString
  
      End Function
  
  
  End Class
  </code></pre>
  
  <p>the steps of the code after he is run, is something like that:</p>
  
  <ol>
  <li>Get connected with the server</li>
  <li>Download the page from the server</li>
  <li>write the html page to memory</li>
  <li>build string with html source code</li>
  <li>repeat the steps until the "end page" come to last number (finish).</li>
  </ol>
  
  <p>Now I ask, how I can get the time for every code line that take to program / my PC for executing the code? And how much power is taken from hardware in my PC (and from what is take)?</p>
  
  <p>For example, if the html source code file size is 30 MB, is depending on my internet speed and the server speed. How do I get that information?</p>
  
  <p><strong>I hope this is understandable, if not I'd be happy to try to explain again.
  Overall, I am looking monitor the performance of the code, and how it affects hardware.</strong></p>