|
From: Chris J. <jo...@he...> - 2006-02-28 17:18:43
|
Hi, I know this is perhaps not quite the correct mailing list, but its the closest I have found for callgrind related questions. I'm running valgrind 3.1.0 and callgrind 0.10.1. I am trying to use the --dump-before= option, which I have used before fine with older releases. I have a C++ class A, with method foo. I want to get a dump before each call to A::foo. Previously I just used the option --dump-before=A:foo and that worked fine. Now it does not - I get one huge dump at the end. I see from the release notes that there was some changes to how this option handles names recently 2005-04-01 Josef Weidendorfer <Jos...@gm...> * Release 0.9.11 * Support of Valgrind 2.4.0. * Fix handling of function name patterns on command line "--dump-before=foo" previously created a dump when entering functions which began with "foo". Now it dumps only on "foo". Wildcards "?" and "*" are fully supported. * ....etc. But I have tried all combinations I can think of with no luck, and I have failed to find any real documentation on this feature. Can anyone tell me the correct syntax to use ? cheers Chris |
|
From: Josef W. <Jos...@gm...> - 2006-02-28 20:22:56
|
On Tuesday 28 February 2006 18:18, Chris Jones wrote: > I know this is perhaps not quite the correct mailing list, but its the > closest I have found for callgrind related questions. As the volume of Callgrind related mails is quite low, this mailing list seems adequate for such questions. > I'm running valgrind 3.1.0 and callgrind 0.10.1. I am trying to use the > --dump-before= option, which I have used before fine with older > releases. > > I have a C++ class A, with method foo. I want to get a dump before each > call to A::foo. Previously I just used the option --dump-before=A:foo > and that worked fine. Now it does not - I get one huge dump at the end. Hmmm... Callgrind uses demangled names for C++, which contains the full signature, i.e. in your case for example A::foo(int) Does it work with "--dump-before=A::foo*" ? If not, this is probably a bug... > * Fix handling of function name patterns on command line > "--dump-before=foo" previously created a dump when entering > functions which began with "foo". Now it dumps only on "foo". > Wildcards "?" and "*" are fully supported. The problem with the previous use was this: If you have C functions "foo" and "foobar", there was no way to specify "foo" only; you always selected both "foo" and "foobar". You always should get the old behavior by appending a "*" at the end: "foo*" matches both above. Note that this is no problem with C++, as you always can say "foo(*" to match any C++ function "foo" with arbitrary signature. Josef > But I have tried all combinations I can think of with no luck, and I > have failed to find any real documentation on this feature. Can anyone > tell me the correct syntax to use ? > > cheers Chris > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > > |
|
From: Chris J. <jo...@he...> - 2006-03-01 09:02:37
|
Hi, > Callgrind uses demangled names for C++, which contains the full signature, > i.e. in your case for example > A::foo(int) > Does it work with "--dump-before=A::foo*" ? > If not, this is probably a bug... The problem was I use -O2, and in this case "--dump-before=A::foo*" does not work. I managed to get it working in my case with "--dump-before=*A*foo*". I am sure turning on optimisation will confuse some things for the optimiser (i.e. if A::foo is inlined), so I am perhaps not too surprised at this. Incidently, does callgrind "officially" profiling with optimisation, or am I just lucky in this case. The information I am getting from kcachegrind seems fine... > The problem with the previous use was this: If you have C functions > "foo" and "foobar", there was no way to specify "foo" only; you always > selected both "foo" and "foobar". > You always should get the old behavior by appending > a "*" at the end: "foo*" matches both above. > Note that this is no problem with C++, as you always can say "foo(*" to > match any C++ function "foo" with arbitrary signature. thanks for the explanation. Chris |
|
From: Josef W. <Jos...@gm...> - 2006-03-01 09:32:29
|
On Wednesday 01 March 2006 10:02, Chris Jones wrote: > Hi, > > > Callgrind uses demangled names for C++, which contains the full signature, > > i.e. in your case for example > > A::foo(int) > > Does it work with "--dump-before=A::foo*" ? > > If not, this is probably a bug... > > The problem was I use -O2, and in this case "--dump-before=A::foo*" does > not work. I managed to get it working in my case with > "--dump-before=*A*foo*". I do not understand. You compiled your program so that A::foo got inlined by the compiler? If a function is inlined, it does not appear in the symbol table, so Callgrind will not see it, ie. it of course also will _not_ be catched by something like "*A*foo*". I suppose you have a similar named function which is not inlined and which was catched instead? > I am sure turning on optimisation will confuse some things for the > optimiser Which optimizer do you talk about here? > (i.e. if A::foo is inlined), so I am perhaps not too surprised > at this. Incidently, does callgrind "officially" profiling with > optimisation, I again do not understand this question. Of course, for profiling, your target code should be compiled in the same way you would use for a release of your binary. Otherwise, profiling results will be skewed, ie. not useful. Options like --dump-before are probably only useful after a first round of full profiling, so you see the functions available (and which ones are not because of inlining). Josef |
|
From: Chris J. <jo...@he...> - 2006-03-01 14:32:12
|
J >>The problem was I use -O2, and in this case "--dump-before=A::foo*" does >>not work. I managed to get it working in my case with >>"--dump-before=*A*foo*". > > > I do not understand. > You compiled your program so that A::foo got inlined by the compiler? > If a function is inlined, it does not appear in the symbol table, so > Callgrind will not see it, ie. it of course also will _not_ be catched > by something like "*A*foo*". I suppose you have a similar named function > which is not inlined and which was catched instead? No, A::foo is a not an inlined function. Of course inline functions are not seen. So, to clarify. A::foo is not inlined. Without -O2 (gcc) "--dump-before=A::foo*" works fine. With -O2 it does not, but does work if I change it to "--dump-before=*A*foo*" > Which optimizer do you talk about here? gcc and -O2 (gcc 3.2.3) Redhat EL3 (technically a derivative called SLC3) > I again do not understand this question. > Of course, for profiling, your target code should be compiled in the > same way you would use for a release of your binary. Otherwise, profiling > results will be skewed, ie. not useful. Exactly, thats why I was trying with -O2 :) > > Options like --dump-before are probably only useful after a first round of > full profiling, so you see the functions available (and which ones are not > because of inlining). Yes. I agree In this case though, I am using the option for another reason. I am actually trying to profile a very large program, which repeats the same calculations many times. A::foo is the top level method, so by doing this I get one dump per calculation. If I don't do this the callgrind dump file is huge and kcachegrind needs massive amounts of memory to view the file (almost 1G). cheers Chris > > Josef > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users -- +--------------------------------------------------------------+ | Dr Chris R Jones work : +44 (0)1223 337324 | | HEP Group (rm 882) fax : +44 (0)1223 353920 | | Cavendish Laboratory, home : +44 (0)1223 510711 | | Madingley Road, mobile : +44 (0)7723 327477 | | Cambridge, CB3 0HE email : jo...@he... | +--------------------------------------------------------------+ |
|
From: Josef W. <Jos...@gm...> - 2006-03-01 20:26:44
|
On Wednesday 01 March 2006 15:31, Chris Jones wrote: > No, A::foo is a not an inlined function. Of course inline functions are > not seen. So, to clarify. A::foo is not inlined. Without -O2 (gcc) > "--dump-before=A::foo*" works fine. With -O2 it does not, but does work > if I change it to "--dump-before=*A*foo*" That sounds very strange, and like a bug. Can you check if the symbols change when compiled with vs. without -O2 ? If not, it would be nice if you would be able to generate small binaries which show the same effect, and send them in private to me. Perhaps there is really some bug here. > In this case though, I am using the option for another reason. > > I am actually trying to profile a very large program, which repeats the > same calculations many times. A::foo is the top level method, so by > doing this I get one dump per calculation. If I don't do this the > callgrind dump file is huge and kcachegrind needs massive amounts of > memory to view the file (almost 1G). Wow. But when the same calculation is iterated over and over, the amount of data should stay similar, as counts are incremented, but not getting more. The number of counts Callgrind dumps should be linear to the amount of executed code, and not time. Josef |