Skip to content

Instantly share code, notes, and snippets.

@Cotoff
Created March 27, 2014 07:53
Show Gist options
  • Save Cotoff/9802465 to your computer and use it in GitHub Desktop.
Save Cotoff/9802465 to your computer and use it in GitHub Desktop.
class Timer : IDisposable
{
private readonly string m_Text;
private Stopwatch m_Stopwatch;
public Timer(string text)
{
m_Text = text;
m_Stopwatch = Stopwatch.StartNew();
}
public void Dispose()
{
m_Stopwatch.Stop();
Debug.Log(string.Format("Profiled {0}: {1:0.00}ms", m_Text, m_Stopwatch.ElapsedMilliseconds));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment