淘宝商城(天猫)高级技术专家.3年研发+3年性能测试调优/系统测试+4年团队管理与测试架构、研发系统实践. 新舞台新气象, 深化测试基础架构及研发架构,希望能在某个技术领域成为真正的技术大牛。欢迎荐才http://bbs.51testing.com/viewthread.php?tid=120496&extra=&page=1 .邮件: jianzhao.liangjz@alibaba-inc.com,MSN:liangjianzhao@163.com.微博:http://t.sina.com.cn/1674816524

C++代码度量工具-cccc

上一篇 / 下一篇  2009-12-09 00:27:53 / 个人分类:搜索引擎测试技巧

 

软件度量多个指标依赖于代码行统计,如每千行代码发现bug等,所以代码行是一个基础数据。

 

Cccc开源工具, 从http://cccc.sourceforge.net/下载,支持linux ,win32 c/c++代码。

linux上执行./build_posixgcc.sh && make install 部署cccc.

 

[liangjz@b2b_plat_1367 src]$ cccc  --help

Usage:

cccc [options] file1.c ... 

Process files listed on command line.

If the filenames include '-', read a list of files from standard input.

Command Line Options: (default arguments/behaviour specified in braces)

--help                  * generate this help message

--outdir=<dname>        * directory for generated files {.cccc}

--html_outfile=<fname>  * name of main HTML report {<outdir>/cccc.html}

--xml_outfile=<fname>   * name of main XML report {<outdir>/cccc.xml}

--db_infile=<fname>     * preload internal database from named file

                          {empty file}

--db_outfile=<fname>    * save internal database to file {<outdir>/cccc.db}

--opt_infile=<fname>    * load options from named file {hard coded, see below}

--opt_outfile=<fname>   * save options to named file {<outdir>/cccc.opt}

--lang=<string>         * use language specified for files specified

                          after this option (c,c++,ada,java, no default)

--report_mask=<hex>     * control report content

--debug_mask=<hex>      * control debug output content

                          (refer to ccccmain.cc for mask values)

Refer to ccccmain.cc for usage of --report_mask and --debug_mask.

Refer to cccc_opt.cc for hard coded default option values, including default

extension/language mapping and metric treatment thresholds.

 

Cccc不能对一个目录下的文件做递归式的扫描。

 

[liangjz@b2b_plat_1367 client]$ cccc  *.*

...

Primary HTML output is in .cccc/cccc.html

Detailed HTML reports on modules and source are in .cccc

Primary XML output is in .cccc/cccc.xml

Detailed XML reports on modules are in .cccc

Database dump is in .cccc/cccc.db

 

[liangjz@b2b_plat_1367 .cccc]$ ll .cccc 

可以看到生成的文件不同于源代码类。 

 

将结果都下载都本地可看到

Procedural MetricsObject Oriented DesignStructural Metrics Summary 等不同维度的数据。

Html格式的报告有很好的注释,黄色的可能需要再深入分析。

 

CCCC度量数据可结合测试风险完善测试计划。

 


TAG: cccc

 

评分:0

我来说两句

Open Toolbar