using the gprof -f option in Linux for c++
Вопрос
Hi so i have started using gprof for my profiling work and it works fine except for the -f option which allows me to specifiy a particular function to be viewed in the call graph.
for example
Call graph (explanation follows)
granularity: each sample hit covers 4 byte(s) no time propagated
index % time self children called name
0.00 0.00 1/1 __do_global_ctors_aux [13]
[5] 0.0 0.00 0.00 1 global constructors keyed to main [5]
0.00 0.00 1/1 __static_initialization_and_destruction_0(int, int) [6]
-----------------------------------------------
0.00 0.00 1/1 global constructors keyed to main [5]
[6] 0.0 0.00 0.00 1 __static_initialization_and_destruction_0(int, int) [6]
-----------------------------------------------
0.00 0.00 1/1 main [4]
[7] 0.0 0.00 0.00 1 car::DisplayPrice() [7]
-----------------------------------------------
0.00 0.00 1/1 main [4]
[8] 0.0 0.00 0.00 1 car::showc() [8]
-----------------------------------------------
0.00 0.00 1/1 main [4]
[9] 0.0 0.00 0.00 1 car::car(std::string, int) [9]
0.00 0.00 1/1 vehical::vehical(int, int) [12]
-----------------------------------------------
0.00 0.00 1/1 main [4]
[10] 0.0 0.00 0.00 1 car::~car() [10]
-----------------------------------------------
0.00 0.00 1/1 main [4]
[11] 0.0 0.00 0.00 1 vehical::show() [11]
-----------------------------------------------
0.00 0.00 1/1 car::car(std::string, int) [9]
[12] 0.0 0.00 0.00 1 vehical::vehical(int, int) [12]
-----------------------------------------------
Now if i specify
gprof -f car::car(std::string, int) a.out gmon.out
i get error
syntax error near unexpected token '('
now if i do
gprof -f car::car(std::string, int) a.out gmon.out
i get an error
No such file or directory
if i try putting the function in double quotes i get an output as above with no change..
CAN Someone please help me with this ?? Thanks in advance
Решение
() is taken by your shell. Try like this:
gprof -f 'car::car(std::string, int)' a.out gmon.out
Не связан с StackOverflow