26.12.2013 Views

lwIP - A Minimal TCP/IP implementation - Wikia

lwIP - A Minimal TCP/IP implementation - Wikia

lwIP - A Minimal TCP/IP implementation - Wikia

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

13 STATISTICAL CODE ANALYSIS 13.1 Lines of code<br />

• The Intel Pentium III processor, henceforth referred to as the Intel x86 processor. The code<br />

was compiled with gcc 2.95.2 under FreeBSD 4.1 with compiler optimizations turned on.<br />

• The 6502 processor [Nab, Zak83]. The code was compiled with cc65 2.5.5 [vB] with compiler<br />

optimizations turned on.<br />

The Intel x86 has seven 32-bit registers and uses 32-bit pointers. The 6502, which main use<br />

today is in embedded systems, has one 8-bit accumulator as well as two 8-bit index registers and<br />

uses 16-bit pointers.<br />

13.1 Lines of code<br />

Table 1. Lines of code.<br />

Module Lines of code Relative size<br />

<strong>TCP</strong> 1076 42%<br />

Support functions 554 21%<br />

API 523 20%<br />

<strong>IP</strong> 189 7%<br />

UDP 149 6%<br />

ICMP 87 3%<br />

Total 2578 100%<br />

UDP<br />

ICMP<br />

<strong>IP</strong><br />

<strong>TCP</strong><br />

API<br />

Support functions<br />

Figure 13. Lines of code.<br />

Table 1 summarizes the number lines of source code of <strong>lw<strong>IP</strong></strong> and Figure 13 shows the relative<br />

number of lines of code. The category “Support functions” include buffer and memory management<br />

functions as well as the functions for computing the Internet checksum. The checksumming<br />

functions are generic C <strong>implementation</strong>s of the algorithm that should be replaced with processor<br />

specific <strong>implementation</strong>s when actually deployed. The category “API” includes both the part of<br />

the API that is linked with the applications and the part that is linked with the <strong>TCP</strong>/<strong>IP</strong> stack.<br />

The operating system emulation layer is not included in this analysis since its size varies heavily<br />

with the underlying operating system and is therefore not interesting to compare.<br />

For the purpose of this comparison all comments and blank lines have been removed from the<br />

source files. Also, no header files were included in the comparison. We see that <strong>TCP</strong> is vastly<br />

larger than the other protocol <strong>implementation</strong>s and that the API and the support functions taken<br />

together are as large as <strong>TCP</strong>.<br />

18

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!