Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Employee
27 Views

Collect arguments for a certain function call

Jump to solution

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

Accepted Solutions
Highlighted
27 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-sessi...

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
Highlighted
28 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-sessi...

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
Highlighted
Employee
27 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