2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 09:13:49 +08:00

feat: 调整 j 值算法

This commit is contained in:
耗子
2023-12-14 12:22:14 +08:00
parent f31e3a7d8e
commit a3aaaa37ef

View File

@@ -21,9 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
# 计算 j 值(通用)
calculate_j() {
export LC_ALL=C
total_mem=$(free -m | awk '/^Mem:/{print $2}')
total_swap=$(free -m | awk '/^Swap:/{print $2}')
total=$((total_mem + total_swap))
total=$(free -m | awk '/^Mem:/{print $2}')
j_value=$((total / 1024))
cpu_cores=$(nproc)
@@ -41,9 +39,7 @@ calculate_j() {
# 计算 j 值2倍内存
calculate_j2() {
export LC_ALL=C
total_mem=$(free -m | awk '/^Mem:/{print $2}')
total_swap=$(free -m | awk '/^Swap:/{print $2}')
total=$((total_mem + total_swap))
total=$(free -m | awk '/^Mem:/{print $2}')
j_value=$((total / 2024))
cpu_cores=$(nproc)