<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="prepare-aboutsbus">
  <?dbhtml filename="aboutsbus.html"?>

  <title>关于 SBU</title>

  <!--para>Many people would like to know beforehand approximately how long
  it takes to compile and install each package. Because Linux From
  Scratch can be built on many different systems, it is impossible to
  provide accurate time estimates. The biggest package (Glibc) will
  take approximately 20 minutes on the fastest systems, but could take
  up to three days on slower systems! Instead of providing actual times,
  the Standard Build Unit (SBU) measure will be
  used instead.</para-->
  <para>许多人想在编译和安装各个软件包之前，了解这一过程大概需要多少时间。
	  由于 Linux From Scratch 可以在许多不同系统上构建，
	  我们无法直接给出估计时间。例如，最大的软件包 (Glibc)
	  在最快的系统上只要大约 20 分钟就能构建好，
	  而在一些较慢的系统上需要 3 天！因此，我们不提供实际时间，
	  而是以标准构建单位 (SBU) 衡量时间。</para>

  <!--para>The SBU measure works as follows. The first package to be compiled
  from this book is Binutils in <xref linkend="chapter-temporary-tools"/>. The
  time it takes to compile this package is what will be referred to as the
  Standard Build Unit or SBU. All other compile times will be expressed relative
  to this time.</para-->
  <para>标准构建单位的定义如下：本书中构建的第一个软件包是
	  <xref linkend="chapter-temporary-tools"/> 中的 Binutils ，
	  定义编译它需要的时间为标准构建单位，缩写为 SBU 。
	  其他软件包的编译时间用 SBU 为单位表示。</para>

  <!--para>For example, consider a package whose compilation time is 4.5
  SBUs. This means that if a system took 10 minutes to compile and
  install the first pass of Binutils, it will take
  <emphasis>approximately</emphasis> 45 minutes to build this example package.
  Fortunately, most build times are shorter than the one for Binutils.</para>

  <para>In general, SBUs are not entirely accurate because they depend on many
  factors, including the host system's version of GCC.  They are provided here
  to give an estimate of how long it might take to install a package, but the
  numbers can vary by as much as dozens of minutes in some cases.</para-->
  <para>例如，考虑一个编译时间是 4.5 SBU 的软件包。如果在某个系统上，
	  需要 10 分钟来编译和安装第一轮的 Binutils ，
	  那么<emphasis>大概</emphasis>需要 45 分钟才能编译这个软件包。
	  幸运的是，多数软件包构建时间比 Binutils 少。</para>

  <para>一般来说，SBU 不是完全准确的。这是由于它受到许多因素的影响，
	  包括宿主系统的 GCC 版本。
	  SBU 只能用来估计安装一个软件包可能需要的时间，
	  估计结果的误差在个别情况下可能达到几十分钟。</para>

  <note>
    <!--para>For many modern systems with multiple processors (or cores) the
    compilation time for a package can be reduced by performing a "parallel
    make" by either setting an environment variable or telling the
    <command>make</command> program how many processors are available.  For
    instance, a Core2Duo can support two simultaneous processes with:</para-->
    <para>对于许多拥有多个处理器（或处理器核心）的现代系统，
		可以进行并行构建，从而显著缩短软件包的编译时间。
		设置环境变量，或者直接告诉 <command>make</command>
		命令有多少个可用的处理器，都可以进行并行编译。例如，
		在一个 Core2Duo 系统中，可以设置下列环境变量，
		以支持用两个并行的进程进行编译：</para>

    <screen><userinput>export MAKEFLAGS='-j 2'</userinput></screen>

    <!--para>or just building with:</para-->
	<para>或者直接用以下命令构建：</para>

    <screen><userinput>make -j2</userinput></screen>

    <!--para>When multiple processors are used in this way, the SBU units in the
    book will vary even more than they normally would.  In some cases, the make
    step will simply fail.  Analyzing the output of the build process will also
    be more difficult because the lines of different processes will be
    interleaved.  If you run into a problem with a build step, revert back to a
    single processor build to properly analyze the error messages.</para-->
    <para>用这种方式使用多个处理器时，SBU 值将会发生变化，
		有时甚至变得比正常值还大。某些情况下，还会导致
		<command>make</command> 命令失败。
		另外，分析构建过程的的输出也会变得困难，
		因为不同进程的输出行会交错在一起。如果在构建过程中出现问题，
		需要使用单处理器进行构建，才能更好地分析错误消息。</para>
  </note>

</sect1>

