I'm searching for software to do benchmarking, analysis, performance of code and apps.
Something like Intel VTune.
Can anyone give me some names, free or payed, targeting c# apps.
thanks
Redgate Performance Profiler
...their Memory Profiler will undoubtedly help as well.
It sounds like you have multiple purposes.
If you want to monitor the performance health of programs, benchmarks and profilers that measure are probably what you want.
If you need to make a program faster, and you have the source code for it, I think your best bet is to get something that samples the call stack and gives you line-level percent of wall-clock time. For this, don't look for high precision of timing. Look instead for high precision of pinpointing code that is responsible for high percentages of time. Especially in larger programs, these lines are function or method calls that you can find a way to avoid. Don't fall into the myth of thinking that the only problems are hotspots where the program counter lives, and don't fall into the myth that all I/O is necessary I/O.
There's a totally manual method that a few people use and works very well.
Visual Studio, in it's higher SKUs, includes multiple profilers which can be used for this purpose. If your application is using multiple threads, VS 2010's new Concurrency Profiler is incredible for profiling C# concurrent code.
There are many other performance profilers on the market which are useful for performance profiling as well. I personally like dotTrace and think it's a very clean interface.
Such a tool is usually called a Profiler.
The (free) MS CLR Profiler (up to Fx 3.5) isn't bad, and a good place to start.
Update: a 2022 Blog about this.
I've used the EQATEC profiler which is free for personal use. It benchmarks run time and helped point out the inefficiencies that were causing bottlenecks in my code.
Related
If I want to add some instrumentation in my code for getting metrics like how long a particular method took to execute, anyone has recommendation for either windows build-in or any 3rd party library?
I've seen this done with PostSharp AOP framework, hooked into Windows Performance Counters (System.Diagnostics.PerformanceCounter). One of their introductory pieces of sample code shows how to do this:
http://www.sharpcrafters.com/solutions/performance
This might be a good option if you want to deploy these measurements to production and measure performance in a live manner (to do diagnosis of a running system).
If you just want to locate bottlenecks in your code, and don't need to do live diagnosis, I suggest you simply use a profiler, such as the one built into VS or Ants Profiler (as Chris already suggested). Then run a redacted copy of your production data against your code so your performance measurements match production.
If you want this at runtime, you should probably use a profiler offline. I'd avoid doing any instrumentation where possible as it takes time and therefore causes more performance problems.
Google for RedGate ANTS Profiler or JetBrains dotTrace. If you have VS2010 Premium, it has one built in. That will give you a method-level breakdown of what is happening time-wise.
Generally a profiler will take care of measuring performance.
If you need to measure time yourself StopWatch with some sort of tracing is often enough.
We've build a Web Application which is performing horrible even with alot of resources available. My boss doesn't believe me that the application is consuming alot of Hardware IO, so I have to prove that the hardware is ok, but the web app is really crap.
The app is using:
SQL Server 2000 with SP4
The main web application (.NET 3.5)
Two Web Services (.NET 1.1)
Biztalk 2004
There are 30 people using this apps.
How can I prove I am right?
You can hook up a profiler like ANTS profiler or JetBrains DotTrace and see where the application's performance bottlenecks are.
One place you could start is getting a performance profiler like Red-Gate ANTS profiler. I've used this tool and it's very useful is weeding out performance bottlenecks.
Randy
You could start by using SQL Server Profiler to get an impression of the amount of database traffic that is going on.
I'm not saying that database interaction is the bottleneck, but it often is, and the tool is already there if you are using SQL Server, so it may be a good idea to take a look at that before you go out and buy a lot of profiling tools.
Visual Studio 2008 also have built-in performance analysis tools.
Windows performance counters are a good way to get some basic information about general system performance. Proper counters will show you if it's really the IO that's doing lots of stuff. If you take out the numbers from the counters and compare those to the specs, you should be able to tell if the system is maxing out or not.
If the system is maxing out, it's a problem with the web application, and it should be profiled to find out where to start optimizing.
You could use the system performance monitor built into windows since at least XP. You can get almost any information you could possibly need. This includes CPU time, .NET memory usage (include gen0 gen1 and gen2), native memory usage, amount of time spent garbage collection, disk access time, etc. If you just search codeproject or just the web there are many examples of using these counter to test for just about anything you want.
One of the benefits of this is you don't have to change your code and can be used with existing system.
I find this is the best starting point to point you to where you should look for bottle necks and issues.
What is the best way to see memory leaks or areas to optimize code in your .net source code?
I am using vs2005, c# , .net 2.0
Any good free tools out there that I can safely install on my work desktop?
I don't know of any good C# memory profilers, besides the functionality built into Visual Studios. But a great commercial memory profiler is ANTS Memory Profiler($495)
I've been extensively using the dotTrace profiler from JetBrains (the makers of another invaluable tool, ReSharper). Its fairly lightweight and works well for tracking both memory utilization and standard application profiling.
CLR Profiler can help you troubleshoot memory issues. Beware, though, the learning curve is pretty steep.
http://msdn.microsoft.com/en-us/library/ms979205.aspx
I never had to worry about memory leaks in my .net applications. You have to worry about system resources such as timers, file handles, comm port handles, database connections etc but again if you stick with right pattern (using?), they are not a problem either.
When it comes to optimization, you need to profile your application to see the performance bottlenecks. Don't even rely on your instincts when you are hunting a slow code because you might be looking at the wrong place.
AQTime, Ants profiler are good options but they are not free. They come with a trial period though so if you need them for a short period, you might get away with using them for trial period only. But if you really like them, you can consider buying them.
Or you can consider a free alternative EQATEC Profiler which seems pretty good but I haven't personally used it.
Anyone can recommend a LOP on Windows? Similar to Linux's OProfile or to OS X's Shark.
must be able to sample non-instrumented binaries
capable of resolving CLR stacks
preferable delayed PDB resolution of symbols
impact low enough to be able to get a decent reading on live, production systems
The Visual Studio Team Suite profiler is amazing. It's so good at its job that it makes me seem better at mine.
Redgate has a performance profiler and memory profiler which I haven't used.
Automated QA's AQTime has saved my butt. I used it to figure out a problem with a .NET web service calling some nasty old C code, and it did it well.
This is what I use. Although it is not suitable for live production use, it answers your other needs.
For live production use, you need something that samples the stack. In my opinion, it's OK if it has some small overhead. My goal is to discover the activities that need optimization, and for that I'm willing to pay a temporary price in speed.
There is always one or more intervals of interest, like the interval between when a request is received, and the response goes out. It's surprising how few samples you need in such an interval to find out what's taking the time.
High precision of timing is not needed. If there is something X going on that, through optimization, would save you, say, 50% of the interval, that is roughly the fraction of samples that will show you X.
I do some C# fat application on Citrix/Terminal Server.
How to measure actual memory usage per-session?
What can I do to reduce the memory usage in total?
We still working on .NET 1.1. Does it have a difference if we upgrade our .NET runtime?
Its very difficult to get metrics on actual memory usage in .NET. About the closest approximation you can get is on a per-object basis by calling Marshal.SizeOf(). My understanding of that method is that it is essentially measuring the size of a serialized version of the object, and the in-memory footprint may be close to that, its not exact. But its a good estimate.
You may also want to investigate the SMS API's under .NET. They provide ways to query various memory statistics from the Operating System about your process (or other processes). Its the same library that is used by "perfmon". You may be able to use that to inspect your process programatically.
Also, you'll want to invest in a good profiling tool for .NET. I've evaluated ANTS and dotTrace. They are both very good. I preferred dotTrace for its simplicity. Most profilers have very non-intuitive interfaces. That's something I've just come to expect. dotTrace is actually quite good, by those standards. ANTS I think is probably more advanced (not sure, just my opinion from the brief eval I did on both of them).
Here is an article from MSDN on measuring application performance. It includes doing measurements on memory usage.
I don't think upgrading the .NET Runtime will have a significant effect on the application as it is, you will probably be better off optimising your application in other ways. Try to dispose of resources when you don't need them.