Sun, 11 Jun 2006

sloccount and libsndfile

Michael Slade has been playing around with David A. Wheeler's sloccount program and since its available as an Ubuntu package, I decided to have a play with it myself.

First stop was libsndfile. Just a naive run in a fresh source tree pulled out of GNU Arch gives:

  SLOC    Directory       SLOC-by-Language (Sorted)
  24344   src             ansic=24196,python=148
  5259    tests           ansic=5259
  2641    GSM610          ansic=2641
  1806    examples        ansic=1592,cs=122,cpp=92
  855     G72x            ansic=855
  496     regtest         ansic=496

  Totals grouped by language (dominant language first):
  ansic:        35039 (98.98%)
  python:         148 (0.42%)
  cs:             122 (0.34%)
  cpp:             92 (0.26%)

  Total Physical Source Lines of Code (SLOC)                = 35,401
  Development Effort Estimate, Person-Years (Person-Months) = 8.46 (101.55)
   (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
  Schedule Estimate, Years (Months)                         = 1.21 (14.47)
   (Basic COCOMO model, Months = 2.5 * (person-months**0.38))
  Estimated Average Number of Developers (Effort/Schedule)  = 7.02
  Total Estimated Cost to Develop                           = $ 1,143,162
   (average salary = $56,286/year, overhead = 2.40).

What the ....?

Now I didn't write everything in libsndfile. The vast majority of the code in the G72x directory is by SUN Microsystems and the code in GSM610 by Jutta Degener and Carsten Bormann. In addition, the code in the tests and regtest directories is purely test suite code, so looking at just C source code in the src and examples directories of which I wrote at least 90%, I get:

  SLOC    Directory       SLOC-by-Language (Sorted)
  24664   top_dir         ansic=24664

  Totals grouped by language (dominant language first):
  ansic:        24664 (100.00%)

  Total Physical Source Lines of Code (SLOC)                = 24,664
  Development Effort Estimate, Person-Years (Person-Months) = 5.79 (69.48)
   (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
  Schedule Estimate, Years (Months)                         = 1.04 (12.53)
   (Basic COCOMO model, Months = 2.5 * (person-months**0.38))
  Estimated Average Number of Developers (Effort/Schedule)  = 5.55
  Total Estimated Cost to Develop                           = $ 782,183
   (average salary = $56,286/year, overhead = 2.40).

This still leaves me a little dubious. Although I released the first version of libsndfile in 1999 I really can't believe that I spent more than 5 person years on this. But then, I also think that my time is worth quite a bit more than $56k per year :-).

Posted at: 10:52 | Category: CodeHacking | Permalink