6 ms·
Is there really 17 million lines of code for the linux kernel? (from the chart at bottom)
by welder 13y ago
Is there really 17 million lines of code for the linux kernel?
(from the chart at bottom)
- vidarh 13y agoSounds about right. Keep in mind the vast majority is drivers for ludicrous amounts of hardware.
- JNRowe 13y agoA naïve "wc -l /.[ch]" gives ~16.5 million for my lightly patched 3.13 tree. sloccount[1] which aims to count actual LoC says ~12 million(97% C) for the same tree. Neither are a truly accurate measure, so help yourself to a pinch of salt to go with the numbers. 1. http://www.dwheeler.com/sloccount/ http://www.dwheeler.com/sloccount/
- fragmede 13y agoApproximately, yes. (looking at 3.10 because that's what the graph was looking at for 17 million lines) ((v3.10))~/linux-2.6$ wc -l `find . -type f | grep -v [.]git ` | tail -1 16956298 total Only 15.8M of that is C header/source + assembly, Documentation is some ~450k. There's about 260k lines spent for the build system and other scripts. There's another 135k spent in other tools. Leaving ~300k in README, TODOs and other misc files. I'd say closer to 16 million for v3.10, including build scripts and other tooling. For comparison, v3.13, ~ 6 months later, has 17.9M lines of C and assembly.
- cliveowen 13y agoI wonder how many of those are compiled if the target is an x86 processor.
- fragmede 13y ago380280 total lines of assembly, but only 38925 lines of that are in arch/x86/ (again, v3.10), so barely a 10th of it.
- mjn 13y agoThere's also a bunch of stuff in drivers/ that would be excluded in a typical x86 build, though it (mostly) isn't explicitly architecture-dependent. Over half of the whole kernel LOC are in the drivers directory, which includes support for all sorts of unusual devices.
- fragmede 13y agoOh good point. I was curious so I did make allmodconfig (I'm on 64-bit x86) and 'made bzImage modules' and counted lines of c/asm source with a corresponding .o file, all the header files and Makefile/Kconfig lines and got: headers: 3011226 c/asm source: 8264404 generated .mod.c: 8414151 makefile/kconfig: 2032728 total 21722509 (Again, this is v3.10) (I also included the generated .mod.c files) https://gist.github.com/fragmede/8782876 https://gist.github.com/fragmede/8782876
- mjn 13y agoOn 3.13.1, here's a breakdown of the top sources of code (using the same naive wc -l count), listing only dirs with >500k lines: arch/ 3.2M arm/ 0.7M drivers/ 9.9M gpu/ 0.6M media/ 0.9M net/ 2.1M scsi/ 0.9M staging/ 1.1M include/ 0.6M net/ 0.8M fs/ 1.1M sound/ 0.8M