- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Intel VTune Community,
I'm currently working on a project where I need to profile multiple processes using Intel VTune Profiler. Specifically, I am looking to track several processes by their Process IDs (PIDs). I have experience with VTune but am encountering difficulties in configuring it to profile multiple processes simultaneously.
Here's a brief overview of what I'm currently doing:
I identify the PIDs of the processes I want to profile (all of them are instances of *.exe).
I am using a Python script to execute VTune with these PIDs. My current command looks something like this:
for pid in pids:
vtune_command = [
"vtune",
"-collect", "analysis_type",
"-result-dir", "logs_directory",
"-target-pid", str(pid)
]
subprocess.Popen(vtune_command, shell=True)
This command works fine for individual processes, but I am unsure how to modify it to track multiple processes in one go.
Could you please provide guidance on how to modify my VTune command or approach so that I can profile multiple processes identified by their PIDs? Is there a way to attach VTune to multiple PIDs simultaneously, or should I approach this differently?
Any examples or detailed instructions would be highly appreciated, as they would significantly aid in the advancement of my project.
Thank you in advance for your time and assistance.
Best regards,
Rafał
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Good day to you.
Thanks for posting in Intel Communities.
You can use Intel VTune Profiler to run multiple instances of software profiling simultaneously to track processes by PIDs without any issues. Unfortunately, you can only run one hardware analysis collection (if you want more precise profiling) since the collection counters will be locked with one analysis process and the other analysis processes will be in pending states.
Here is a sample Python code that achieves your use case that does software hotspots analysis on three processes using Intel VTune Profiler CLI:
import subprocess
pids = ['12728', '2484', '24672']
result = ["logs_directory_" + pid for pid in pids]
for i in range(len(pids)):
vtune_command = [
"vtune",
"-collect", "hotspots",
"-result-dir", str(result[i]),
"-target-pid", str(pids[i])
]
subprocess.Popen(vtune_command)
If this resolves your query, kindly mark it as a solution since it will help others facing a similar issue.
If you are still facing any issues, kindly get back to us with more information such as screenshots, sample reproducer code and steps to replicate the issue from our side so that we can assist you better.
Thanks and Regards,
Jyothis V James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply.
The proposed code will work for "hotspots" analysis. However, I want to keep track of the "clockticks" of each process, which is why I am investigating the "uarch-exploration" microarchitecture. I have already performed a similar analysis using the VTune GUI. To do this, I used a *.bat file in which I put code that opens two independent processes in cmd and profiles these processes. Is it possible to make a similar case using the VTune API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So You want to profile multiple processes and all profilings are based on hardware sampling? VTune SEP doesn't support PMU sharing in multiple instances. You can profile two processes in two VTune instances using perf collection instead, like below:
console window1:
vtune -collect hotspots -knob sampling-mode=hw -knob enable-stack-collection=true --target-pid=230086 -d 30
console window2:
vtune -collect hotspots -knob sampling-mode=hw -knob enable-stack-collection=true --target-pid=230037 -d 30
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your responses. For now, I have decided to focus on tracking just one process, which should simplify the execution of my project. Your advice has been very helpful and provided me with a new perspective on how to approach process profiling.
Should I decide to revisit the concept of tracking multiple processes in the future, I will make use of the information gathered here. I appreciate your expertise and experience with using Intel VTune Profiler.
Once again, thank you for your help and support.
Best regards,
Rafał
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks you for using VTune Profiler, we are glad that VTune Profiler can help you, thanks.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page