No memory profiling for apps started in VS in YK version 7?

Questions about YourKit .NET Profiler
Post Reply
ecosky
Posts: 10
Joined: Fri Apr 20, 2012 5:54 pm

No memory profiling for apps started in VS in YK version 7?

Post by ecosky »

I just installed the v7 evaluation to check it out. To my surprise I am no longer able to configure profiling to enable allocation profiling for apps started in visual studio. This change prevents me from setting breakpoints to analyze code while the profiler is running, something I find essential for my workflow.

In v5 there was a checkbox on the main screen of YourKit which automatically enabled different profiling modes for apps that were started while YourKit is running. This seems to have been removed.. if this is correct, can we please have these control options back? The current setup is cumbersome enough that I will probably stick with v5, which is a real bummer because I'd like to upgrade.

Thanks for any info.
ecosky
Posts: 10
Joined: Fri Apr 20, 2012 5:54 pm

Re: No memory profiling for apps started in VS in YK versio

Post by ecosky »

I suppose the current setup is technically functional for my needs as I can start YK as admin and detect the next .net process, but it is less convenient than before where I could just hit F5 in visual studio and do the same thing with memory profiling enabled.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: No memory profiling for apps started in VS in YK versio

Post by Anton Katilin »

Hello,

The way profiling applications are launched has changed.

They should start from the Welcome screen now:
http://www.yourkit.com/docs/net70/help/ ... _local.jsp

If you need to enable profiling globally (like it worked in the previous version), please choose
http://www.yourkit.com/docs/net70/help/ ... l_next.jsp

Best regards,
Anton
ecosky
Posts: 10
Joined: Fri Apr 20, 2012 5:54 pm

Re: No memory profiling for apps started in VS in YK versio

Post by ecosky »

Hello, thanks for the response.

I might be overlooking something but I don't see how to enable profiling globally like how it used to behave, the second link only describes how to detect the next process.

If I have to take manual steps to start each app that I want to profile in this new version I consider this a loss of functionality that I wish had not occurred. It was much easier before to simply have that checkbox that enabled the profiling mode I wanted for all apps that started while YourKit was running. Was there a reason this was removed? The old setup was ideal for my workflow and I'd really like to continue working that way.

Thanks
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: No memory profiling for apps started in VS in YK versio

Post by Anton Katilin »

I might be overlooking something but I don't see how to enable profiling globally like how it used to behave, the second link only describes how to detect the next process.
In this mode the profiler enables profiling globally (sets corresponding registry key which is used by any CLR being started) and waits while a .NET process is started.

It is the same what the profiler was doing in its previous version. The only difference is that now it will automatically disable profiling after the first .NET process has started with the agent. This is made to avoid loading of the profiler agent to occasionally started applications not intended for profiling. Many users reported that was a problem for them, and that was one of the reasons to rework the way profiled applications start.

In other words, previously it worked as "Profile all .NET applications started from now on and until the profiler is shut down", now it works as "Profile the first .NET application started from now on, but not later than when the profiler is shut down".

If you do not need to debug the profiled application, the simplest way is to use Profile standalone application action. Otherwise you can use Profile next.

What is the main the problem with Profile next? Is it that it profiles only the first application?

We can consider returning the old functionality in some way, but it must not be "in the first place", because many people did not understand it properly (or at all) and required a more "traditional" way to work with the profiler.
ecosky
Posts: 10
Joined: Fri Apr 20, 2012 5:54 pm

Re: No memory profiling for apps started in VS in YK versio

Post by ecosky »

What is the main the problem with Profile next? Is it that it profiles only the first application?
Yes, this is my problem. I can appreciate why it was changed to accommodate people who didn't understand how the behavior was different than other profilers, but this behavior was in fact one of the key things that led me to include YourKit in my tool box of profilers in the first place. I have found it useful to be able to have profiling enabled for all apps and just select them when I needed them. Sure, the occasional unrelated app might get started without me needing to profile it, but that was something I was aware of and intentionally avoided doing while doing profiling work. I think the old version had a pattern match filter to limit what it would attach to? I never really worried about that since I work in a fairly well controlled environment. I was content to just press F5, switch to YourKit, select my app, hit the memory tab to start memory profiling. I typically find myself iterating what seems like many dozens of times over the course of a day, so I'm naturally interested in keeping the number of steps to a minimum to help ease the process.

It would be appreciated if the old option were available somewhere, perhaps buried in an advanced dialog since you apparently have had users confused by what the options are for. It seems likely this would be an easy bit of functionality to restore so I am hopeful this will happen. Personally, I'd vote for a new startup option "Every .NET process that starts while active." which frankly if people don't understand what that means they probably shouldn't be programming in the first place. This could pop up a dialog that has something similar to the Standalone Application options, with the addition of path filtering to let people limit profiling to applications that start from a given directory tree.

On a related note, perhaps the "Standalone Application" option could have a "repeat" mode which could be helpful for iterating the profile process on a single app. Anything that would eliminate steps required between pressing F5 in visual studio and seeing results in the profiler would be a good thing.

I hope you don't mind me hijacking my own thread for other feedback, but here are a few other items I have been meaning to submit:

1. It would be really nice if the "Record each -th object" and "Record each object of size not less than" would retain my preferences. Every single time I start a memory profile session I have to set these values to 1 and 0, respectively, to log the data I want it to and I would really like it if it would just save my preferences there.

2. The thread view timeline resolution is really coarse. I am a game developer and 1 second resolution is too low to be useful. If there is any way to increase the resolution, ideally to whatever I specify, that would be a great improvement and help for increasing performance of my heavily multithreaded application. Some kind of API that I could incorporate to tell YourKit to place a marker in the timeline, and a view mode that zoomed to show activity between markers would be ideal because that would allow me to isolate behavior over a single rendered frame.

3. If there was an api that could let the app enable/disable profiling that would be useful. I could then set up my app to automatically capture data around performance critical areas, or after basic initialization has completed. That would be handy.

Thanks for considering my comments,
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: No memory profiling for apps started in VS in YK versio

Post by Anton Katilin »

Thank you for the explanation.

We can offer the following:

Add a new action "Profile | Every .NET process that starts while the profiler is running" as you suggested.
It will show startup options like other Profile actions do.
Perhaps it should have a special option "Automatically re-enable profiling on next profiler start". If enabled, it will reproduce the previous version's behavior.

but I wouldn't place this action in the Welcome screen. I would make it accessible through "Profile" menu only (all other profile actions are in there), to reduce probability it could be misused by a less experienced user.
1. It would be really nice if the "Record each -th object" and "Record each object of size not less than" would retain my preferences. Every single time I start a memory profile session I have to set these values to 1 and 0, respectively, to log the data I want it to and I would really like it if it would just save my preferences there.
I've added a change request. By the way, to record each object it is enough to set the first one to 1; the size limit will not matter in that case.
2. The thread view timeline resolution is really coarse. I am a game developer and 1 second resolution is too low to be useful. If there is any way to increase the resolution, ideally to whatever I specify, that would be a great improvement and help for increasing performance of my heavily multithreaded application. Some kind of API that I could incorporate to tell YourKit to place a marker in the timeline, and a view mode that zoomed to show activity between markers would be ideal because that would allow me to isolate behavior over a single rendered frame.
Telemetry period can be configured:
http://www.yourkit.com/docs/net70/help/ ... etryperiod
Is it what you mean?

About markers. Do you want to add log messages with arbitrary text associated with particular time point and maybe thread, and to indicate them in the telemetry and maybe also show them as a list?
3. If there was an api that could let the app enable/disable profiling that would be useful. I could then set up my app to automatically capture data around performance critical areas, or after basic initialization has completed. That would be handy.
Is it what you need?
http://www.yourkit.com/docs/net70/help/api.jsp
ecosky
Posts: 10
Joined: Fri Apr 20, 2012 5:54 pm

Re: No memory profiling for apps started in VS in YK versio

Post by ecosky »

We can offer the following:

Add a new action "Profile | Every .NET process that starts while the profiler is running" as you suggested.
It will show startup options like other Profile actions do.
Perhaps it should have a special option "Automatically re-enable profiling on next profiler start". If enabled, it will reproduce the previous version's behavior.

but I wouldn't place this action in the Welcome screen. I would make it accessible through "Profile" menu only (all other profile actions are in there), to reduce probability it could be misused by a less experienced user.
This would be great. Thank you for considering that.
Telemetry period can be configured:
http://www.yourkit.com/docs/net70/help/ ... etryperiod
I hadn't noticed this feature before, I'll check it out. Sounds promising. This thread has made me wonder if it would be useful/possible for the API to support having the application trigger the telemetry capture rather than having it occur at a high frequency that might not correspond to the application main loop.
About markers. Do you want to add log messages with arbitrary text associated with particular time point and maybe thread, and to indicate them in the telemetry and maybe also show them as a list?
Yes, something along those lines. Really what I was aiming for here was improving the navigation of the timeline, essentially the ability to make the telemetry easily zoom to a time window bounded by markers (== not limiting visual resolution to 1 second) . For game dev, the simplest usage would typically translate to "Zoom to one frame" of the game's render loop (around 16ms for 60hz games, potentially much less time for games not locked to the vertical sync of the display as is typical when tuning performance). For other applications, users could partition the timeline markers to whatever makes sense to them. For instance, "Application startup" followed by "Main loop". The simplest form would be an API for something like "SetMarker(string name)". This would be pretty handy in itself if the timeline could be zoomed to the region bounded by the marker and the following marker. A more thorough marker feature set would allow for nesting markers via PushMarker/PopMarker so marker regions could be nested within other marker and hidden/revealed as the user navigates the timeline. e.g. "Main loop" could be split by the user via API to include "process input", "update screen", etc.

I think some people might ask, what does this do that tree navigation of the call graph doesn't provide? The main point here is to provide the user a means to filter the call graph and allocation lists by some region of time defined by markers specified in the app via API. Once a hotspot is identified, it would be helpful to isolate the analysis to a specific time window.
Perhaps - the link to the docs ( http://www.yourkit.com/docs/net70/api/Index.html ) is not yet valid though.

Thanks for reading,
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: No memory profiling for apps started in VS in YK versio

Post by Anton Katilin »

Perhaps - the link to the docs ( http://www.yourkit.com/docs/net70/api/Index.html ) is not yet valid though.
Corrected.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: No memory profiling for apps started in VS in YK versio

Post by Anton Katilin »

This thread has made me wonder if it would be useful/possible for the API to support having the application trigger the telemetry capture rather than having it occur at a high frequency that might not correspond to the application main loop.
Do you mean to change the telemetry frequency programmatically in runtime?

Additionally/alternatively, you can use the API to perform CPU sampling or CPU tracing of particular code fragments.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: No memory profiling for apps started in VS in YK versio

Post by Anton Katilin »

Hello,

Please try this build:
http://www.yourkit.com/download/tmp/201 ... r-.NET.exe

It adds the discussed action "Profile | All .NET Processes That Will Start..."

Best regards,
Anton
ecosky
Posts: 10
Joined: Fri Apr 20, 2012 5:54 pm

Re: No memory profiling for apps started in VS in YK versio

Post by ecosky »

Wow, that was quick.
I've tried the update and it works as expected. Thanks! I really appreciate having this functionality back in v7.

I tried setting the telemetryperiod=1 and saw some interesting results. The thread view started having more noticable gaps in it. There is a lot of GC happening right now due to some testing code being enabled, do the gaps occur as a result of GC?
Finally, if it's possible to do without much trouble, it would be useful if the graph view could support zooming to 100ms/10ms/1ms. I am not sure what benefit there is to reducing the telemetry period to <1 second unless the graph can show higher resolutions.

Image

A few other very minor comments related to UI feedback,
* Perhaps it would be good to use the Administrator shield icon over those features that require the app to be started as an administrator but the app wasn't.
* A checkbox in the menu for when "All net processes that will start.." is active might be useful feedback.


Thanks again,
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: No memory profiling for apps started in VS in YK versio

Post by Anton Katilin »

Hello,
I tried setting the telemetryperiod=1 and saw some interesting results.
The thread view started having more noticable gaps in it.
There is a lot of GC happening right now due to some testing code being enabled, do the gaps occur as a result of GC?
Yes, the gaps can be resulted by GC. While GC is running the telemetry samples are not performed.
Finally, if it's possible to do without much trouble, it would be useful if the graph view could support zooming to 100ms/10ms/1ms.
We'll check how easy it would be to implement this change.
I am not sure what benefit there is to reducing the telemetry period to <1 second unless the graph can show higher resolutions.
You get better precision in Stack traces and CPU Usage estimation tabs.
A few other very minor comments related to UI feedback,
* Perhaps it would be good to use the Administrator shield icon over those features that require the app to be started as an administrator but the app wasn't.
Shouldn't the presence of the shield icon mean that the privileges will be requested when the button is pressed?
Technically this means that a new process with administrator privileges must be launched,
because Windows' admin vs non-admin granularity is per-process.
Current behavior is different: it just says what to do.
It is not that user friendly but is much simpler to implement and maintain.
Furthermore, it is quite easy to set in the profiler shortcut properties that it should always run as administrator,
and the problem is solved.
Alternatively, we can have 2 shortcuts in the start menu: to run as an ordinary user or as an administrator.
* A checkbox in the menu for when "All net processes that will start.." is active might be useful feedback.
We'll be done in next build.

Best regards,
Anton
Post Reply