title: Page Render Time in MVC
body: <p>Q: How do I calculate the total time it takes to render an MVC page and display the time on the master page.</p>
  
  <p>In Asp.net Web Form I created a Base page class like so:</p>
  
  <pre><code>public class PageBase : System.Web.UI.Page
  {      
      private DateTime startTime = DateTime.Now;
      private TimeSpan renderTime;   
      public DateTime StartTime
      {
          set { startTime = value; }
          get { return startTime; }
      }  
      public virtual string PageRenderTime
      {
          get
          {
              renderTime = DateTime.Now - startTime;
              return renderTime.Seconds + "." + renderTime.Milliseconds + " seconds";
          }
      }       
  }
  </code></pre>
  
  <p>I would then call the method on my Master Page like so:</p>
  
  <pre><code>&lt;div id="performance"&gt;
       &lt;% =PageRenderTime %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Q: How do I accomplish the same thing with the MVC Framework?</p>
  
  <p>Q: With the MVC framework where do I set the start time when a page is first created? </p>