API

Questions about YourKit .NET Profiler
Post Reply
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

API

Post by arkein »

Hello,

I'm trying to use YourKit .NET 4.5 / 5 API but the profiler UI needs to be launched in order to start CPU profiling (Exception "to use the profiler API, run the application with YourKit Profiler")

I'd like to know if it's possible to use the API as a standalone, separately from the yourkit profiler application ? The purpose would be to profile an application calling methods of the API just to get snapshots and process it manually.

Thank you.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

Hello,

Perhaps I do not properly understand your question, so please provide more detail if my answer is not relevant.

You can redistribute files ynpagent.dll, YourKit.Profiler.Api.dll and YourKit.Profiler.Api.xml. Please find license in <Profiler Installation Directory>\license-redist.txt

To use the API, you need YourKit.Profiler.Api.dll (see Help: http://www.yourkit.com/docs/net50/help/api.jsp )

To enable profiling without installing the profiler in full, you need the profiler agent ynpagent.dll. You should register it and enable profiling for applications you need, as described here: http://www.yourkit.com/docs/net50/help/ ... manual.jsp

Best regards,
Anton
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

Re: API

Post by arkein »

Hello,

Thanks for the answer.

I
- installed Yourkit Profiler 5
- registered ynpagent.dll : Regsvr32.exe <path>/ynpagent.dll
- set environment variables as described in the manual

but i still get an exception "To use the profiler API, run the application with YourKit Profiler" when i do a new Controller(); Did i miss something ?

Something else : Can snapshots be read only by yourkit profiler application or is it possible to extract information manually from it ?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

Hello,

Do you have a 64-bit Windows?

If yes, please ensure you properly registered the DLL. For detail, please see http://www.yourkit.com/docs/net50/help/ ... remote.jsp (part "2. Register the DLL on the remote machine")
Can snapshots be read only by yourkit profiler application or is it possible to extract information manually from it ?
Please consider offline export feature.

Run the following command (assume <profiler installation directory>\bin is the current directory):

profiler.exe -export snapshot_file_path target_directory_path

Note: target directory must exist.
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

Re: API

Post by arkein »

Anton Katilin wrote: Hello,
Do you have a 64-bit Windows?
If yes, please ensure you properly registered the DLL. For detail, please see http://www.yourkit.com/docs/net50/help/ ... remote.jsp (part "2. Register the DLL on the remote machine")
No, i have a 32-bit windows.
Anton Katilin wrote: Please consider offline export feature.
Run the following command (assume <profiler installation directory>\bin is the current directory):
profiler.exe -export snapshot_file_path target_directory_path
Note: target directory must exist.

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

Re: API

Post by Anton Katilin »

Which GUID have you specified?

Please ensure that you use ynpagent.dll and guid.txt from exactly the same version/build.
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

Re: API

Post by arkein »

It works now.
"set COR_ENABLE_PROFILING=1" strangely seems to have no effect but after modifying manually the value with regedit, it works.
Thank you a lot.
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

Re: API

Post by arkein »

Hello,

Another problem, i'm trying to profile a remote ASP.net application (set to work on Framework 2.0) but only standalone applications are detected.

There is no log corresponding to an ASP.net application in <user home directory>\.ynp\log\

The remote server runs on Windows 2003 server and IIS 6.0. Profiling works fine with standalone applications.
Do you know where the problem could come from ? I checked the documentation but couldn't find any solution.

Thank you.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

Hello,

Please ensure you use build 5.0.1:
http://www.yourkit.com/dotnet/download/

There were bug fixes since 5.0.0 which might affect.

Best regards,
Anton
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

Re: API

Post by arkein »

Actually I posted after updating to 5.0.1, unfortunately it doesn't change anything :/
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

Logs are created in service user's home directory.

Thus, it can be C:\WINDOWS\system32\config\systemprofile\.ynp or C:\Windows\ServiceProfiles\NetworkService\.ynp

If the location is different, please try searching for .ynp directory on local disk(s).
The remote server runs on Windows 2003 server and IIS 6.0. Profiling works fine with standalone applications.
Could you please clarify: do you connect to that remote machine via "File | Connect to Remote Application...", but it says no application is found?
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

Re: API

Post by arkein »

Anton Katilin wrote: Logs are created in service user's home directory.
Thus, it can be C:\WINDOWS\system32\config\systemprofile\.ynp or C:\Windows\ServiceProfiles\NetworkService\.ynp
If the location is different, please try searching for .ynp directory on local disk(s).
- Logs for standalone applications running on the remote machine are created in C:\WINDOWS\system32\config\systemprofile\.ynp\log, yes.
- In C:\Documents and Settings\<user directory>\.ynp\log there is nearly only logs about a "DllHost.exe".
- Nothing about ASP.net applications.
Anton Katilin wrote: Could you please clarify: do you connect to that remote machine via "File | Connect to Remote Application...", but it says no application is found?
[/quote]

Yes i connect to the remote machine via "Connect to Remote Application". It search and find only standalone applications running on the remote machine.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

Could you please also check C:\Documents and Settings\NetworkService\.ynp
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

Re: API

Post by arkein »

There is no directory ".ynp" in C:\Documents and Settings\NetworkService\
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

That means that most likely profiler agent is not loaded.

Could you please check ynpagent.dll access rights. Does it have read and execute rights from the service user?
Post Reply