Hardware Reference
In-Depth Information
Why OpenELEC?
I want to show you some of the features that make OpenELEC perfect for our media center.
First, it fully supports the hard float, and all parts of the operating system and application stack are compiled with
hard-float support where possible. I talked about the benefits of a hard float in Chapter 1 so I won't go over it again.
The optimization does not stop with just a hard float. The OpenELEC team has included three other optimizations
that will greatly help the Raspberry Pi keep up with the challenge of playing back your most demanding media titles.
The first two optimizations are related to the GNU Compiler Collection (GCC). They are the -Ofast optimization
level and the link-time optimization (LTO). The third is related to the GCC linker.
I want to make it crystal clear that any optimization may have adverse effects or may stop you from debugging an
application or system crash. You won't get anything for free; there will always be a trade-off. With this in mind I want
to talk about the first optimization and that is -Ofast .
Using the -Ofast Optimization
To understand what -Ofast is and its benefits or pitfalls you need to take a step back and look at the three main
optimization levels. The main three levels are -O3 , -O2, and -O1 . These optimization levels are accumulative and they
start off at -O1 . In other words, level 3 optimization will enable all of level 2 and all of level 1.
At the third level of optimization a lot of applications and even the kernel itself cannot be fully
debugged anymore. In addition to this it will enable a lot of compile-time options that may
lead to some programs being unstable. This is the price you pay for running at such a high
level of optimization. What, did you expect this magic -O3 to be a free lunch? This is where -O2
comes in. -O2 is also known as safe by most applications. At this level the GCC won't make
any optimizations that may have a possibly large negative impact. You can still debug some
applications at this level. This level is what most of the applications you use every day are
compiled with, assuming that you use Linux.
-O1 . At this level the GCC will only perform optimizations
that don't end up taking a large amount of additional compile time. This level is very safe for
applications.
So where will -Ofast fit into this? Way after -O3 ! In fact -Ofast can and will disregard compliance to any form of
standards if it provides a performance benefit. It will enable all level -O3 optimizations. On top of that it will enable
optimizations that have been known to break certain applications. It's designed to get the most out of your code on
that given architecture. You can also forget about debugging anything at this level. If you start getting unexpected
results or failed GCC builds, this optimization level may be a good place to start looking. Wow, that sounds bad so why
would you want to do this? It's only bad if you've not tested everything you write at that level of optimization. If you
recall, the original XBMC was made to run on a very resource-limited machine to start with: the original Xbox. You do
remember the original Xbox was a 733-MHz Intel Celeron, don't you?
This gives XBMC a good ability to handle such high optimization levels. If you would like to see what
compile-time options the GCC will apply when the application is built at a set optimization level I recommend
you take a read of the GCC manual; in particular, you should check out this page on optimizations:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html . It will outline what gets done at each level and the
possible benefits or pitfalls.
Next up, you have the LTO.
The last of the main three levels is
Using the LTO
No matter how much I read it, I can't help but think of LTO as “Linear Tape-Open:” lucky for you it has nothing to do
with tapes. It has a lot to do with how the above optimizations are applied. For the moment I want you to think about
an LTO tape (if you're not sure what an LTO tape is, think of an old cassette tape and if you're not sure what this is,
 
Search WWH ::




Custom Search