|
From: Josef W. <Jos...@gm...> - 2015-07-30 07:47:25
|
Am 25.07.2015 um 00:42 schrieb Kay Hayen: > I am therefore considering an improvement to callgrind, that would try > to make it emit the Python function name, and the Python source file > instead. Do you think that is possible, and can you give me pointers to > inside the valgrind source distribution, what to change, where to hook? > > Looking at callstack.c in callgrind directory, would it be possible to > make direct accesses to the running binary to capture stuff from its > data, from function arguments, or is that not possible? When callgrind detects that a function is entered, it is quite simple to modify the captured function name with whatever information is available, which directly is reflected in the profile output. See attached patch, which allows to add parameter values to function names to better distinguish recursive calls of same functions but with different parameters. Not sure this patch still applies, but should provide the direction. It was never added to main line, as the code depends on the calling convention and thus is not platform independent as VG tools are expected to be... the patch directly accesses stack values from the client code. For you, passing the currently executed Phython function name to callgrind for extending the function names should work fine. This can be done by adding a client call, are by setting a global var which is recognized by callgrind. Hope this helps. Josef > > Should this be possible, it would enable profiling of Python code with > valgrind that is accurate for even single iterations as it's based on > ticks. So please help me there, if you can. > > Yours, > Kay Hayen > > > ------------------------------------------------------------------------------ > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > -- Dr. Josef Weidendorfer, Informatik, Technische Universität München TUM I-10 - FMI 01.04.035 - Tel. 089 / 289-18454 |