Metrics collection tools for C and C++ Source Code

This page lists various static code analysis tools that compute metrics defined on C and C++ source code. The metrics are primarily size and complexity of various types (lines of code, Halstead, McCabe, etc.).

You will need a C or C++ compiler to build most of these tools. For tools that use shell or perl scripts, you will need the appropriate interpreter to run them; these interpreters are on all unix systems.

The source files for each tool are available here. The files have been packed into Unix-style tar files, which in turn have been compressed with the GNU utility gzip.

PC users must have long file names (i.e., a win32 system) to unpack them. Note that the GNU utilities are available for the PC, and include both gunzip (uncompressing utility) and tar (unpacking utility).

Collected Tools

Many of the tools are collected on (and available from) this web site. The tools, in alphabetical order, are the following:

About building and using the tools in the collection:

I sucessfully built all of them using gcc/g++ on a sun running SunOS 4.1.3. The authors of packages `c_count', `csize', `metre', and sloccount went to considerable trouble to write portable code and flexible Makefiles. The `hp_mas' package also includes well-documented Makefiles. For `cyclo' and `metrics', no such effort was made, and consequently I had to monkey with some makefiles. Packages `ccount', `clc', `lc', and `spr' are relatively simple and should not present many problems.

Other Tools

Here are other tools related to counting source lines.

I have not used all of the tools extensively, so unfortunately I can't make any helpful statements about reliability or ease of use.


Home page