Lightweight profiling for Silverlight? - c#

I would like to profile certain actions in my application in a production environment.
I have previously used Stopwatch in .NET
It does not seem to exist in Silverlight (despite being in the documentation).
Can anyone suggest some alternatives? Is there anything better than DateTime.UtcNow?
I have used Yourkit and use ANTs in development, but I would like to gather information about performance of deployed software. I do not have access to the kind of data the users have, but can gather some logging.

Is this post any use at all?
It sounds like you want to deploy profiling IN your application so you can see how it performs on the user's PC?

Firstly you could have a look at this answer. Standard timers (eg looking at the value of DateTime.Now) are only going to give you rough resolution, which seems to be around 16ms at best.
Otherwise you can grab a performance profiling tool, there are several now which work out of the box with Silverlight, are easy enough to use and don't really take that long to get started with, with free evaluations. Two such tools JetBrains dotTrace and RedGate ANTS

Have you looked at this question: How to profile a silverlight application?
Are you looking for something other than this?

Telerik also has a pretty fantastic product for profiling named : JustTrace
JustTrace enables the profiling of local applications, running applications, Silverlight applications and local ASP .NET web site.

Related

Efficient way to trace performance

I have an asp.net (c#) project on a remote machine (I can log into this machine).
I want to trace its time consumption (mainly bll code).
Now I use logger with time Stamps, but I thought maybe someone has an better tool\way.
Thanks for any idea
We do this 24x7 in production here at stackoverflow using mvc-mini-profiler, which we have released as open-source (just search). With it, I can tell you instantly what TSQL was executed, as well as all the steps used in building this very page (with timing etc), including AJAX requests. And all for free, and with virtually zero impact.
(obviously you can limit the profile display to specific user accounts, etc)
Logging is a great way of doing it. You might try a profiler as well, sometimes they give you information you missed. Jetbrains has one RedGate has one, there are others as well, some have free trial you could try it out.
You should look into mvc-mini-profilier if you are using .Net 4.0 or greater. It may need to store to a sql server. It has a quick web ui but I normally ignore it and just use sql queries to get the data I need.

Windows Service and Performance Info using C#

We have hundreds of database and application servers in our datacenter and we are currently using various third party tools to monitor. All appear to have their stengths and weaknesses.
I would like to create a simple Windows Service using C# that can check the most common performance counters on a Windows system every 5 mins or so and upload the results to a WCF service.
My questions are:
1) Having never worked with Performance Counters in .NET, is this something that is fairly simple to do?
2) Are there any permission issues I need to concern myself with? The service will likely be running under "localsystem" or a domain user account.
3) What are the common performance counters I should be looking for... Memory, CPU, Disk?
4) Has anyone else written code similar to this and do they have any examples to get me started?
Any help would be appreciated.
Monitoring performance counters isn't hard using .NET however I recommend using existing tools (such as SCOM) that will do exactly this for you.
In case others may find this useful (or myself in the future) ;)
Yes - Performance Counters
Unfortunately I don't know the answer to this one, but I'll update if I learn it. :D
This will depend on the context. You will likely want to monitor slightly different counters for Database servers vs Application servers. There are many excellent resources on this.
Here are a couple key files I found on various projects on Github. They may not be ideal, or reflect the above articles, but they give an idea on the structure. You can also refer to the examples in the official documentation on the PerformanceCounter Class.
TelemetryInstrumentService.cs by Scott DeHaan
CounterWatcher.cs by CryptonZylog

How to fine tune an asp.net application and find bottlenecks

How can I test performance of an asp.net mvc application and understand where exactly the bottlenecks are? I see some tools from redgate but to get the package is about $700. Are there any cheaper alternatives that may work? Or simple ways to really fine tune the application to maximize performance in a less expensive manner?
Thanks.
Sure. There is one stackoverflow created called MiniProfiler.
http://code.google.com/p/mvc-mini-profiler/
http://www.hanselman.com/blog/NuGetPackageOfTheWeek9ASPNETMiniProfilerFromStackExchangeRocksYourWorld.aspx
If you're using VS 2010 Ultimate you have access to some decent performance testing tools that are included. Many time bottlenecks only show themselves when the application is under load. The tools in VS let you correlate the load test with performance counters on the server hosting the app. This in combination with the MiniProfiler tool mentioned in another answer would be a good combo for finding bottlenecks.
http://msdn.microsoft.com/en-us/library/dd293540.aspx

Code Profiling ASP.NET MVC2 applications

The thread here seems close:
Profiling ASP.NET websites with EQATEC Profiler
However, in the free version of Equatec I downloaded today there is no checkboxes for ASP.NET, and ordinary web. I have pointed the App path to my bin directory in my project folder as well as started up the localhost hosting for my application via Visual Studio.
I am open to other free tools as well. I am just looking for someway to profile the code as to optimize some reflection we are using.
I am using the professional edition so unfortunantly do not have access to MS Code Profiling.
I am looking to do performance profiling at this point.
Is the free version of Equatec capable of doing ASP.NET applications?
Is there a free profiler (I realize this has been asked before, and little seems to have surfaced but paid apps, but might as well ask)?
Is MVC a special thing to look for in a profiler?
Comprehensive profiling tools still seem to be quite expensive. I like the dotTrace family, but they're not free.
You haven't specified what kind of profiling you want to do. Are you trying to understand more about the memory usage of your application, or CPU usage?
There is nothing special about MVC applications when it comes to profiling. You will need a profiler that's capable of launching ASP.NET. Beyond that, MVC is just a regular bunch of class libraries.
Have you tried the free CLR Profiler? It handles ASP.NET and will show both memory and some method call activity. It's not as comprehensive as say dotTrace, but it is a great free alternative if you're starting out.
The guide is actually not out of date: the few steps described in the stackoverflow duplicate question (last edited April 8th) still describes best how you should profile ASP.NET apps. Note that you should look at the accepted answer, the one with currently 16 upvotes.
After you've build the instrumented app the important thing to note in the stackoverflow-answer above is step 3: "load your app". It means that you should cause your app to be loaded and is the only step the profiler can't do automatically for ASP.NET apps.
You typically load the app simply by navigating to it in a browser so you simply need to do that after the build-step. When your (instrumented) code is activated the profiling part of it will spring into life and connect to the profiler and then you can take snapshots.
Note that ASP.NET doesn't need a main entry point. That's just an added convenience for automatically taking snapshots for real executables that has a Main method.
You just need a .NET profiler.
Profiling WebForms, MVC, SharePoint, Sitecore, Ektron, Sitefinity, or any other product that runs on .NET doesn't change that.

Is there any way to profile performance of a WCF Application?

We're trying to measure performance of our system, which is a .NET 3.5 application that uses WCF calls.
Problem is until now, we weren't able to profile the methods inside these calls. A winforms client application was coded to test our system. We tried using ANTS 4 Profiler and VS2008 built-in Performance Analyzer, but we only got the total time of the WCF call. We would like to be able to measure all the calls that are being made inside of the WCF call.
Does anybody know if that's possible?
Thanks in advance.
There is quite a bit of performance testing functionality built into Visual Studio Team System Test Edition.
Take a look on this page and scroll down to the section Introduction to Load Tests.
Also this WCF Load Test application on codeplex might be helpful
So your application can run under VS, but WCF calls off to an environment where you cannot get profiling visibility, but you want to know what goes on in there?
Even if you find out how WCF uses time inside itself, any changes you make will have to be in your code. If you want to find out where in your code you can do something about performance, you can use the VS profiler. Personally, I just use stackshots, which are very effective at finding out what code to optimize under any environment, including C#.

Categories

Resources