Oct
10
2012

How to use Stopwatch in javascript

With stopwatch you can check how long some function takes..

var stopwatch:System.Diagnostics.Stopwatch  = new System.Diagnostics.Stopwatch();
stopwatch.Start();

// your function here..

stopwatch.Stop();
Debug.Log("Timer: " + stopwatch.Elapsed);
//Debug.Log("Timer: " + stopwatch.ElapsedMilliseconds); // this one gives you the time in ms
stopwatch.Reset();

More info:
http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx


3 Comments + Add Comment

Leave a comment

Connect

Twitter View LinkedIn profile Youtube Youtube Join Discord Twitch Instagram

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.