From: Igor G. <i....@br...> - 2011-10-14 15:42:33
|
Hello happy people, I asked this question on stackoverflow already, but given the deafening silence I thought I that subscribing to one more mailing list could do any harm. For reference: http://stackoverflow.com/questions/7761448/filter-calls-to-libc-from-valgrinds-callgrind-output To summarize: I'm trying to get a call-graph for Apache Traffic Server for documentation purposes. In this sense I don't care about how long a function call takes. If it's part of our source base, it's relevant to me. Thus, I would like to filter out all calls which stem from external libraries, such as libc, libtlc, libcrypto, etc... Is there any way I can achieve this with vallgrind/callgrind? Is there any way I can achieve this with kcachegrind? Or any other tool? Is there a standard way I can, manually or (preferably) automatically transform callgrind's output, before further transforming it to dot format? I think that's enough questions for now (: Thank you very much in advance. So long, i -- Igor Galić Tel: +43 (0) 664 886 22 883 Mail: i....@br... URL: http://brainsware.org/ GPG: 571B 8B8A FC97 266D BDA3 EF6F 43AD 80A4 5779 3257 |
From: Josef W. <Jos...@gm...> - 2011-10-14 17:16:34
|
On 14.10.2011 17:42, Igor Galić wrote: > To summarize: I'm trying to get a call-graph for Apache Traffic Server > for documentation purposes. In this sense I don't care about how long > a function call takes. If it's part of our source base, it's relevant > to me. Thus, I would like to filter out all calls which stem from > external libraries, such as libc, libtlc, libcrypto, etc... Ok. > Is there any way I can achieve this with vallgrind/callgrind? The callgrind output has every call which happened while running. So at least, this would be a good basis. > Is there any way I can achieve this with kcachegrind? When kcachegrind wants to show the call graph, it limits the scope to show. It should be straight forward to modify the source to add a way to stop the call graph when it crosses library borders. See http://websvn.kde.org/trunk/KDE/kdesdk/kcachegrind/libviews/callgraphview.cpp?view=markup The function to look at is GraphExporter::buildGraph (line 953 ff.). It could be enough to just add at the beginning: if (f->object() != ((TraceFunction*)_item)->object()) return; > Or any > other tool? No idea. > Is there a standard way I can, manually or (preferably) automatically > transform callgrind's output, before further transforming it to > dot format? You mean get rid of all calls crossing library borders? In the callgrind format, a line starting with "ob=" specifies the library from which calls are done (the rest of the line), and "cob=" the target library of following calls, with "cob=" defaulting to the previous "ob=" if not explicitly given. Thus, you could write a PERL/Phython script which maintains current ob/cob values, and for lines starting with "calls=", just throw them away if cob and ob are not the same. And you need to use "--compress-strings=no" for callgrind for this to work. So long, Josef > > I think that's enough questions for now (: > > Thank you very much in advance. > > So long, > i > |
From: Igor G. <i....@br...> - 2011-10-14 23:52:31
Attachments:
clean_callgrind.pl
|
----- Original Message ----- > On 14.10.2011 17:42, Igor Galić wrote: > > To summarize: I'm trying to get a call-graph for Apache Traffic > > Server > > for documentation purposes. In this sense I don't care about how > > long > > a function call takes. If it's part of our source base, it's > > relevant > > to me. Thus, I would like to filter out all calls which stem from > > external libraries, such as libc, libtlc, libcrypto, etc... > Ok. > > Is there any way I can achieve this with vallgrind/callgrind? > The callgrind output has every call which happened while running. > So at least, this would be a good basis. > > > Is there any way I can achieve this with kcachegrind? > When kcachegrind wants to show the call graph, it limits the scope > to show. It should be straight forward to modify the source to add > a way to stop the call graph when it crosses library borders. > > See > http://websvn.kde.org/trunk/KDE/kdesdk/kcachegrind/libviews/callgraphview.cpp?view=markup > > The function to look at is GraphExporter::buildGraph (line 953 ff.). > It could be enough to just add at the beginning: > > if (f->object() != ((TraceFunction*)_item)->object()) return; > > > > Or any > > other tool? > No idea. > > Is there a standard way I can, manually or (preferably) > > automatically > > transform callgrind's output, before further transforming it to > > dot format? Joseph, thank you very much for your reply. > You mean get rid of all calls crossing library borders? > > In the callgrind format, a line starting with "ob=" specifies the > library from > which calls are done (the rest of the line), and "cob=" the target > library of > following calls, with "cob=" defaulting to the previous "ob=" if not > explicitly given. > Thus, you could write a PERL/Phython script which maintains current > ob/cob values, and for lines starting with "calls=", just throw them > away if > cob and ob are not the same. > And you need to use "--compress-strings=no" for callgrind for this to > work. With a lot of patience and help form #perl on FreeNode, I have managed to put together a script which does indeed reduce the calls as I wanted to. While the output is still 2.4 MiB, this is a great improvement over the 3.6 MiB from before. The next step in reduction will be to separate startup from request handling. Please find attached the script I use to reduce callgrind output. > So long, > Josef o/~ i -- Igor Galić Tel: +43 (0) 664 886 22 883 Mail: i....@br... URL: http://brainsware.org/ GPG: 571B 8B8A FC97 266D BDA3 EF6F 43AD 80A4 5779 3257 |
From: Josef W. <Jos...@gm...> - 2011-10-17 12:59:51
|
On 15.10.2011 01:52, Igor Galić wrote: > > With a lot of patience and help form #perl on FreeNode, I have > managed to put together a script which does indeed reduce the > calls as I wanted to. > > While the output is still 2.4 MiB, this is a great improvement > over the 3.6 MiB from before. While it is very specific for your use case, your script seems to look fine. Best, Josef > > The next step in reduction will be to separate startup from request > handling. > > Please find attached the script I use to reduce callgrind output. > >> So long, >> Josef > o/~ > > i > |
From: Igor G. <i....@br...> - 2011-10-17 18:51:08
|
----- Original Message ----- > On 15.10.2011 01:52, Igor Galić wrote: > > > > With a lot of patience and help form #perl on FreeNode, I have > > managed to put together a script which does indeed reduce the > > calls as I wanted to. > > > > While the output is still 2.4 MiB, this is a great improvement > > over the 3.6 MiB from before. > While it is very specific for your use case, your script seems > to look fine. $cob and $ob could be made parameters -- or someone who needs this kind of functionality could just edit them in the script. > Best, > Josef i -- Igor Galić Tel: +43 (0) 664 886 22 883 Mail: i....@br... URL: http://brainsware.org/ GPG: 571B 8B8A FC97 266D BDA3 EF6F 43AD 80A4 5779 3257 |