In your doxyfile install
GENERATE_XML = YES
and then you can find your call schedule in the XML files. For each function marked with callergraph, you will find <referencedby> output elements that you can use. Here is a sample from one of my C files:
<memberdef kind="function" id="spfs_8c_1a3" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual"> <type>svn_error_t *</type> <definition>svn_error_t * init_apr</definition> <argsstring>(apr_pool_t **ppool, int *argc, char const *const **argv)</argsstring> <name>init_apr</name> <location file="src/spfs.c" line="26" bodystart="101" bodyend="120"/> <referencedby refid="spfs_8c_1a13" compoundref="spfs_8c" startline="45" endline="94">main</referencedby> </memberdef>
So, for each memberdef / referencedby pair, you have a caller relationship that you can capture through XSLT:
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:apply-templates select="//memberdef[@kind eq 'function']"/> </xsl:template> <xsl:template match="memberdef"> <xsl:variable name="function-name" select="concat(definition, argsstring)"/> <xsl:for-each select="referencedby"> <xsl:value-of select="concat(./text(), ' calls ', $function-name, '
')"/> </xsl:for-each> </xsl:template> </xsl:stylesheet>
Which gives you the line for the caller as follows:
main calls svn_error_t * init_apr(apr_pool_t **ppool, int *argc, char const *const **argv)
You want to customize this XSLT and then split this oriented graph so that it crosses the smallest edges. Woo hoo, NP is a complete problem! Fortunately, there are many papers on this subject, some of them: http://www.sandia.gov/~bahendr/partitioning.html
source share