|
相信大家现在换机器,基本上都是上的双核,不吃肉也X2了吧。
但是到底怎么样才能把双核的威力发挥出来呢?
GOOGLE上说的乱七八糟,有的说在编译内核的时候打开SMP就行了,有的说编译的时候在MAKE.CONF里边添加 MAKEOPTS="-j(n)" n=核数+1,还有的说使用alias make="make -j(n)",到底哪个好用啊?
这两天弄LFS,大批量编了一堆东西,呵呵,其实最费时间的就那么3个,来回好几遍。
不说那么多了,别人说的是说的,我试过了才是真的。
测试平台 INTEL P III 1G×2 512M PC 133内存,36G SCSI 10000转硬盘。(嘿嘿老了点哈,这个是我测试双核的,LFS的还有E6300的配置,回头开个比较贴)
cat /proc/cpuinfo
model : 8
model name : Pentium III (Coppermine)
stepping : 6
cpu MHz : 999.612
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips : 2000.35
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Pentium III (Coppermine)
stepping : 6
cpu MHz : 999.612
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips : 1999.19
测试编译器为
gcc --version
debian:/sources/linux-2.6.22# gcc --version
gcc (GCC) 4.2.1 (Debian 4.2.1-3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
测试办法为,用LINUX的内核,使用make allnoconfig进行配置,然后time make,对比测试时间。我选择的内核为http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.tar.gz
哈哈,突发奇想,是不是可以拿这个来比较大家平时用的U,哪个编译更爽啊!来个速度大比拼。
上结果,大家总结
什么参数都不加,直接启动系统后编译。
make allnoconfig
time make
Root device is (8, 1)
Boot sector 512 bytes.
Setup is 4810 bytes.
System is 503 kB
Kernel: arch/i386/boot/bzImage is ready (#1)
real 4m36.437s
user 4m19.452s
sys 0m19.313s
debian:/sources/linux-2.6.22#
添加make.conf
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j3"
Root device is (8, 1)
Boot sector 512 bytes.
Setup is 4810 bytes.
System is 503 kB
Kernel: arch/i386/boot/bzImage is ready (#1)
real 4m35.528s
user 4m18.912s
sys 0m19.437s
debian:/sources/linux-2.6.22#
直接使用
alias make="make -j3"
Root device is (8, 1)
Boot sector 512 bytes.
Setup is 4810 bytes.
System is 503 kB
Kernel: arch/i386/boot/bzImage is ready (#1)
real 2m30.781s
user 4m31.585s
sys 0m21.357s
debian:/sources/linux-2.6.22#
使用alias make="make -j3"后,添加make.conf
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
Root device is (8, 1)
Boot sector 512 bytes.
Setup is 4810 bytes.
System is 503 kB
Kernel: arch/i386/boot/bzImage is ready (#1)
real 2m30.314s
user 4m31.261s
sys 0m21.657s |
|