分析并生成代码统计信息
我想知道是否有人有任何想法或程序来生成源代码的一般统计信息。
我突然想知道我的项目代码中有多少函数被调用一次或很少次,或者任何类只实例化一次。
我确信还有很多其他有趣的事情有待发现。
我可以使用 grep magic 做类似上面的事情,但是有人遇到过工具或技巧吗?
I was wondering if anyone had any ideas or procedures for generating general statistics on your source code.
Off the top of my head I would love to know how many functions in my project's code are called once or very few times or any classes that are only instantiated once.
I'm sure there is a ton of other interesting things to be found out.
I could do something like the above using grep magic but has anyone come across tools or tips?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Coverity 是我首先想到的。它目前提供(在其产品之一上)
Coverity is the first thing coming to mind. It currently offers (on one of their products)
有很多工具可以做到这一点。但据我所知,它们都不是独立于语言的(这基本上是不可能的,例如某些语言甚至可能没有函数)。
通常,您会在“代码覆盖工具”或“分析器”类别下找到这些工具。
对于.Net,您可以使用Visual Studio 或Clrprofiler。
There are lots of tools that do this. But afaik none of them are language independent (which in turn would be mostly impossible e.g. some languages might not even have functions).
Generally you will find those tools under the categories of "code coverage tools" or "profilers".
For .Net you can use Visual Studio or Clrprofiler.