Advanced RTOS, embedded real-time OS, compact OS, IDE, Software development toolkits, embedded c compilers, Multicore debugger, hardware probes, static source code analysis tool, secure hypervisor, virtual prototyping platform
 CodeBalance® Code Optimizer (con't)

 Intuitive Interface
 
CodeBalance uses a Graphical User Interface (Fig. 1) to allow the user to specify various options for the optimization process. With a few points and clicks, CodeBalance produces a table of information to guide the user to the next phase of the speed/size trade-offs. CodeBalance produces a table like that shown in Fig. 2. A list of routines common to both programs is shown under the heading, Function. Since the purpose of CodeBalance is to determine speed/size trade-offs routines not common to both programs, or routines which have the same exact code size for both programs are not displayed nor counted in Fig. 2.







 Function:  Fastprog:   msec:   cum%:   smallprog:   code savings:
gen_pairs 196 4.788 45 150 45%
calc_sum 272 1.792 62 186 42%
ion_propagate 376 1.752 79 140 37%
eval_parabolic 232 0.717 86 94 22%
main 244 0.130 87 54 13%
polarize 8 0.080 88 4 0%
Program Total 1544 10.533   844 45%
 
Fig. 2

The "fastprog" column shows code size in bytes for each routine built for 32-bits. The next two columns, msec and cum%, display the profile timing information for "fastprog." Column msec shows the time spent in each routine listed; the cum% column shows the cumulative percentage of runtime, starting from the most time-critical or bottleneck routines. Column "smallprog" then shows the code size in bytes of "smallprog."

The last column ("Code-Savings") shows the cumulative code size savings resulting from compiling the least time-critical routines in 16-bits mode. For example, if the functions main() and polarize() are compiled for 16-bits and the remaining functions are left as 32-bits, the code size savings is 13%. By adding the function eval_parabolic() to the list of 16-bit compiled functions, the savings increases to 22%.

The user can select a code compression goal as a percentage of overall code size. For example, by selecting a code compression goal of 35%, CodeBalance will recompile routines in 16-bit mode until a 35% reduction in code size is achieved. Then, CodeBalance will re-profile the application to determine the impact on performance and report this data to the user.

Another type of tuning option enables the user to specify the percentage of execution time ("X") to be allocated to 32-bit routines. Here, CodeBalance chooses the most time-critical routines such that X% of the total execution time is compiled for 32-bits. This method ensures that bottleneck routines are kept as fast as possible. Leftover routines are compiled for 16-bits to save space. For example, to ensure that at least the top 75% of the bottleneck code is compiled for maximum speed, CodeBalance would compile gen_pairs, calc_sum, and ion_propagate in 32-bit mode for maximum speed, and the rest in 16-bit mode for minimum code size.

CodeBalance can generate an execution profile for the composite application "composite" so that the size/speed trade-off between the original all 32-bits application and the new improved program can be seen (Fig. 3). Here, CodeBalance is shown to have produced a very large code compression of 37% with only a 4% loss in performance. (The code sizes 1544 and 976 in Fig. 3 are not the total code sizes for the two executables. Rather, they are the total sizes for the functions that are common between "fastprog" and "composite". Also, this example is able to use 16-bit mode extensively. So the 32-bit function prologues and epilogues that are normally present are not linked in. This adds up to a big code size reduction of 37%.)

 Function:    Fastprog:    msec:    cum%:   composite:   msec:   code savings:  
ion_propagate 376 1.752 17 140 2.269 37%
eval_parabolic 232 0.717 23 94 0.916 22%
main 244 0.130 25 4 0.200 13%
polarize 8 0.080 25 4 0.080 0%
Program Total 1544 10.533   976 10.954 37%
 
Fig. 3

Supported Processors
The Green Hills C/C++/EC++ compilers takes full advantage of the 16-bit Thumb and MIPS16 architecture extensions, which enable designers to achieve significant reductions in code size without compromising performance. CodeBalance is a utility that automates this process, and makes it practical for users to achieve these benefits.

» Back to CodeBalance Home Page


» RTOS
» MULTI IDE
» AdaMULTI IDE
» Compilers
» Communications Software
» Custom Development