Reputation: 271
C# code
Is it possible find the execution time of a set of code in visual studio?
if visual studio does provide any tools for this what are the alternatives?
are there any free reliable tools to download?
SQL server management studio
Is it possible find the execution time of a set of code in SQL server Management studio?
if SQL server Management studio does provide any tools for this what are the alternatives?
are there any free reliable tools to download?
thanks
Upvotes: 3
Views: 1353
Reputation: 13484
For SSMS Query execution time in miliseconds in SQL Server Management Studio
If you need to get query execution time in milliseconds in SQL Server Management Studio, there is a simple way to achieve this.
set statistics time on
-- your query
set statistics time off
This will result in following lin in Messages window:
SQL Server Execution Times: CPU time = 16 ms, elapsed time = 16 ms.
Upvotes: 2
Reputation: 1510
For C# if you don't want to use the profiler, and just want to know how long it took for a certain piece of code to execute you can use the stopwatch.
var sw = StopWatch.StartNew();
//some code...
sw.Stop();
Console.Writeline(sw.Elapsed);
Upvotes: 0
Reputation: 17001
If you just want to do some quick and dirty timing checks in .NET you can always create a stopwatch then start and stop it around the code in question. Quick, Free, and Ugly.
Upvotes: 1
Reputation: 1171
For C#:
Take a look at Profiling Manager in Visual Studio. It works wonders and solves many of life's programming problems trying to hunt down performance issues. It's under the Test menu in VS2010.
It can use several different techniques that you can choose from to best suit your performance debugging needs.
For SQL:
I typically just use performance timers, or DateTime
s. Used in a stopwatch-like fashion.
Upvotes: 1