From: prechelt@i41s14.ira.uka.de (Lutz Prechelt)
Newsgroups: comp.lang.c,comp.lang.c++,comp.sources.wanted
Subject: SUMMARY: Software Metrics Tools available ?
Date: 2 Sep 1992 11:03:24 GMT
Organization: University of Karlsruhe, FRG
Distribution: world
NNTP-Posting-Host: i41s14.ira.uka.de


Some days ago, I posted the following question:

> Does anybody know of any freely available tools that compute
> some software metrics for C or C++ programs ?
>
> I am thinking of such things as numbers of operators/operands/controls
> per function/file/statement and so on.

This is the summary of the answers I got.
Basically, I did not find what I wanted. But some remotely similar tools
showed up: A simple lines-of-code counter script and ftp sites of 
Halstead Software Science metrics programs.

------------------------------

From: Clifton Liles 282-4736 <liles@sweetpea.jsc.nasa.gov>

This is not much but it what I have used to guess about code metics.  Its
a lines of code counter script.  
#!/bin/csh -f
#
# This shell divides the lines of code into two groups,
# "comments" and "executable" code (other), as described below.
# The "executable" lines of code is not the number of executable statements.
#
# C
#	comments include:
#		comments (from lines with /* to lines with */)
#		blank lines
#		lines with only braces and/or semicolons
#
#	executable lines include:
#		lines which are not comments
#
# FORTRAN
#	comments include:
#		comments (lines beginning with C or c)
#		blank lines
#
#	executable line include:
#		lines which are not comments
#

echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
echo -n $1"	"


if($1:e == "c" || $1:e == "h") then

	@ total = `cat $1 | wc -l`

	@ exlines = `egrep -v '(^[ 	]*$|^[ 	]*[{}]*[ 	]*;[ 	]*$|^[ 	]*[{}][ 	]*;*[ 	]*$)' $1 | sed	-e 's+/\*.*\*/++g' -e '\+/\*+,\+\*/+ d' | wc -l`

	@ comlines = $total - $exlines

	echo -n "total=	"$total"	"
	echo -n "C_executable=	"$exlines"	"
	echo "C_comments=	"$comlines"	"

else if($1:e == "f") then

	@ total = `cat $1 | wc -l`

	@ comlines  = `egrep -c '(^[Cc]|^[ 	]*$)' $1`

	@ exlines = $total - $comlines

	echo -n "total_lines=	"$total"	"
	echo -n "F_executable=	"$exlines"	"
	echo "F_comments=	"$comlines"	"
else
	echo not C or FORTRAN
endif

------------------------------

From: Kartick Thangavelu <ktt30@mcode.amdahl.com>

Yes, there are a number of commercially available tools in the market that
compute various software metrics like operator density (also called Halstead
 metrics), complexity (McCabe metrics) and also provide you with the flexibility
 of enforcing compliance to coding styles and guidelines to make C programs 
 readable, portable, and maintainable. The companies dealing with these products
are (to name a few):

1. Abraxas Software, Portland, Oregon, USA. Product-- CodeCheck (Unix/dos).
2. Veritas Software, Santa Clara, California, USA. Product-- VistaTest.

I recommend contacting Veritas Software because the other company has a bad 
 reputation with regards to Customer Support and in fact dealing with customers.
There have been numerous complaints with the way they do business. 

------------------------------

From: tuan%ukfca1@sj.ate.slb.com

	I've done an 'archie' search recently for one of the metrics tools so
	here are the results.

	Also, please can you e-mail copies of all the ones you have found from
	this search too.

Search request for 'halstead'

Host cnam.cnam.fr   (192.33.159.6)
Last updated 05:19  3 Jul 1992

    Location: /pub/Ada/Repository/id-files
      FILE      r--r--r--      1882  Jun 24  1991   halstead.sid.Z
    Location: /pub/Ada/Repository/metrics
      FILE      r--r--r--      2187  Jul 21  1987   halstead.cmm.Z
      FILE      r--r--r--       466  Jun 16  1986   halstead.co.Z
      FILE      r--r--r--     14320  Jun 16  1986   halstead.doc.Z
      FILE      r--r--r--      2250  Jun 16  1986   halstead.me.Z
      FILE      r--r--r--       748  Jun 20  1986   halstead.pl.Z
      FILE      r--r--r--      1366  Nov 16  1987   halstead.pro.Z
      FILE      r--r--r--    225795  Feb 13  1991   halstead.src.Z
      FILE      r--r--r--      9558  Jun 16  1986   halstead.tst.Z

Host cs.tut.fi   (130.230.4.2)
Last updated 04:25  4 Jul 1992

    Location: /pub/src/software-eng/metrics/doc
      FILE      rw-r--r--       618  Sep 20  1989   halstead.doc
    Location: /pub/src/software-eng/metrics/src/halstead
      FILE      rw-r--r--      2404  Sep 20  1989   halstead.sh
    Location: /pub/src/software-eng/metrics/src
      DIRECTORY rwxr-xr-x       512  Sep 20  1989   halstead
    Location: /pub/src/software-eng/metrics/src/bin
      FILE      rwxr-xr-x      2404  Sep 20  1989   halstead

Host rigel.acs.oakland.edu   (141.210.10.117)
Last updated 16:46  5 May 1992

    Location: /pub/ada/metrics
      FILE      rw-r--r--     33881  Jun 16  1986   halstead.doc
      FILE      rw-r--r--     29855  Jun 16  1986   halstead.tst
      FILE      rw-r--r--       899  Jun 16  1986   halstead.co
    Location: /pub/ada/id-files
      FILE      rw-r--r--      3566  Jun 24  1991   halstead.sid
    Location: /pub/ada/metrics
      FILE      rw-r--r--      2124  Jun 20  1986   halstead.pl
      FILE      rw-r--r--      3414  Jul 21  1987   halstead.cmm
      FILE      rw-r--r--      2414  Nov 16  1987   halstead.pro
      FILE      rw-r--r--      3848  Jun 16  1986   halstead.me
      FILE      rw-r--r--    973135  Feb 13  1991   halstead.src

Host wuarchive.wustl.edu   (128.252.135.4)
Last updated 04:16 10 May 1992

    Location: /mirrors2/ada/metrics
      FILE      rw-rw-r--       899  Jun 16  1986   halstead.co
      FILE      rw-rw-r--      3414  Jul 21  1987   halstead.cmm
      FILE      rw-rw-r--     32759  Jun 16  1986   halstead.doc
      FILE      rw-rw-r--      2414  Nov 16  1987   halstead.pro
      FILE      rw-rw-r--      3848  Jun 16  1986   halstead.me
      FILE      rw-rw-r--    973135  Feb 13  1991   halstead.src
      FILE      rw-rw-r--      2124  Jun 20  1986   halstead.pl
      FILE      rw-rw-r--     29855  Jun 16  1986   halstead.tst
    Location: /mirrors2/ada/id-files
      FILE      rw-rw-r--      3566  Jun 24  1991   halstead.sid
Search request for 'mccabe'


Host cnam.cnam.fr   (192.33.159.6)
Last updated 05:19  3 Jul 1992

    Location: /pub/Ada/Repository/id-files
      FILE      r--r--r--      1897  Jun 24  1991   mccabe.sid.Z
    Location: /pub/Ada/Repository/metrics
      FILE      r--r--r--       688  Jun 16  1986   mccabe.cnt.Z
      FILE      r--r--r--      6630  Jun 16  1986   mccabe.doc.Z
      FILE      r--r--r--       643  Jun 16  1986   mccabe.dss.Z
      FILE      r--r--r--      1074  Jun 16  1986   mccabe.dst.Z
      FILE      r--r--r--     12918  Jun 16  1986   mccabe.grm.Z
      FILE      r--r--r--      2488  Jun 16  1986   mccabe.me.Z
      FILE      r--r--r--      1365  Nov 16  1987   mccabe.pro.Z
      FILE      r--r--r--      4283  Jun 16  1986   mccabe.rno.Z
      FILE      r--r--r--    127226  Jun 12  1986   mccabe.src.Z
      FILE      r--r--r--     13852  Jun 16  1986   mccabe.tst.Z

Host cs.tut.fi   (130.230.4.2)
Last updated 04:25  4 Jul 1992

    Location: /pub/src/software-eng/metrics/doc
      FILE      rw-r--r--       590  Sep 20  1989   mccabe.doc
    Location: /pub/src/software-eng/metrics/src/mccabe
      FILE      rw-r--r--      3593  Sep 20  1989   mccabe.sh
    Location: /pub/src/software-eng/metrics/src/bin
      FILE      rwxr-xr-x      3593  Sep 20  1989   mccabe
    Location: /pub/src/software-eng/metrics/src
      DIRECTORY rwxr-xr-x       512  Sep 20  1989   mccabe

Host rigel.acs.oakland.edu   (141.210.10.117)
Last updated 16:46  5 May 1992

    Location: /pub/ada/metrics
      FILE      rw-r--r--     14906  Jun 16  1986   mccabe.doc
    Location: /pub/ada/id-files
      FILE      rw-r--r--      3637  Jun 24  1991   mccabe.sid
    Location: /pub/ada/metrics
      FILE      rw-r--r--     36616  Jun 16  1986   mccabe.grm
      FILE      rw-r--r--      4647  Jun 16  1986   mccabe.dst
      FILE      rw-r--r--      8163  Jun 16  1986   mccabe.rno
      FILE      rw-r--r--      2160  Jun 16  1986   mccabe.cnt
      FILE      rw-r--r--      4857  Jun 16  1986   mccabe.me
      FILE      rw-r--r--      1837  Jun 16  1986   mccabe.dss
      FILE      rw-r--r--      2417  Nov 16  1987   mccabe.pro
      FILE      rw-r--r--    421342  Jun 12  1986   mccabe.src
      FILE      rw-r--r--     54571  Jun 16  1986   mccabe.tst

Host wuarchive.wustl.edu   (128.252.135.4)
Last updated 04:16 10 May 1992

    Location: /mirrors2/ada/metrics
      FILE      rw-rw-r--      4647  Jun 16  1986   mccabe.dst
      FILE      rw-rw-r--      1837  Jun 16  1986   mccabe.dss
      FILE      rw-rw-r--     14218  Jun 16  1986   mccabe.doc
      FILE      rw-rw-r--      2417  Nov 16  1987   mccabe.pro
      FILE      rw-rw-r--      2160  Jun 16  1986   mccabe.cnt
      FILE      rw-rw-r--      8163  Jun 16  1986   mccabe.rno
      FILE      rw-rw-r--     36616  Jun 16  1986   mccabe.grm
      FILE      rw-rw-r--    421342  Jun 12  1986   mccabe.src
      FILE      rw-rw-r--      4857  Jun 16  1986   mccabe.me
      FILE      rw-rw-r--     54571  Jun 16  1986   mccabe.tst
    Location: /mirrors2/ada/id-files
      FILE      rw-rw-r--      3637  Jun 24  1991   mccabe.sid

------------------------------

-- 
Lutz Prechelt   (email: prechelt@ira.uka.de)            | Whenever you 
Institut fuer Programmstrukturen und Datenorganisation  | complicate things,
Universitaet Karlsruhe;  D-7500 Karlsruhe 1;  Germany   | they get
(Voice: ++49/721/608-4317, FAX: ++49/721/694092)        | less simple.
Newsgroups: comp.lang.c