Libre Software People's Front

don't confuse it with People's Front of Open Source

What .. is your favourite SLOC counter?

leave a comment »

Is this a good question? I would say it is something that could be asked by the bridgekeeper in the film Monty Python and the Holy Grail. In our research group we started using sloccount a long time ago and it is currently integrated with some of our data mining tools like cvsanaly but after testing ohcount a couple of times during the last summer I started to though we should either improve it or replace it. Yesterday I read a post by Nicolas Betternburg on a study of PostgreSQL 9 and he mentioned he used cloc to count the SLOC (source lines of code) so I decided to test a couple of tools during this cold morning in Madrid.

The test I performed use the latest code of fusionforge and nautilus with the aim of getting the total SLOC and the SLOC for the primary language. I started with the tools cloc 1.09, sloccount 2.26 and ohcount (latest from git), but I obtained weird results from ohcount (very different from the version used in ohloh) and I discarded it. This is what I got:

SLOC in Fusionforge:

  • 452508 in 27 different languages according to cloc
  • 285193 in 10 different languages (javascript is not among them!) according to sloccount

Primary language in Fusionforge (PHP SLOC):

  • 244435 according to cloc
  • 243355 according to sloccount

SLOC in Nautilus:

  • 182967 in 10 different languages according to cloc
  • 146595 in 5 different languages according to sloccount

Primary language in Nautilus (C SLOC):

  • 134675 according to cloc
  • 134680 according to sloccount

There are other SLOC counters but they are not available in the Debian repos .. those are: sclc, USC’s CODECOUNT and loc

At this point I think we should test deeply cloc but I still don’t understand some numbers in the fusionforge report where it says there are 1600 PHP files and using the “file” command I only found 1355.

So .. the good think of sloccount is the time and effort estimation (but it is based on the SLOC), the great feature of ohcount is to identify the FLOSS licenses of the code and as far as I’ve seen the best SLOC counter is cloc. Do you agree?

[This post is also available in my blog at]


Written by sanacl

October 20, 2010 at 1:08 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: