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

Vtune CLI for online monitoring of process?

titanius_anglesmith
455 Views
Is it possible to use vtune in an online fashion like monitoring an application on the fly via command line on Linux? to see what kind of cycles it is executing every some number of seconds.

I am looking into an application to get cycle events on the fly for a process, but couldn't find anything in the documentation mentioning online monitoring.

Thanks!
0 Kudos
1 Solution
David_A_Intel1
Employee
455 Views
Actually, you can use the duration command-line parameter to collect data for a finite amount of time. You could then write a script that collects data for, say, 10 seconds, then dumps the results to the stdout and runs, again, in a loop. You will need to play with the view options to figure out how you want to display the results, but this would give you the kind of output that top does, for example, displaying data every n seconds.

For example,
> # create the activity
> vtl activity p1 -d 10 -c sampling
> # run the latest activity in the project
> vtl run
> vtl view -summary
> vtl delete p1::r1 -f
> # loop on these three commands


If you put that in a loop, you can view the activity on a regular basis. Note that in order to keep the data from bloating the disk, I've included a delete of the activity results.

Here is an example script that collects data for 5 seconds that I threw together:

#!/bin/sh
vtl -q activity m$ -d 5 -c sampling
read -t 1 x
while [ $? -ne 0 ]
do
echo "...collecting data..."
vtl -q run
echo "...displaying data..."
vtl -q view -summary
vtl -q delete m$::r1 -f
read -t 1 x
done


Hope that helps!

View solution in original post

0 Kudos
5 Replies
Peter_W_Intel
Employee
455 Views
Is it possible to use vtune in an online fashion like monitoring an application on the fly via command line on Linux? to see what kind of cycles it is executing every some number of seconds.

I am looking into an application to get cycle events on the fly for a process, but couldn't find anything in the documentation mentioning online monitoring.

Thanks!

Hi,

You can monitor sampling data collection activity, and control it - stop/cancel/pause/resume, and query the activity.

The command line is not "vtl" - that is ActivityController, use it in another shell.

You can know more detail for ActivityController usage by opening vtune/doc/users_guide/index.htm (search "ActivityController" string), or use "ActivityController -help" in command line.

ActivityController can't retrieve rich info such as cycles executed, process's status - this command line simply provides the status of activity only.


Hope it helps!

Regards, Peter

0 Kudos
David_A_Intel1
Employee
456 Views
Actually, you can use the duration command-line parameter to collect data for a finite amount of time. You could then write a script that collects data for, say, 10 seconds, then dumps the results to the stdout and runs, again, in a loop. You will need to play with the view options to figure out how you want to display the results, but this would give you the kind of output that top does, for example, displaying data every n seconds.

For example,
> # create the activity
> vtl activity p1 -d 10 -c sampling
> # run the latest activity in the project
> vtl run
> vtl view -summary
> vtl delete p1::r1 -f
> # loop on these three commands


If you put that in a loop, you can view the activity on a regular basis. Note that in order to keep the data from bloating the disk, I've included a delete of the activity results.

Here is an example script that collects data for 5 seconds that I threw together:

#!/bin/sh
vtl -q activity m$ -d 5 -c sampling
read -t 1 x
while [ $? -ne 0 ]
do
echo "...collecting data..."
vtl -q run
echo "...displaying data..."
vtl -q view -summary
vtl -q delete m$::r1 -f
read -t 1 x
done


Hope that helps!

0 Kudos
titanius_anglesmith
455 Views
Thank you peter wang and MrAnderson. I'll try both of them and report back :)

cheers
0 Kudos
titanius_anglesmith
455 Views
Cool. I have been able to extract many events using the script and its easy enough to make wrappers around :). Thanks a lot!

One more question:

Is it possible to sample just from some processes for the vtl command? like vtl...`pgrep firefox` either via a pid or a name ?


0 Kudos
Peter_W_Intel
Employee
455 Views
Cool. I have been able to extract many events using the script and its easy enough to make wrappers around :). Thanks a lot!

One more question:

Is it possible to sample just from some processes for the vtl command? like vtl...`pgrep firefox` either via a pid or a name ?



You can use like -
"vtl view -a?::r? -processes" to list all processes for specific [activity|result],knowid ofinterest of process
"vtl view -pid 0x??? -hf -mn module_name" to display all hot functionsforinterest of module from specific process.

Regards, Peter
0 Kudos
Reply