Analyzers
Support for Analyzers (Intel VTune™ Profiler, Intel Advisor, Intel Inspector)
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
4752 Discussions

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

M_Stickland
Novice
526 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
494 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


AthiraM_Intel
Moderator
467 Views

Hi,


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


Thanks


M_Stickland
Novice
442 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

 

AthiraM_Intel
Moderator
398 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/...


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


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


M_Stickland
Novice
315 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

AthiraM_Intel
Moderator
349 Views

Hi,


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



Thanks


AthiraM_Intel
Moderator
323 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


Reply