Fully featured low overhead profiler for Java EE and Java SE platforms.
Ultimate profiling and monitoring solution for Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

API

Moderators: Vladimir Kondratyev, Anton Katilin

Re: API

Postby jarbas » Mon Apr 23, 2012 8:27 pm

I Tested in another machine, I attached the application ok like log below, but occurs the same error in Controller class. Process with PID=1164 does not exist or is not started with YourKit Profiler

7.0.0 - 0.000: Command line:
C:\CorporeRM\RMRestore\RM.Restore.exe
7.0.0 - 0.001: Executable: C:\CorporeRM\RMRestore\RM.Restore.exe
7.0.0 - 0.001: Windows 7; version 6.1; 32-bit process
7.0.0 - 0.000: Reading startup options
7.0.0 - 0.001: Environment variable YNP_STARTUP_OPTIONS: not defined
7.0.0 - 0.001: Registry key HKLM\SOFTWARE\YNP\STARTUP_OPTIONS:
7.0.0 - 0.001: CLR_Agent_OnAttach: options=
7.0.0 - 0.004: shmem: Global\YOURKIT SHARE5 G: OK, isFirst=0
7.0.0 - 0.004: shmem: Local\YOURKIT SHARE5 L: OK, isFirst=0
7.0.0 - 0.006: shmem: Global\YOURKIT SHARE2 G: OK, isFirst=1
7.0.0 - 0.006: shmem: Local\YOURKIT SHARE2 L: OK, isFirst=1
7.0.0 - 0.009: shmem: Global\YOURKIT DOTNET1 G: OK, isFirst=1
7.0.0 - 0.010: shmem: Local\YOURKIT DOTNET1 L: OK, isFirst=1
7.0.0 - 0.011: agent is listening on port 10001
7.0.0 - 0.011: setTriggers:

7.0.0 - 0.011: setTriggers: OK
7.0.0 - 548.604: CPU profiling is started
jarbas
 
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Postby Anton Katilin » Tue Apr 24, 2012 11:36 am

We cannot reproduce the problem.

Anyway, please try this build (it will identify itself as 7.0.1):
http://www.yourkit.com/download/tmp/201 ... r-.NET.exe

It should provide better diagnostics if an exception happens when calling "new Controller(pid);"
Anton Katilin
 
Posts: 5574
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Postby jarbas » Tue Apr 24, 2012 1:57 pm

Occurs this error:

Unable to load DLL 'ynpagent.dll': It was not possible to find the specified module. (Exception from HRESULT: 0x8007007E)

I registered this assembly and try again and occurs the same error.

I also tried to add this assembly in my project, but Visual Studio does not allow, it generate the following message:

A reference to 'C:\Program Files\YourKit Profiler 7.0.1 for .NET\bin\win32\ynpagent.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.
jarbas
 
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Postby Anton Katilin » Tue Apr 24, 2012 4:52 pm

The dll should not be registered for the API purposes. Instead, it should be in the PATH.

Also, there are 2 versions of ynpagent.dll: 32-bit in <profiler dir>\bin\win32 and 64-bit in <profiler dir>\bin\win64

You should put to PATH the one which corresponds to the process which uses the controller.
Anton Katilin
 
Posts: 5574
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Postby jarbas » Tue Apr 24, 2012 5:01 pm

The ynpagent.dll is in the path correctly.

What have I do now?
jarbas
 
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Postby Anton Katilin » Wed Apr 25, 2012 1:42 pm

We cannot reproduce the problem, but is cleared related with CLR's inability to load ynpagent.dll for some reason.

Can you send to support@yourkit.com an isolated example (a VS project) with the class which uses the controller, which reproduces the problem?

Anyway, we are considering alternative approaches to avoid API dependencies on ynpagent.dll or to automatically ensure it is properly loaded.

How do you use YourKit.Profiler.Api.dll: do you copy the file somewhere inside your project, or refer the copy existing in <profiler installation directory>\api ?

Do you run the process which uses the controller and the profiled application under the same user?
Anton Katilin
 
Posts: 5574
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Postby jarbas » Wed Apr 25, 2012 3:55 pm

Anton Katilin wrote:We cannot reproduce the problem, but is cleared related with CLR's inability to load ynpagent.dll for some reason.

Can you send to support@yourkit.com an isolated example (a VS project) with the class which uses the controller, which reproduces the problem?

Anyway, we are considering alternative approaches to avoid API dependencies on ynpagent.dll or to automatically ensure it is properly loaded.

How do you use YourKit.Profiler.Api.dll: do you copy the file somewhere inside your project, or refer the copy existing in <profiler installation directory>\api ?

I refer the copy existing in <profiler installation directory>\api

Do you run the process which uses the controller and the profiled application under the same user?


Yes, the user is the same
jarbas
 
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Postby jarbas » Wed Apr 25, 2012 3:56 pm

I refer the copy existing in <profiler installation directory>\api

The user is the same.
jarbas
 
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Postby jarbas » Wed Apr 25, 2012 5:21 pm

jarbas wrote:I refer the copy existing in <profiler installation directory>\api

The user is the same.


The project is a simple project only for this test, it has a reference to dll api and in main method I use the class. Only this.
jarbas
 
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Postby Anton Katilin » Wed Apr 25, 2012 6:02 pm

Thank you for the detail.

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

YourKit.Profiler.Api.dll does not depend on ynpagent.dll anymore.
Anton Katilin
 
Posts: 5574
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Postby jarbas » Wed Apr 25, 2012 8:57 pm

Occurs another error:

Process 2540 has not been started with the profiler, or has a different user home: file C:\Users\jarbas.carvalho\.ynp\log\2540.log does not exist

I saw in this directory and really this log does not exists, but I had already started the application with profiler.

Mine instace of Controller class is that:

Controller controller = new Controller(2540);

Thank You.
jarbas
 
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Postby Anton Katilin » Thu Apr 26, 2012 9:44 am

An important update:

I re-read again the entire thread and found the following:
Notice that I have been to profiled this application before.
Mine application is Windows Service type.


This means that the server runs under _different_ user (special user for servers).

Then of course the log file is not found because it is located in another directory.

So, there are 3 solutions

1) if you want to use "new Controller(pid)":

Explicitly specify the home directory for both the profiler agent and the program which uses controller. Specify environment variable YOURKIT_HOME and set it to an arbitrary directory e.g. c:\yourkit.

Ensure that all users on the machine have read and write access to it (to ensure the service can access it).

YOURKIT_HOME must be a system variable (there is corresponding option in Windows UI where environment variables are used).

2) almost same as #1, also to use new Controller(pid):

specify a different directory for the logs using startup option "logdir":
http://www.yourkit.com/docs/net70/help/ ... jsp#logdir

It should be your "normal" user home. Perhaps you will need to grant permissions to the service user.

This does not require setting environment variables.

3) you can hard code the port for the agent using startup option "port":
http://www.yourkit.com/docs/net70/help/ ... s.jsp#port
and then use new Controller("localhost", port);
Anton Katilin
 
Posts: 5574
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Postby Anton Katilin » Thu Apr 26, 2012 12:43 pm

We will also add constructor Controller(int pid, String userHome).
Learn the server's user home (on Vista and Windows 7 it is also C:\Users\<some name>), and specify it alongside the PID. This should allow to avoid actions 1-3 from my previous posting.
Anton Katilin
 
Posts: 5574
Joined: Wed Aug 11, 2004 8:37 am

Re: API

Postby jarbas » Thu Apr 26, 2012 1:34 pm

Hello Anton,

I made many tests and saw that mine windows service application is running like "Network Service" user. Then I tried to attach another different application and it works correctly.

Then I changed the environmnent variable YOURKIT_HOME like you had said and even thus it does not work.
Then I researched in all of directories and I dont found anything with my PID.log e.g. 4524.log.

I think when the service running with network service user, the yourkit does not store the log file in disk.

Thank you so much.
jarbas
 
Posts: 24
Joined: Fri Apr 13, 2012 1:20 pm

Re: API

Postby Anton Katilin » Thu Apr 26, 2012 1:41 pm

By default it creates log file inside Network Service user home.
If you search for a file not being an administrator user, you won't find it, because of lack of permissions to enter the directory.
But it is created.

We'll make new build soon. We are working on it now. And our tests should that the approach with Controller(pid, homeDir) perfectly works for a service (we try with IIS). And as I wrote it works without the need to tweak YOURKIT_HOME

In meanwhile lets find where Network Service user home is located on your machine. What is the version of Windows?
Anton Katilin
 
Posts: 5574
Joined: Wed Aug 11, 2004 8:37 am

PreviousNext

Return to .NET Profiler

Who is online

Users browsing this forum: No registered users and 3 guests

cron