mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 11:27:17 +08:00
feat: 优化编译线程数计算算法
This commit is contained in:
@@ -21,7 +21,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
# 计算 j 值(通用)
|
||||
calculate_j() {
|
||||
export LC_ALL=C
|
||||
total=$(free -m | awk '/^Mem:/{print $2}')
|
||||
mem=$(free -m | awk '/^Mem:/{print $2}')
|
||||
swap=$(free -m | awk '/^Swap:/{print $2}')
|
||||
total=$((mem + swap))
|
||||
j_value=$((total / 1024))
|
||||
cpu_cores=$(nproc)
|
||||
|
||||
@@ -39,7 +41,9 @@ calculate_j() {
|
||||
# 计算 j 值(2倍内存)
|
||||
calculate_j2() {
|
||||
export LC_ALL=C
|
||||
total=$(free -m | awk '/^Mem:/{print $2}')
|
||||
mem=$(free -m | awk '/^Mem:/{print $2}')
|
||||
swap=$(free -m | awk '/^Swap:/{print $2}')
|
||||
total=$((mem + swap))
|
||||
j_value=$((total / 2024))
|
||||
cpu_cores=$(nproc)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user