如何讓你的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!