PHP Application Flow Graph (or function call graph)

北战南征 提交于 2019-11-30 07:08:04
Pascal MARTIN

I have never used any tool that can do that statically (i.e. from source files), but here's a way to get a callgraph when executing a script/application.


First, you need to install the Xdebug extension -- on a development/testing server (don't install it on a production server : it's quite bad for performances ^^ )

Then, you can use its profiling features to generate a .cachegrindout file corresponding to the execution of a page-load.


After that, you can load that .cachegrindout file with KCacheGrind (On linux -- I don't think there's a windows version) ; KCacheGrind can generate call-graphs from .cachegrindout files.

And here's an example of callgraph you can get :


(source: pascal-martin.fr)

(Here's, it's been generated from a .cachegrindout file obtained while loading a page of Dotclear, a blogging software)

Doxygen can do it statically. Just doxygen -d to create a config file, then edit it to create callgraphs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!