Wednesday, October 20, 2010

Running SLOCount on RTEMS

SLOC is everyone's favorite metric to hate but it is fun to discuss anyway. I recently ran David Wheeler's SLOCCount [1] on RTEMS and thought I would pass along some of the results. There is an RPM available for Fedora so I started with that. But I found a bug in which it counted our assembly include files as Pascal. Needless to say there is no Pascal in RTEMS so I fixed that. If anyone wants the patch, I am happy to provide it.

The first part of the report from this program is a breakdown of the source code by language. This showed the following breakdown based upon programming language:

ansic: 644676 (87.49%)
asm: 39569 (5.37%)
ada: 27563 (3.74%)
sh: 18204 (2.47%)
cpp: 5236 (0.71%)
perl: 1623 (0.22%)

No real surprise there. RTEMS is mostly in C and high level languages with assembly language primarily for context switch and interrupt dispatching. With over a dozen active ports on the CVS head, it is no shock there is 39.5K of well commented assembly language.
The Shell and Perl is primarily for configuration and build infrastructure.

The second part of the output from sloccount is related to the estimated cost of producing the software and how many man years it would take. Using a rough estimate of 100K USD salary for each software developer implementing RTEMS, sloccount estimates RTEMS would require about 205 person-years to recreate at an estimated cost of 49.2M USD.

Total Physical Source Lines of Code (SLOC) = 736,871
Development Effort Estimate, Person-Years (Person-Months) = 205.02 (2,460.21)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 4.05 (48.59)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 50.64
Total Estimated Cost to Develop = $ 49,204,211
(average salary = $100,000/year, overhead = 2.40).

That makes RTEMS a great bargain! You are getting very high quality software that would cost a sizeable fortune to reinvent. IUnfortunately, the RTEMS team doesn't have $49,000,000 so please consider using the services of the core developers. That's how we pay the bills and keep the kids from going hungry.

Enjoy the gift of RTEMS!


[1] Per David's request, this data was "generated using David A. Wheeler's 'SLOCCount'."