如何让你的FreeBSD系统达到最优化[CPU]
一个最重要的答案就是:运行针对你cpu型号编译的程序!
我们知道,FreeBSD中大部分软件都在ports下编译。如何设定编译时的参数呢?就是/etc/make.conf这个配置文件!
打开/etc/make.conf这个文件,找到这两行:
--------------------------------------------------------------------------------
#CFLAGS= -O -pipe
#CXXFLAGS+= -fmemoize-lookups -fsave-memoized
--------------------------------------------------------------------------------
怎么改?就改CFLAGS与CXXFLAGS参数!首先把前面的“#”号去掉,然后再参照下面的表:
--------------------------------------------------------------------------------
CFLAGS= -march=i386 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=i386 -O3 -pipe -fomit-frame-pointer
i486 (Intel)
CFLAGS= -march=i486 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=i486 -O3 -pipe -fomit-frame-pointer
Pentium 1 (Intel)
CFLAGS= -march=pentium -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=pentium -O3 -pipe -fomit-frame-pointer
Pentium MMX (Intel)
CFLAGS= -march=pentium-mmx -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=pentium-mmx -O3 -pipe -fomit-frame-pointer
Pentium PRO (Intel)
CFLAGS= -march=pentiumpro -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=pentiumpro -O3 -pipe -fomit-frame-pointer
Pentium II (Intel)
CFLAGS= -march=pentium2 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=pentium2 -O3 -pipe -fomit-frame-pointer
Celeron (Mendocino), aka Celeron1 (Intel)
CFLAGS= -march=pentium2 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=pentium2 -O3 -pipe -fomit-frame-pointer
Pentium III (Intel)
CFLAGS= -march=pentium3 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=pentium3 -O3 -pipe -fomit-frame-pointer
Celeron (Coppermine) aka Celeron2 (Intel)
CFLAGS= -march=pentium3 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=pentium3 -O3 -pipe -fomit-frame-pointer
Celeron (Willamette?) (Intel)
CFLAGS= -march=pentium4 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=pentium4 -O3 -pipe -fomit-frame-pointer
Pentium 4 (Intel)
CFLAGS= -march=pentium4 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=pentium4 -O3 -pipe -fomit-frame-pointer
Eden C3/Ezra (Via)
CFLAGS= -march=i586 -m3dnow -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=i586 -m3dnow -O3 -pipe -fomit-frame-pointer
K6 (AMD)
CFLAGS= -march=k6 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=k6 -O3 -pipe -fomit-frame-pointer
K6-2 (AMD)
CFLAGS= -march=k6-2 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=k6-2 -O3 -pipe -fomit-frame-pointer
K6-3 (AMD)
CFLAGS= -march=k6-3 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=k6-3 -O3 -pipe -fomit-frame-pointer
Athlon (AMD)
CFLAGS= -march=athlon -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=athlon -O3 -pipe -fomit-frame-pointer
Athlon-tbird, aka K7 (AMD)
CFLAGS= -march=athlon-tbird -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=athlon-tbird -O3 -pipe -fomit-frame-pointer
Athlon-tbird XP (AMD)
CFLAGS= -march=athlon-xp -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=athlon-xp -O3 -pipe -fomit-frame-pointer
Athlon 4(AMD)
CFLAGS= -march=athlon-4 -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=athlon-4 -O3 -pipe -fomit-frame-pointer
Athlon XP (AMD)
CFLAGS= -march=athlon-xp -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=athlon-xp -O3 -pipe -fomit-frame-pointer
Athlon MP (AMD)
CFLAGS= -march=athlon-mp -O3 -pipe -fomit-frame-pointer
CXXFLAGS+= -march=athlon-mp -O3 -pipe -fomit-frame-pointer
--------------------------------------------------------------------------------
根据你cpu的型号选择。好了,就这样。
Good luck!