Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)

VTune Profiler 2020 : Profiling Remote Target Inside Docker With Host and Remote system as Windows

Kothandaramaswamy__H
8,338 Views

Objective : To profile remote running process using Hardware Event Based Sampling Hotspot analysis type inside a docker with windows image (windowsserver:ltsc2019) from Windows Host.

Version of vtune tool used : Vtune 2020 update1

Version of Docker Engine :  19.03.8 (Docker Desktop)

Host OS : Version 1909 Windows Pro

I have done the following successfully : 

1) Passwordless SSH connection to the remote system (docker) using empty password config (not through key based)

2) Installed VTune standalone profiler with command line support in the remote target system. This includes the installation of the driver also.

Problem : I get the following error 

C:\Users\hariv\.ssh>vtune --target-system=ssh:User03@localhost[:2222] -collect hotspots -knob collection-type:hw-events -- /matrix/matrix.exe
vtune: Using target: ssh:User03@localhost[:2222]
vtune: Error: Please, check that the command '/tmp/vtune_profiler_2020.1.0.607630/bin32/amplxe-runss -V' is run successfully on the target.
vtune: Error: VTune cannot detect remote machine configuration.
vtune: Error: Please, check that the command '/tmp/vtune_profiler_2020.1.0.607630/bin32/amplxe-runss -V' is run successfully on the target.
vtune: Error: VTune cannot detect remote machine configuration.

 

The amplxe-runss works fine when i try to run in the target system but it is present in a different directory inside /bin64

Attached files : 1) Included the screenshot of the error

2) Dockerfile used to build the windows image which includes SSH configuration and VTune installation.

3) The script to install the SSH in the remote target system

I am unable to change the default directory even by using the flag -target-install-dir . I am unable to find a solution after this to make my remote profiling work here. Any sort of Help is appreciated. Thank you.

0 Kudos
1 Solution
Stas-Neverov-Intel
8,360 Views

Hi Harinarayanan,

There is a preview feature that could help you. We now offer VTune as a web server in addition to the classic desktop usage model. We also do support Windows targets with VTune servers.

More information here:

You have two options with VTune Profiler Server. You can either run VTune server on your Windows target and access it remotely via web browser. Or you can run VTune server on any Windows host accessible from the target system and run VTune Profiler Agent on your Windows target. The first option should easier to setup.

Since you need HW profiling then both options require your target to be Windows-based VM with enabled PMU virtualization like Denis suggested above. 

Please check the online documentation above and let us know if you have any issues setting up a server.

 

View solution in original post

0 Kudos
25 Replies
AthiraM_Intel
Moderator
7,043 Views

Hi,

Thanks for the detailed information.

Could you please share the complete script used as you mentioned in the attached files.

We will try to reproduce the same and let you know.

 

Thanks

 

0 Kudos
Kothandaramaswamy__H
7,043 Views

Thank you for responding @AthiraM_Intel . Yes i will attach the script file i mentioned in the post. THank you so much for the help.

0 Kudos
Denis_P_Intel
Employee
7,043 Views

Hi,

Let me add some details

  1. VTune does not support profiling app running inside Docker on Windows host. We can consider adding this functionality but it will take time. Meanwhile can you please consider to run a Windows-based VM with enabled PMU virtualization and run VTune from the VM.
  2. VTune does not support profiling remote Windows target.
  3. Also your VTune command line (vtune --target-system=ssh:User03@localhost[:2222]) contains a mistake - you should not surround port number with [].
0 Kudos
Kothandaramaswamy__H
7,043 Views

Hello @Denis_Pravdin_(Intel), 

THe original problem i had was that inside a docker, i was not able to run vtune with "-collect-with runsa" analysis type .

Following are the questions i have to your response,

1) So you mean to say that, with Host as WIndows and a docker running in the same system with WIndows image, vtune profiler does not work for profiling executables running inside docker from host ? Am i right ? 

2) The use-case at hand is that I need to run malware samples inside a docker like environment and I need vtune to profile that sample execution in Hardware-Event based Sampling mode (runsa) or the same using Hotspots with -knob sampling-mode = hw. I am ok with vtune being run at host or at the target system itself. 

3) Can a vtune profiler installed inside Windows-based VM with enabled PMU virtualization, profile in the RUNSA or Hardware event based sampling mode (hotspots with -sampling-mode = hw ) analysis type ? 

4) Yes i will correct the SSH mistake with the port as you said

Thank you for responding and I appreciate the help

 

0 Kudos
AthiraM_Intel
Moderator
7,043 Views

Hi,

Are you able to correct the syntax mistake. Does it work for you?

 

Thanks

0 Kudos
Kothandaramaswamy__H
7,043 Views

Thank you for asking @AthiraM_Intel. I corrected the syntax and this is the error i am getting.

 

C:\Windows\system32>vtune --target-system=ssh:User03@localhost:2222 -collect hotspots -knob collection-type:hw-events -- /matrix/matrix.exe
vtune: Using target: ssh:User03@localhost:2222
vtune: Error: Cannot communicate with the target User03@localhost. To collect data on a remote Linux system, configure SSH to work in a password-less mode so that it does not prompt for the password on each invocation. Usually, this can be accomplished by either setting up a key-based authentication, or by setting the password to an empty string. Press F1 for more details. Run the specified command from the host to verify SSH password-less connection. The username for this verification should be the same as the name used to run the analysis.'ssh -o BatchMode=yes -o ServerAliveInterval=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 User03@localhost -p 2222 uname'.
vtune: Error: VTune cannot detect remote machine configuration.
vtune: Error: Cannot communicate with the target User03@localhost. To collect data on a remote Linux system, configure SSH to work in a password-less mode so that it does not prompt for the password on each invocation. Usually, this can be accomplished by either setting up a key-based authentication, or by setting the password to an empty string. Press F1 for more details. Run the specified command from the host to verify SSH password-less connection. The username for this verification should be the same as the name used to run the analysis.'ssh -o BatchMode=yes -o ServerAliveInterval=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 User03@localhost -p 2222 uname'.
vtune: Error: VTune cannot detect remote machine configuration.

 

I tried to use the normal SSH command and it works fine.Here is the command without mentioning the password.

C:\Windows\system32>ssh -p 2222  User03@localhost

I have configured Password less SSH by leaving the password as blank. I have included the Screenshot of normal SSH command working and the error i have mentioned above. I think there is a problem with the --target-system knob in mentioning the port number.

0 Kudos
Kirill_U_Intel
Employee
7,044 Views

Hi.

is the follow command ok too if you run it directly?

'ssh -o BatchMode=yes -o ServerAliveInterval=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 User03@localhost -p 2222 uname'

 

0 Kudos
Kirill_U_Intel
Employee
7,044 Views

Also, could you share collection logs for us?

set AMPLXE_LOG_DIR=WRITABLE_LOG_FOLDER

vtune --target-system=ssh:User03@localhost:2222 -collect hotspots -knob collection-type:hw-events -- /matrix/matrix.exe

WRITABLE_LOG_FOLDER must include vtune logs.

Thanks, Kirill

0 Kudos
Kothandaramaswamy__H
7,044 Views

Hi @KIRILL U,

Tried the command you mentioned,

'ssh -o BatchMode=yes -o ServerAliveInterval=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 User03@localhost -p 2222 uname'

It gave the following error,

'write: Connection refused'

I have attached the log files as you requested.

 

0 Kudos
Kirill_U_Intel
Employee
7,044 Views

To be clear

'ssh -p 2222  User03@localhost' works without any problem

BUT

'ssh -o BatchMode=yes -o ServerAliveInterval=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 User03@localhost -p 2222 uname' provides error.

Is this true?

Kirill

0 Kudos
Kothandaramaswamy__H
7,043 Views

Hi @Kirill U.,

Yes you are right . I have mentioned the error in the previous comment.

0 Kudos
Kirill_U_Intel
Employee
7,043 Views

was error in both cases? 

 - 'ssh -p 2222  User03@localhost'

- 'ssh -o BatchMode=yes -o ServerAliveInterval=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5 User03@localhost -p 2222 uname'

0 Kudos
Kothandaramaswamy__H
7,044 Views

Hi,

No the 1st command worked. The 2nd command threw error. I have mentioned the error in previous comment.

0 Kudos
Kirill_U_Intel
Employee
7,044 Views

Unfortunately I could not reproduce that on my side.

Could you help me with triaging?

Remove one by one parameters to catch what is wrong in the 2nd command.

 

0 Kudos
Kothandaramaswamy__H
7,044 Views

Hi Kirill,

Yes i can do that but i am not sure about the 'uname' parameter in the command ? What does that mean, any idea?

0 Kudos
Kirill_U_Intel
Employee
7,044 Views

uname - is utility for getting os type, kernel information and so on.

Do you have windows as ssh target? uname is 'linux' utility.

VTune does not support windows as target now.

 

0 Kudos
Kothandaramaswamy__H
7,056 Views

Yes windows is my target. Can this feature be implemented ?

0 Kudos
Kirill_U_Intel
Employee
7,056 Views

Let's me check with VTune team that we could do here.

0 Kudos
Kothandaramaswamy__H
7,056 Views

I have given the entire details about my Objective in the previous comment section and the original post. I have also shared all the errors and the things requested by the team. I would really appreciate if something can be done soon about my issue. Thank you

0 Kudos
Stas-Neverov-Intel
8,361 Views

Hi Harinarayanan,

There is a preview feature that could help you. We now offer VTune as a web server in addition to the classic desktop usage model. We also do support Windows targets with VTune servers.

More information here:

You have two options with VTune Profiler Server. You can either run VTune server on your Windows target and access it remotely via web browser. Or you can run VTune server on any Windows host accessible from the target system and run VTune Profiler Agent on your Windows target. The first option should easier to setup.

Since you need HW profiling then both options require your target to be Windows-based VM with enabled PMU virtualization like Denis suggested above. 

Please check the online documentation above and let us know if you have any issues setting up a server.

 

0 Kudos
Reply