This was some thing i got to learn yesterday. I was using some profiler and some random ways to get the time. but this was a quick one. I knew something like this existed but never bothered until I had to use it
There is a Stopwatch class in c# that does that for you.
You can find more details at: http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx
all you need to do is
Stopwatch sw = new Stopwatch();
sw.Start();
Debug.WriteLine(sw.ElapsedMilliseconds.ToString());
sw.Stop();