Reputation: 3285
Is it possible to check how long a particular segment of code takes to execute, just want to see if some loops etc. can be optimized better or use LinQ.
Is there such function built into Visual Studio or must I do this with some code, stopwatch class etc.?
Thanks.
Upvotes: 1
Views: 193
Reputation: 19020
Visual Studio Premium/Ultimate/Team versions come with a profiler. Otherwise you have to do your own profiling with the StopWatch
class.
Upvotes: 0
Reputation: 1205
If you have VS2010 Ultimate:
From the Analyze
menu, select the Launch Performance Wizard
option.
Its been a while since I last used it, but I believe it tells you how long things take to execute and what's using up the most memory, and so on =)
Otherwise, you'll have to use the Stopwatch
class or a third party profiler.
Upvotes: 1
Reputation: 89577
var sw = Stopwatch.StartNew();
// you code.
sw.ElapsedMilliseconds;
Or you can use built in VS Profiler. You can find more on how to use VS profiler in Find Application Bottlenecks with Visual Studio Profiler
Upvotes: 2