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

How can I profile a binary that needs to launch in a new linux terminal window?

M_Stickland
Novice
1,095 Views

Hi,

I'm having trouble trying to profile a binary application that needs to be run in a new linux terminal window using VTune. It needs to launch in a terminal because I need to interact with it after startup. For reference, I'll call this binary myAPP.

I tried launching myAPP directly from within the vtune-gui using launch-application, where the myAPP output gets redirected to the terminal that was used to launch vtune-gui. The problem with this is that while the myAPP print output displays in this terminal, it doesn't respond to the Ctrl-C we trap in myAPP, which allows myAPP to drop into its internal console command prompt and accept user input.

I've also tried launching myAPP by wrapping it in a shell script, and using gnome-terminal to run myAPP in a new terminal window. This works fine for allowing me to interact with myAPP, but for some reason VTune doesn't seem to be able to profile the myAPP process when launched this way.

I've checked the box for Analyze child processes, and even tried selecting Analyze system-wide, and tried using Auto, Native, and Mixed managed code profiling modes, but VTune still doesn't appear to detect and profile it. The script I use to launch myAPP in a new terminal window using gnome-terminal is as follows:

#!/bin/bash
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT

gnome-terminal --command "./myAPP <arguments>"
wait

 

 

Is there an accepted way to profile a binary that needs to be run in a new linux terminal window?

 

Thanks,

M_Stickland

Labels (1)
0 Kudos
7 Replies
AthiraM_Intel
Moderator
1,063 Views

Hi,


Thanks for posting in Intel communities.


Could you please share the following details:


1. OS you are using

2. VTune version

3. Hardware you are using

4. Sample reproducer code(sample application that is similar to the application you are trying to analyze) and the exact steps you followed.




Thanks


0 Kudos
AthiraM_Intel
Moderator
1,036 Views

Hi,


We have not heard back from you. Could you please share the above mentioned details?


Thanks


0 Kudos
M_Stickland
Novice
1,011 Views

Client OS is:

Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic

 

VTune version is:

Intel(R) VTune(TM) Profiler 2022.2.0 (build 623516) Command Line Tool
Copyright (C) 2009 Intel Corporation. All rights reserved.

 

Virtual Machine Hypervisor is:

VMware Fusion

Professional Version 12.2.3 (19436697)

 

Host OS is:

 System Version: macOS Big Sur 11.6.5 (20G527)

 Kernel Version: Darwin 20.6.0

 

Sample reproducer code:

I don't currently have any sample reproducer code, it's a pretty complex application, and unfortunately I'm unable to share the code I'm analyzing with you.

 

So, since you won't be able to test the Ctrl-C trapping that myAPP does, maybe we could focus instead on the fact that when I run myAPP in a new terminal window using gnome-terminal (see previous post for shell script example), VTune doesn't seem to be able to detect and analyze the myAPP process that gnome-terminal launched.

 

I'll see if I can find another application that is also not detected/analyzed by VTune when launched in this same way.

 

Thanks,

M_Stickland

 

0 Kudos
AthiraM_Intel
Moderator
967 Views

Hi,


Good day to you.


Thanks for sharing the details with us.


If you wish to interact with the terminal while running an analysis, we recommend you to use the command line method to perform the analysis.


For example, command to run hotspot analysis is given below:


vtune -collect hotspots -knob sampling-mode=sw -- /home/test/myApplication


Please refer the below links to know more about VTune command line interface:


https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/command-line-interface/command-syntax.html


https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/command-line-interface/running-command-line-analysis.html#running-command-line-analysis


https://www.intel.com/content/dam/develop/external/us/en/documents/vtune-profiler-cheat-sheet.pdf


If this helps, do accept this as a solution as it will helps others with a similar issue.


Thanks


0 Kudos
M_Stickland
Novice
884 Views

Hi,

In this original post, I simplified the shell script example I included for describing this problem. In the real shell script, I'm launching several other applications along with the  gnome-terminal -- ./myAPP <arguments>  command (see below). All of these applications are part of a single integrated system, and my goal is to be able to analyze the entire system all at once across multiple runs.

 

#!/bin/bash
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT

socat <linux domain socket arguments> & 

python3 app1.py &
sleep 3

python3 app2.py &

python3 app3.py <arguments> &

python3 app4.py <arguments> &

python3 app5.py <arguments> &

gnome-terminal -- ./myAPP <arguments>

wait

 

Can the vtune command line handle launching all of these applications together? If so, then I can launch the myAPP program without using the gnome terminal, and my problem would be solved. If not, then I still don't have a solution.

 

Best,

M_Stickland

0 Kudos
AthiraM_Intel
Moderator
918 Views

Hi,


Could you please give us an update? Is your issue resolved?



Thanks


0 Kudos
AthiraM_Intel
Moderator
892 Views

Hi,


We have not heard back from you. This thread will no longer be monitored by Intel. If you need further assistance, please post a new question.



Thanks


0 Kudos
Reply