API

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

Re: API

Post by arkein »

The service user ?
Sorry I'm not sure to understand. ynpagent.dll have read and execute rights for Administrators, System and the account is used to log in. I tried to grant access to IIS_WPG group but it doesn't change.

But why does it work for standalone applications if it's not loaded ?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

The service user ?
Sorry I'm not sure to understand. ynpagent.dll have read and execute rights for Administrators, System and the account is used to log in.
Please open Windows Task Manager and find IIS 6 process (w3wp.exe). The user which I mean should be shown in "User Name" column. If the column is not visible, please enable it via "View | Select Columns..."
I tried to grant access to IIS_WPG group but it doesn't change.
The simplest thing to do is to set ynpagent.dll's permissions "read" and "execute" to "Everyone": in ynpagent.dll's properties add user "Everyone" and check appropriate checkboxes. This will help to find out whether it's a problem with ynpagent.dll access rights or not.
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

Re: API

Post by arkein »

Anton Katilin wrote: Please open Windows Task Manager and find IIS 6 process (w3wp.exe). The user which I mean should be shown in "User Name" column. If the column is not visible, please enable it via "View | Select Columns..."
There is no w3wp.exe in the task manager view (but there's inetinfo and aspnet_wp).
Anton Katilin wrote: The simplest thing to do is to set ynpagent.dll's permissions "read" and "execute" to "Everyone": in ynpagent.dll's properties add user "Everyone" and check appropriate checkboxes. This will help to find out whether it's a problem with ynpagent.dll access rights or not.
I set ynpagent's permissions to "Everyone" but it doesn't change.

I really don't understand, but i'm not the one who configured the remote machine (it's a test machine in an enterprise)
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

Have you accessed an ASP.NET page of the profiled site (not a static content) in browser?
arkein
Posts: 11
Joined: Thu Apr 29, 2010 3:07 pm

Re: API

Post by arkein »

Yes i did, but it still doesn't find it.
jarbas
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Post by jarbas »

Hello everyone,

I'm trying to attach another application using API, but I didn´t have sucess.

Seeing the code:

Controller controller = new Controller(@"ApplicationPath", 10002);

The error code is like this:

System.Net.Sockets.SocketExpetion

The Name requested is valid. But it was not found data of requested type.

I had already registered ynpagent.dll and seted environment variables.

Someone knows where are the problem here?

Thank You!
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

What is the "ApplicationPath" ?
This parameter should be the host name or IP address of the machine where the profiled application is running.
In particular, if the profiled application is running on the same machine as where you use the controller, pass "localhost" as the parameter value.
jarbas
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Post by jarbas »

Hello Anton,

I am running in the same machine, but if I put "localhost", the API will attach the application where I'm running the Controller class. I want to profile another application in the same machine.

Then "ApplicationPath" is the path of application where I want to atach, like "C:\Windows\System32\calc.exe".

Another example, my Controller class is running into application "X", through of my application "X" I want to attach "Y" application, see an example:

Into application "X" classes:

Controller c = new Controller("path of Y", 10001);

Do you understand? I dont know if it is possible.

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

Re: API

Post by Anton Katilin »

You should specify appropriate profiler agent port (2nd parameter) of that application to which you want to connect.

You can either specify the port explicitly via startup option "port":
http://www.yourkit.com/docs/net60/help/ ... ptions.jsp

...or learn it by analyzing that application's log file <user home>\.ynp\log\<PID>.log

The first approach is simpler and is more reliable.
jarbas
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Post by jarbas »

Ocurred the following IOException

Invalid header magic number:597123274982308399

I used the port where application is running:

Controller controller = new Controller(@"localhost", 1180);

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

Re: API

Post by Anton Katilin »

Is 1180 the port which you have specified via "port" option, i.e. does the startup options applied to the application which you want to profile contain text "port=1180"?

Please re-read my previous post. The controller needs the profiler agent's port. Not the port your application uses for other purposes.
ibirite
Posts: 2
Joined: Mon Apr 16, 2012 1:37 pm

Re: API

Post by ibirite »

Mr. Anton, I'm facing the very same problems that Jabras have.

I would like to ask you a question about it, if you dont mind.

1 - I need to profile a .net application using the YourkitApi. This .net app doesnt have any reference to Yourkit API assembly. To me, seems be an obvoius question:if I'm a registered user and have yourkit installed in my computer,I should be able to perform this task. Is it possible or the target application needs to recefence the YourKit API assembly?

I do belive that I'm doing something wrong here, and I need your help in order to fix it.


Kind Regards
Christiano Coutinho
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Post by Anton Katilin »

Hello Christiano

There are 2 application we are talking about:
1) the profiled application
2) the application which uses the controller to connect to the application #1

They can be the same application (the application profiles itself) or different applications (application #2 controls application #1).

Application #1 does not need to reference the API. It should start with the profiler instead:
http://www.yourkit.com/docs/net60/help/ ... _local.jsp
http://www.yourkit.com/docs/net60/help/ ... manual.jsp

Application #2 must reference YourKit.Profiler.Api.dll whose classes it uses.

If #1 and #2 are the same application, the combination of the requirements applies.

Best regards,
Anton
ibirite
Posts: 2
Joined: Mon Apr 16, 2012 1:37 pm

Re: API

Post by ibirite »

Thank you for the answer.

I'll try a few more things here in order to find what I'm doing wrong.

Kind Regards
Christiano Coutinho
jarbas
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Post by jarbas »

Anton,

When I call the GetSnapshot method, the application stop in this method e doesn´t return nothing. Then I stop by Visual Studio.

In the log, recorded this:

.NET\jre\bin\javaw.exe
[YourKit Profiler 6.0.1 for .NET] [0.001]: Reading startup options
[YourKit Profiler 6.0.1 for .NET] [0.001]: Environment variable YNP_STARTUP_OPTIONS: not defined
[YourKit Profiler 6.0.1 for .NET] [0.001]: File C:\Users\jarbas.carvalho\.ynp\config\startup-options.ini: disablealloc,port=10002
[YourKit Profiler 6.0.1 for .NET] [0.033]: error at ProfilerCore.cpp:302: Cannot start: cannot bind to port

What the value who have I to register to environment variable YNP_STARTUP_OPTIONS?

Thanks.
Post Reply