[Mockpp-commits] mockpp/mockpp/docs/en dev_embedded.docbook,1.2,1.3
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-12-03 15:56:41
|
Update of /cvsroot/mockpp/mockpp/mockpp/docs/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1247/mockpp/docs/en Modified Files: dev_embedded.docbook Log Message: extend Index: dev_embedded.docbook =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/docs/en/dev_embedded.docbook,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- dev_embedded.docbook 2 Dec 2005 17:28:36 -0000 1.2 +++ dev_embedded.docbook 3 Dec 2005 15:56:33 -0000 1.3 @@ -1,45 +1,88 @@ <sect1 id="embedded-systems"> -<title>Embedded Systems</title> - +<title>Working With Embedded Systems</title> -<para>text +<para>There are hidden costs concerning memory resources when programming in +C++. On a desktop system with plenty of virtual memory you don't neccessarily +recognize it. But working with embedded systems is different as there is only a +limited amout of physical ram available.</para> -<programlisting> +<para>For that reasons it is important to know the places where he compiler adds +additional code: -Full featured: 322400 +<variablelist> -built-in stl: 230628 + <varlistentry> + <term>Standard Template Library (STL)</term> + <listitem>Templates and other inline code may increase the resulting footprint + of the binary.</listitem> + </varlistentry> -built-in stl, no rtti: 218204 + <varlistentry> + <term>Exceptions</term> + <listitem>After throwing an exception the complier must cleanup and + destroy all automatic objects in the previous scopes. This bookkeeping + consumes space as well.</listitem> + </varlistentry> -built-in stl, no exceptions: 193588 + <varlistentry> + <term>Runtime Type Information (RTTI)</term> + <listitem>To provide information about an object at runtime the + compiler includes data like the class name or the inheritance tree + in the binary. </listitem> + </varlistentry> -built-in stl, no rtti, no exceptions: 180588 +</variablelist> ------------- +</para> -Cost per feature +<para>The following table shows the the size of the &mockpp; library when +compiled with different settings. The size ranged from around 320KiB with the +default settings down to 180KiB with as many features disabled as possible. -stl: 91772 == 28% +<table><title>Proportion of Important Features</title> +<tgroup cols='3' align='left' colsep='1' rowsep='1'> +<thead> + <row> + <entry>Feature</entry><entry>Number of Bytes</entry><entry>Percentage</entry> + </row> +</thead> -rtti: 12424 == 4% +<tbody> + <row> + <entry>regular STL</entry><entry>92KiB</entry><entry>28%</entry> + </row> -exceptions: 37040 == 11% + <row> + <entry>RTTI</entry><entry>12KiB</entry><entry>4%</entry> + </row> -production code: 188588 = 58% + <row> + <entry>Exceptions</entry><entry>37KiB</entry><entry>11%</entry> + </row> -</programlisting> + <row> + <entry>Library Code</entry><entry>180KiB</entry><entry>57%</entry> + </row> +</tbody> +</tgroup> +</table> </para> -<para>There are a few things that are not obvious but might become interesting: +<para> -<itemizedlist> +<programlisting> + +void forwardMalfunctionData(const T &e) + +#define MOCKPP_THROW(x) throw (x) +#define MOCKPP_RETHROW throw +#define MOCKPP_TRY try +#define MOCKPP_CATCH(x) (x) +#define MOCKPP_CATCH_ALL catch(...) + +</programlisting> - <listitem>In the same manner <literal>MOCKPP_STRING</literal> yields either a - <token>std::string</token> or a <token>std::wstring</token>. - </listitem> -</itemizedlist> </para> |