[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

[Re:] Re: Source code Statistics...



hi,
	thanks for all your replies... i particularly found that the 
link given by Akshat Aranya : http://www-scf.usc.edu/~csci665/CodeCounters/
could give me most of all i wanted. and, i've used cscope, and 
know it is a powerful tool for naviagating the source code - 
probably to find where a particular variable is residing, whis 
functions reference a particular variable, etc. it cannot give 
me the number of global variables, which, i admit, is not a 
very useful statistic information for me :-)
	and, regarding implementing one such tool, i did not want to 
re-invent the wheel - i knew somewhere, someone would have already 
taken some efforts to do this! and perl could have been the 
best bet for implementing such a tool!

thanks again,
arvind.

On Tue, 12 Dec 2000 18:07:04 +1100
Raja Subramanian wrote:

>Well, this does not seem very difficult to implement. Most of these
>requirements can be individually handled by standard unix utilities 
scripts or
>small programs (divide & conquer). Here is my toss at the problem  -
>
>Arvind Devarajan wrote (arvindd@xxxxxxxxxxxx):
>> does anyone here know about a tool in linux which gives me 
statistics 
>> about a development project:
>> 
>> 1. No. of lines in a file (sorry, no cat file.c | wc -l and 
>> the like please)
>I think that you mean is the num of non-blank lines here (I 
don't know what
>else you could mean by the above statement, it's self-contradictory!) 
try -
>    awk 'NF>0 {count++} END {print count}' foo.c bar.c
>
>> 3. No. of c files in the project
>> 4. No. of header files in the project
>Surely find(1L) with some decent query flags can fix this need. 
How about -
>    find . -name \*.c | wc -l
>or the likes.
>Of course you could also poke around the Makefile (or whatever 
you use to
>build your source).
>
>> 2. No. of un-commented lines in the file
>Have a look at "Lex and Yacc" 2nd Ed by John R Levine et al, 
Oriley. There is
>a 20 line lex example in the book (end of chapter 1) which 
counts the number
>of lines of code (however you define it). You can probably 
find the example
>code somehwere on oriley's website.
>
>A side note, counting the number of lines-of-code (LOC) is 
messy. There are
>many ways to do it and you really have to know what you want.
>
>> 5. No. of global variables in the project
>You could use lex again and do it along with the previous item. 
But if you
>have object files around, the easiest thing is just to use 
nm(1) and peek at
>the symbols listed in the object files. "The Awk Programming 
Language" -
>Kernighan Aho Weinberger, has a neat 3 line awk script that 
extracts such info
>from nm output (and some pretty good reasons for doing so).
>
>> 6. And host of other useful information...
>Wishfull thinking! :)
>
>- Raja
>
>PS: If you want more info or want me to dig up those examples I keep
>mentioning, email me off-line.
>
>---------------------------------------------
>An alpha version of a web based tool to manage
>your subscription with this mailing list is at
>http://lists.linux-india.org/cgi-bin/mj_wwwusr
>
>



--------------------------------------------------------------------------
Global Internet phone calls, voicemail, fax, e-mail and instant messaging.
Sign-up today for FREE account at http://www.hotvoice.com