How can we help you today? How can we help you today?
Andrew H
gpeszek wrote: I am having the exact same issue: the UI is stuck in "Starting service" and there is no profiling. Andrew, when you say The cheapest way to get around it is to reconfigure the service to run as LocalSystem do you mean "service" as in the ANTS profiler service or "service" as in the service we are running? I mean the service you are running. LocalSystem has the most rights of any user so it's guaranteed not to have a problem writing out profiler results anywhere and most services should run OK as this user. You could also configure it to run as your user if you have the log on as a service right granted. If you are profiling a network service there are some serious security concerns with doing this, so I can understand wanting to keep the service running as one of the users with fewer permissions. This is possible, but you'll need to create a new folder with the appropriate permissions and tell the profiler to use that instead. Here's how: * Create a new folder to store temporary profiler files in. It's probably easiest to put this in the root folder of a drive (I tried this out with a folder called 'D:\Profiler') * Grant full control permissions to this folder for the user you are running as and the user that the service runs as (generally Local Service or Network Service) * Set the RGTEMP environment variable to point at this folder before launching the profiler. You can do this by setting the variable then launching the profiler from the command line, or by editing the environment variables in the advanced tab of the System control panel and logging off and back on again. We don't grant these permissions automatically as it would cause a change to the security surface of the system - Local Service and Network Service processes are limited in what they can communicate with by design, and profiling requires a (slight) decrease in this security. This should work in all versions of the profiler, but I've just tried this on a version of 4.3 and seen it fail so you may wish to try the 5.0 beta version that's now available if you run into difficulties. You can download them from here: http://www.red-gate.com/messageboard/viewforum.php?f=92 / comments
gpeszek wrote: I am having the exact same issue: the UI is stuck in "Starting service" and there is no profiling. Andrew, when you say The cheapest way to get around it is to reconfigure the se...
0 votes
The service not showing up as running is odd. Normally ANTS will get an error back from the service controller when the service fails to start and will report this back to you. The status that ANTS is showing indicates that it has sent the start request, hasn't received an error and hasn't yet received a request to start profiling. An early crash generally gets reported back to the profiler as an error, and a later crash ought to happen after the profiler has connected so the UI status will have changed. There are a couple of cases where I know this can get stuck, but neither appear to apply here: * if the service is unmanaged, ANTS will stay at this screen until the first time it executes managed code (but the service should start with no problem) * if the service is managed but the profiler fails to load into the process, ANTS can't tell the difference from the first case and will stick at this screen as well. A 'failed to CoCreate profiler' message will be placed in the event log. * If the service starts up and then shuts down in an orderly manner without running any unmanaged code, ANTS might not notice it has gone away. The second case most commonly occurs with services when they don't have permission to read the profiler DLL, but doesn't stop the service from starting in all the cases I've seen. Can you profile successfully with the new memory profiler? Does the service process appear in task manager? It's possible it's stuck in some sort of limbo where it can't complete startup. Additionally, does it appear briefly and then disappear again? Do any errors or warnings appear in the system event log when ANTS tries to restart the service? ANTS puts a log file in the local app data directory (whose location varies on different editions of Windows: on XP these should be in Documents and Settings\<user>\Local Settings\Application Data\Red Gate\ANTS Performance Profiler 5). Are there any warnings or errors in there? Are you using a config file or security policy that could be violated by the profiler with your service? I'd expect that to produce an error, but I've never tried with a service. The profiler is an unmanaged DLL and might not be permitted to load at some trust levels, and line-level timing requires full trust. / comments
The service not showing up as running is odd. Normally ANTS will get an error back from the service controller when the service fails to start and will report this back to you. The status that ANTS...
0 votes
ANTS is at heart an instrumenting profiler, which is to say that it modifies the program(s) being profiled to contain extra code to measure timings and hit counts. This means that it captures a great deal of detail, but it will change the way your program runs. Usually this appears as a constant factor (and hence can be ignored in the results), but can become significant if two parts of the program that take similar amounts of run time get different amounts of instrumentation: for example, a part that calls a lot of functions vs one that calls very few: with the profiler attached the part that calls fewer functions will run more quickly. It does try to compensate for this: the nature of modern processors makes it impossible to completely accurately predict the way the code inserted by the profiler will behave, but the errors usually average out over long periods of time. This means that when you use the profiler, you might see the effects of the instrumentation causing the performance to change, but when you read the results this effect is compensated for. There is an option to turn this off if you want to see the raw results. There are still effects that can't be compensated for: in particular, the data the profiler produces will mean that there is less cache space available to the program being profiled, and the instrumentation will change the way instructions are scheduled by the processor. Usually these effects have a negligible impact on the performance compared to that of the instrumentation itself, but may be worth bearing in mind. You can reduce these effects by turning down the amount of detail captured by the profiler. The first thing to try is turning on function inlining in the options: inlined functions won't be instrumented and time used by functions that .NET inlines will be incorporated into their parent functions, so you will get less detail but more accurate results. The next thing to do is to try using one of the less detailed modes: turning off line-level timings or measuring the time spent in functions without source will reduce the amount of work the profiler has to do, and consequently the influence it has on the performance of the target application. / comments
ANTS is at heart an instrumenting profiler, which is to say that it modifies the program(s) being profiled to contain extra code to measure timings and hit counts. This means that it captures a gre...
0 votes
adamhill wrote: Second: How can I trace some generic allocated object like "byte[]" back to the object that actually allocated it? My specific question is/was a ImageBrush in WPF, but shows up in the object list as a byte[]. Is there anyway to say "Just show me all ImageBrushes and the external bytes that were allocated from them?" We're working on a couple of features to help with this: at least one of these should show up in the next EA build, so you will be able to find things like only the byte arrays that are referenced by ImageBrushes and explore how objects of different classes relate to each other. We're not currently planning to have a feature that will show the place an object was allocated in this version: we're focusing much more on providing ways of exploring how objects relate to each other at the time that a snapshot was taken - this is because one of the primary goals of the memory profiler is to find out why an object is in memory now. It's also because the way .NET allocates and uses objects means that often the thing that allocates an object and the thing that actually uses it are separated by a long distance, so this information can be distracting and misleading - as a trivial example, an object that is assigned via a property would be 'allocated' by the object that did the assigning, but would be kept in memory by the thing it was assigned to. One more such assignment would completely obfuscate what happened if you only look at where it was allocated. This is inevitable due to the way .NET is designed. In languages like C++ the need to free objects up when they are finished means that usually the class that creates an object is responsible for ensuring that it is destroyed. In .NET the garbage collector means that there's no need for anything to take responsibility for most objects, so they become free to wander far from where they were initially created. / comments
adamhill wrote: Second: How can I trace some generic allocated object like "byte[]" back to the object that actually allocated it? My specific question is/was a ImageBrush in WPF, but shows up in...
0 votes
You might be seeing a particularly suboptimal case for the profiler, although this is fairly unlikely. There are a few differences with the way ANTS 4 profilers from ANTS 3: We measure method-level performance for all methods by default, whereas ANTS 3 only instruments methods with source. Normally we'll still execute code many times faster than ANTS 3 as the method-level instrumentation is vastly faster in ANTS 4, but if you've got a piece of software where the ratio of method calls between methods with and without source is sufficiently high you might find that something appears to run more slowly. ANTS 4 still has the option to only instrument methods with source, so you might try that. During startup when line-level timings are turned on we do increase the amount of work the JIT has to do, which will slow things down the first time code is executed. Normally this isn't hugely significant but some types of code can require large amounts of instrumentation, and we've changed the way this works from ANTS 3. You can discover if this is happening by looking at the all methods tab and seeing where the JIT appears and what percentage time it takes. With line-level timing turned off, the JIT time is not significantly impacted. There would probably have to be something unusual about your code to make a large difference compared to ANTS 3, though. Finally, you may be using code where function inlining has a significant effect on the timings. We normally turn function inlining off in order to give the most complete picture of what the process was doing, but you can re-enable it through the options dialog. Methods that are inlined still appear in the call tree but we can't collect hit counts or line-level data for them. The kinds of methods that are candidates for inlining are also the kinds where adding timing instrumentation can have a disproportionately large effect on their execution time. / comments
You might be seeing a particularly suboptimal case for the profiler, although this is fairly unlikely. There are a few differences with the way ANTS 4 profilers from ANTS 3: We measure method-level...
0 votes