From 634a9a3219da18ff509e3454ff5bad6689febb40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Tue, 18 Jun 2024 00:32:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E6=95=B0=E8=AE=A1=E7=AE=97=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/calculate_j.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/calculate_j.sh b/scripts/calculate_j.sh index 459f658b..e165f0d0 100644 --- a/scripts/calculate_j.sh +++ b/scripts/calculate_j.sh @@ -21,7 +21,9 @@ along with this program. If not, see . # 计算 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)