We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
我推荐 doxygen,它会自动从源代码生成文档(并且是免费的)。通常,您会在描述函数和变量的注释中添加一些标记。但是,您可以在未记录的源文件上运行 doxygen,前提是您在配置文件中将
EXTRACT_ALL
设置为YES
,并让它为您的所有函数创建关系图(即该函数调用这些函数并被这些其他函数调用)。您需要安装 GraphViz 才能生成图表,并在配置文件中将
HAVE_DOT
选项设置为YES
。有关更多信息,请参阅 doxygen 文档中的图形和图表以及此示例类文档获取生成的输出示例。
编辑:当然,对于 Fortran,您应该在配置文件中将
OPTIMIZE_FOR_FORTRAN
选项设置为YES
。I would recommend doxygen, which automatically generates documentation from source code (and is free). Usually you add some markup to comments describing your functions and variables. However, you can just run doxygen on undocumented source files, provided you set
EXTRACT_ALL
toYES
in the configuration file, and have it create create relationship diagrams for all your functions (i.e. this function call these functions and is called by these other functions).You need GraphViz installed to get diagrams generated and have the
HAVE_DOT
option set toYES
in the configuration file.See the doxygen documentation for graphs and diagrams for more information and this example class documentation for a example of the output generated.
Edit: Of course for Fortran you should set the
OPTIMIZE_FOR_FORTRAN
option toYES
in the configuration file.如果你有钱,那么了解 Fortran 值得一看。如果您没有钱但打算快速工作,那么您可以尝试下载该软件。
对于静态调用图,我从未找到过像 Understanding 这样有用的免费工具;很难找到任何免费工具,更不用说有用的工具了。我自己写一个,但市场很小:-(
对于动态调用图,请调查您的编译器选项。我使用英特尔 Fortran 编译器,它可以生成大量有关正在执行的程序的有用信息。TotalView 调试器还可以可视化您还应该查看 gprof2dot GPROF 调用“graph”中的 DOT 文件,这是免费的,而且
我还应该补充一点,尽管它不是我曾经使用过的东西,但 Callgrind 可能有用。
If you have money then Understand for Fortran is worth looking at. If you don't have money but intend to work quickly then you might get by with a trial download of the software.
For a static call graph, I've never found a free tool as useful as Understand; it's hard to find any free tools let alone a useful one. I'd write one myself but the market would be tiny :-(
For a dynamic call graph investigate your compiler options. I use the Intel Fortran Compiler which can generate a mound of useful information about an executing program. The TotalView debugger can also visualise the call graph of an executing program. You should also look at gprof2dot which makes a DOT file out of a GPROF call 'graph'. This is free and OK.
And I should also add, though it's not something I've ever used, that Callgrind may be of use.
您可以在 Valgrind 中使用
callgrind
:这将生成
callgrind.out。 [pid]
文件。如果您在没有优化的情况下编译程序并使用调试标志,那么这种方法效果最好。然后,您有几个查看数据的选项:
You can use
callgrind
from within Valgrind:This will produce a
callgrind.out.[pid]
file. This works best if you compile your program without optimisations, and with debug flags.You then have a couple of options for viewing the data: