Hello,
I wanted to share a recent work I’ve done to better visualise the dependencies between classes, with the call graph [1].
For the extension I am currently developping (MediaWikiFarm [2]), I wanted to obtain the call graph. First I did it by hand, but then I found a program doing the job, phpCallGraph [3], but unfortunately it was unmaintained since 2009 (PHP 5.2 era). I did maintenance and it partly works [4], I still have issues with the autoloader.
Here are some preliminary results I got: (these are packages without much external dependencies due to autoloader issues) * Extension:MediaWikiFarm
https://www.mediawiki.org/wiki/File:Call_graph_of_extension_MediaWikiFarm.sv... * Extension:Math https://www.mediawiki.org/wiki/File:Call_graph_of_extension_Math.svg * Extension:CentralAuth
https://www.mediawiki.org/wiki/File:Call_graph_of_extension_CentralAuth.svg * directory 'includes' of MediaWiki without subdirectories (too big)
https://www.mediawiki.org/wiki/File:Call_graph_of_MediaWiki%E2%80%99s_direct...
I plan to improve this software (see README on GitHub), please say if you if you are interested by this type of graph and/or interested in contributing.
Thanks, Seb35
[1] https://en.wikipedia.org/wiki/Call_graph (the overapproximation of the static call graph to be precise) [2] https://www.mediawiki.org/wiki/Extension:MediaWikiFarm [3] http://phpcallgraph.sourceforge.net [4] https://github.com/Seb35/phpcallgraph
Sounds like a cool project! If you are not specifically interested in static graphs, you can also use profilers (XDebug, xhprof) to capture calls as they happen and display them with KCacheGrind or something similar. That gives you call graphs which include information like percentage of time spent in a subgraph and are great for optimization.
Doxygen can also supposedly generate static call graphs, although I don't know how good it is at it (it's generally not very PHP-friendly).
Hi,
I think we used to have callgraphs on svn.wikimedia.org (What is modern day doc.wikimedia.org), but they got disabled ~2012 (See commit 1ce4aab13ce). However, If you're interested in this sort of thing you could also try generating the doxygen call graphs yourself by setting CALL_GRAPH = YES (and maybe CALLER_GRAPH = YES) in maintinance/Doxyfile and running make doc in maintenance (provided you had doxygen and graph viz installed).
-- Bawolff
On Wed, Nov 9, 2016 at 11:43 AM, Seb35 seb35wikipedia@gmail.com wrote:
Hello,
I wanted to share a recent work I’ve done to better visualise the dependencies between classes, with the call graph [1].
For the extension I am currently developping (MediaWikiFarm [2]), I wanted to obtain the call graph. First I did it by hand, but then I found a program doing the job, phpCallGraph [3], but unfortunately it was unmaintained since 2009 (PHP 5.2 era). I did maintenance and it partly works [4], I still have issues with the autoloader.
Here are some preliminary results I got: (these are packages without much external dependencies due to autoloader issues)
- Extension:MediaWikiFarm
https://www.mediawiki.org/wiki/File:Call_graph_of_extension_MediaWikiFarm.sv...
- Extension:Math https://www.mediawiki.org/wiki/File:Call_graph_of_extension_Math.svg
- Extension:CentralAuth
https://www.mediawiki.org/wiki/File:Call_graph_of_extension_CentralAuth.svg
- directory 'includes' of MediaWiki without subdirectories (too big)
https://www.mediawiki.org/wiki/File:Call_graph_of_MediaWiki%E2%80%99s_direct...
I plan to improve this software (see README on GitHub), please say if you if you are interested by this type of graph and/or interested in contributing.
Thanks, Seb35
[1] https://en.wikipedia.org/wiki/Call_graph (the overapproximation of the static call graph to be precise) [2] https://www.mediawiki.org/wiki/Extension:MediaWikiFarm [3] http://phpcallgraph.sourceforge.net [4] https://github.com/Seb35/phpcallgraph
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org