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

Collect arguments for a certain function call

Po-yen_C_Intel
Employee
479 Views

Hi,

I am analyze my workload which has a very hot function. I wonder if I can use Vtune to report what arguments are passed into this function? For example, if I have a function func() take one character as an input, 

argument "a" : 10 times

argument "b" : 100 times

argument "c": 50 times

 

I try to google the answer but there seems to be no such solution, no matter in Vtune or other tools.The problem is I want to do this without changing the source code.

Thank you very much

 

 

 

 

 

0 Kudos
1 Solution
Ekaterina_L_Intel
479 Views

Hello,

VTune doesn't provide such capabilities.

It sounds more like an automated debugging which can be done via GDB scripts. See examples here: http://stackoverflow.com/questions/10748501/what-are-the-best-ways-to-automate-a-gdb-debugging-session

A very simple gdb script file reporting all func invocations with arguments might look as below:

set width 0
set height 0
set verbose off
start  # runs to main, so shared libraries are loaded

break func
commands 2
  cont
end

run

 

Then it can be run via GDB as:

>gdb --batch --command=./script --args <your workload>

Then you can grep -c the output to count number of particular argument values.

Regards, Katya

View solution in original post

0 Kudos
2 Replies
Ekaterina_L_Intel
480 Views

Hello,

VTune doesn't provide such capabilities.

It sounds more like an automated debugging which can be done via GDB scripts. See examples here: http://stackoverflow.com/questions/10748501/what-are-the-best-ways-to-automate-a-gdb-debugging-session

A very simple gdb script file reporting all func invocations with arguments might look as below:

set width 0
set height 0
set verbose off
start  # runs to main, so shared libraries are loaded

break func
commands 2
  cont
end

run

 

Then it can be run via GDB as:

>gdb --batch --command=./script --args <your workload>

Then you can grep -c the output to count number of particular argument values.

Regards, Katya

0 Kudos
Po-yen_C_Intel
Employee
479 Views

Thank you Ekaterina!

I am not too familiar with GDB so it took me a while to write and debug my GDB script. It works for me now.

Thanks!

0 Kudos
Reply