mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Fix mem/file size shortening in pt-summary and pt-mysql-summary.
This commit is contained in:
@@ -1791,7 +1791,7 @@ section_innodb () {
|
|||||||
local log_file="$(get_var innodb_log_files_in_group "$variables_file")"
|
local log_file="$(get_var innodb_log_files_in_group "$variables_file")"
|
||||||
local log_total=$(awk "BEGIN {printf \"%.2f\n\", ${log_size}*${log_file}}" )
|
local log_total=$(awk "BEGIN {printf \"%.2f\n\", ${log_size}*${log_file}}" )
|
||||||
name_val "Log File Size" \
|
name_val "Log File Size" \
|
||||||
"${log_file} * $(shorten ${log_size} 1 1000) = $(shorten ${log_total} 1 1000)"
|
"${log_file} * $(shorten ${log_size} 1) = $(shorten ${log_total} 1)"
|
||||||
name_val "Log Buffer Size" \
|
name_val "Log Buffer Size" \
|
||||||
"$(shorten $(get_var innodb_log_buffer_size "$variables_file") 0)"
|
"$(shorten $(get_var innodb_log_buffer_size "$variables_file") 0)"
|
||||||
name_val "Flush Method" \
|
name_val "Flush Method" \
|
||||||
|
@@ -1375,7 +1375,7 @@ parse_memory_sysctl_netbsd() { local PTFUNCNAME=parse_memory_sysctl_netbsd;
|
|||||||
|
|
||||||
[ -e "$file" -a -e "$swapctl_file" ] || return
|
[ -e "$file" -a -e "$swapctl_file" ] || return
|
||||||
|
|
||||||
local swap_mem="$(echo "$(awk '{print $2;}' "$swapctl_file")*512" | bc -l)"
|
local swap_mem="$(awk '{print $2*512}' "$swapctl_file")"
|
||||||
name_val "Total" $(shorten "$(awk '/hw.physmem /{print $NF}' "$file")" 1)
|
name_val "Total" $(shorten "$(awk '/hw.physmem /{print $NF}' "$file")" 1)
|
||||||
name_val "User" $(shorten "$(awk '/hw.usermem /{print $NF}' "$file")" 1)
|
name_val "User" $(shorten "$(awk '/hw.usermem /{print $NF}' "$file")" 1)
|
||||||
name_val "Swap" $(shorten ${swap_mem} 1)
|
name_val "Swap" $(shorten ${swap_mem} 1)
|
||||||
@@ -1387,7 +1387,7 @@ parse_memory_sysctl_openbsd() { local PTFUNCNAME=parse_memory_sysctl_openbsd;
|
|||||||
|
|
||||||
[ -e "$file" -a -e "$swapctl_file" ] || return
|
[ -e "$file" -a -e "$swapctl_file" ] || return
|
||||||
|
|
||||||
local swap_mem="$(echo "$(awk '{print $2;}' "$swapctl_file")*512" | bc -l)"
|
local swap_mem="$(awk '{print $2*512}' "$swapctl_file")"
|
||||||
name_val "Total" $(shorten "$(awk -F= '/hw.physmem/{print $2}' "$file")" 1)
|
name_val "Total" $(shorten "$(awk -F= '/hw.physmem/{print $2}' "$file")" 1)
|
||||||
name_val "User" $(shorten "$(awk -F= '/hw.usermem/{print $2}' "$file")" 1)
|
name_val "User" $(shorten "$(awk -F= '/hw.usermem/{print $2}' "$file")" 1)
|
||||||
name_val "Swap" $(shorten ${swap_mem} 1)
|
name_val "Swap" $(shorten ${swap_mem} 1)
|
||||||
|
@@ -902,7 +902,7 @@ section_innodb () {
|
|||||||
local log_file="$(get_var innodb_log_files_in_group "$variables_file")"
|
local log_file="$(get_var innodb_log_files_in_group "$variables_file")"
|
||||||
local log_total=$(awk "BEGIN {printf \"%.2f\n\", ${log_size}*${log_file}}" )
|
local log_total=$(awk "BEGIN {printf \"%.2f\n\", ${log_size}*${log_file}}" )
|
||||||
name_val "Log File Size" \
|
name_val "Log File Size" \
|
||||||
"${log_file} * $(shorten ${log_size} 1 1000) = $(shorten ${log_total} 1 1000)"
|
"${log_file} * $(shorten ${log_size} 1) = $(shorten ${log_total} 1)"
|
||||||
name_val "Log Buffer Size" \
|
name_val "Log Buffer Size" \
|
||||||
"$(shorten $(get_var innodb_log_buffer_size "$variables_file") 0)"
|
"$(shorten $(get_var innodb_log_buffer_size "$variables_file") 0)"
|
||||||
name_val "Flush Method" \
|
name_val "Flush Method" \
|
||||||
|
@@ -183,7 +183,7 @@ parse_memory_sysctl_netbsd() { local PTFUNCNAME=parse_memory_sysctl_netbsd;
|
|||||||
|
|
||||||
[ -e "$file" -a -e "$swapctl_file" ] || return
|
[ -e "$file" -a -e "$swapctl_file" ] || return
|
||||||
|
|
||||||
local swap_mem="$(echo "$(awk '{print $2;}' "$swapctl_file")*512" | bc -l)"
|
local swap_mem="$(awk '{print $2*512}' "$swapctl_file")"
|
||||||
name_val "Total" $(shorten "$(awk '/hw.physmem /{print $NF}' "$file")" 1)
|
name_val "Total" $(shorten "$(awk '/hw.physmem /{print $NF}' "$file")" 1)
|
||||||
name_val "User" $(shorten "$(awk '/hw.usermem /{print $NF}' "$file")" 1)
|
name_val "User" $(shorten "$(awk '/hw.usermem /{print $NF}' "$file")" 1)
|
||||||
name_val "Swap" $(shorten ${swap_mem} 1)
|
name_val "Swap" $(shorten ${swap_mem} 1)
|
||||||
@@ -198,7 +198,7 @@ parse_memory_sysctl_openbsd() { local PTFUNCNAME=parse_memory_sysctl_openbsd;
|
|||||||
|
|
||||||
[ -e "$file" -a -e "$swapctl_file" ] || return
|
[ -e "$file" -a -e "$swapctl_file" ] || return
|
||||||
|
|
||||||
local swap_mem="$(echo "$(awk '{print $2;}' "$swapctl_file")*512" | bc -l)"
|
local swap_mem="$(awk '{print $2*512}' "$swapctl_file")"
|
||||||
name_val "Total" $(shorten "$(awk -F= '/hw.physmem/{print $2}' "$file")" 1)
|
name_val "Total" $(shorten "$(awk -F= '/hw.physmem/{print $2}' "$file")" 1)
|
||||||
name_val "User" $(shorten "$(awk -F= '/hw.usermem/{print $2}' "$file")" 1)
|
name_val "User" $(shorten "$(awk -F= '/hw.usermem/{print $2}' "$file")" 1)
|
||||||
name_val "Swap" $(shorten ${swap_mem} 1)
|
name_val "Swap" $(shorten ${swap_mem} 1)
|
||||||
|
@@ -258,7 +258,7 @@ EOF
|
|||||||
is \
|
is \
|
||||||
"$(get_plugin_status $TMPDIR/plugins "INNODB_CMP" )" \
|
"$(get_plugin_status $TMPDIR/plugins "INNODB_CMP" )" \
|
||||||
"ACTIVE" \
|
"ACTIVE" \
|
||||||
"Doesn't get confused by multiple plugins with the same prefix"
|
"Multiple plugins with the same prefix"
|
||||||
|
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# parse_mysqld_instances
|
# parse_mysqld_instances
|
||||||
@@ -499,9 +499,6 @@ no_diff \
|
|||||||
# format_innodb_status
|
# format_innodb_status
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
|
||||||
# ############################################################################
|
|
||||||
TEST_NAME="innodb-status.001.txt"
|
|
||||||
# ############################################################################
|
|
||||||
cat <<EOF > $TMPDIR/expected
|
cat <<EOF > $TMPDIR/expected
|
||||||
Checkpoint Age | 619k
|
Checkpoint Age | 619k
|
||||||
InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
|
InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
|
||||||
@@ -551,11 +548,8 @@ Mutexes/Locks Waited For
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
format_innodb_status $samples/innodb-status.001.txt > $TMPDIR/got
|
format_innodb_status $samples/innodb-status.001.txt > $TMPDIR/got
|
||||||
no_diff $TMPDIR/got $TMPDIR/expected
|
no_diff $TMPDIR/got $TMPDIR/expected "innodb-status.001.txt"
|
||||||
|
|
||||||
# ############################################################################
|
|
||||||
TEST_NAME="innodb-status.002.txt"
|
|
||||||
# ############################################################################
|
|
||||||
cat <<'EOF' > $TMPDIR/expected
|
cat <<'EOF' > $TMPDIR/expected
|
||||||
Checkpoint Age | 348M
|
Checkpoint Age | 348M
|
||||||
InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
|
InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
|
||||||
@@ -588,11 +582,8 @@ Mutexes/Locks Waited For
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
format_innodb_status $samples/innodb-status.002.txt > $TMPDIR/got
|
format_innodb_status $samples/innodb-status.002.txt > $TMPDIR/got
|
||||||
no_diff $TMPDIR/got $TMPDIR/expected
|
no_diff $TMPDIR/got $TMPDIR/expected "innodb-status.002.txt"
|
||||||
|
|
||||||
# ############################################################################
|
|
||||||
TEST_NAME="innodb-status.003.txt"
|
|
||||||
# ############################################################################
|
|
||||||
cat <<'EOF' > $TMPDIR/expected
|
cat <<'EOF' > $TMPDIR/expected
|
||||||
Checkpoint Age | 0
|
Checkpoint Age | 0
|
||||||
InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
|
InnoDB Queue | 0 queries inside InnoDB, 0 queries in queue
|
||||||
@@ -609,11 +600,8 @@ Tables Locked
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
format_innodb_status $samples/innodb-status.003.txt > $TMPDIR/got
|
format_innodb_status $samples/innodb-status.003.txt > $TMPDIR/got
|
||||||
no_diff $TMPDIR/got $TMPDIR/expected
|
no_diff $TMPDIR/got $TMPDIR/expected "innodb-status.003.txt"
|
||||||
|
|
||||||
# ############################################################################
|
|
||||||
TEST_NAME="innodb-status.004.txt"
|
|
||||||
# ############################################################################
|
|
||||||
cat <<'EOF' > $TMPDIR/expected
|
cat <<'EOF' > $TMPDIR/expected
|
||||||
Checkpoint Age | 93M
|
Checkpoint Age | 93M
|
||||||
InnoDB Queue | 9 queries inside InnoDB, 0 queries in queue
|
InnoDB Queue | 9 queries inside InnoDB, 0 queries in queue
|
||||||
@@ -640,8 +628,7 @@ Mutexes/Locks Waited For
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
format_innodb_status $samples/innodb-status.004.txt > $TMPDIR/got
|
format_innodb_status $samples/innodb-status.004.txt > $TMPDIR/got
|
||||||
no_diff $TMPDIR/got $TMPDIR/expected
|
no_diff $TMPDIR/got $TMPDIR/expected "innodb-status.004.txt"
|
||||||
|
|
||||||
|
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# section_innodb
|
# section_innodb
|
||||||
@@ -656,7 +643,7 @@ test_format_innodb () {
|
|||||||
Buffer Pool Dirty | 0%
|
Buffer Pool Dirty | 0%
|
||||||
File Per Table | OFF
|
File Per Table | OFF
|
||||||
Page Size | 16k
|
Page Size | 16k
|
||||||
Log File Size | 2 * 1.5G = 3.0G
|
Log File Size | 2 * 1.5G = 2.9G
|
||||||
Log Buffer Size | 8M
|
Log Buffer Size | 8M
|
||||||
Flush Method |
|
Flush Method |
|
||||||
Flush Log At Commit | 1
|
Flush Log At Commit | 1
|
||||||
@@ -674,12 +661,11 @@ test_format_innodb () {
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
section_innodb "$samples/temp001/mysql-variables" "$samples/temp001/mysql-status" > "$TMPDIR/got"
|
section_innodb "$samples/temp001/mysql-variables" "$samples/temp001/mysql-status" > "$TMPDIR/got"
|
||||||
no_diff "$TMPDIR/expected" "$TMPDIR/got"
|
no_diff "$TMPDIR/got" "$TMPDIR/expected" "Format InnoDB"
|
||||||
}
|
}
|
||||||
|
|
||||||
test_format_innodb
|
test_format_innodb
|
||||||
|
|
||||||
|
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
# format_innodb_filters
|
# format_innodb_filters
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
@@ -693,7 +679,7 @@ test_format_innodb_filters () {
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
format_binlog_filters "$samples/mysql-show-master-status-001.txt" > "$TMPDIR/got"
|
format_binlog_filters "$samples/mysql-show-master-status-001.txt" > "$TMPDIR/got"
|
||||||
no_diff "$TMPDIR/got" "$TMPDIR/expected"
|
no_diff "$TMPDIR/got" "$TMPDIR/expected" "Format InnoDB filters"
|
||||||
}
|
}
|
||||||
|
|
||||||
test_format_innodb_filters
|
test_format_innodb_filters
|
||||||
|
@@ -1400,7 +1400,7 @@ Architecture | CPU = 32-bit, OS = 32-bit
|
|||||||
# The End ####################################################
|
# The End ####################################################
|
||||||
EOF
|
EOF
|
||||||
report_system_summary "$samples/BSD/netbsd_001" | tail -n +3 > "$TMPDIR/got"
|
report_system_summary "$samples/BSD/netbsd_001" | tail -n +3 > "$TMPDIR/got"
|
||||||
no_diff "$TMPDIR/got" "$TMPDIR/expected" "report_system_summary works with samples from a NetBSD box"
|
no_diff "$TMPDIR/got" "$TMPDIR/expected" "netbsd_001"
|
||||||
|
|
||||||
cat <<EOF > "$TMPDIR/expected"
|
cat <<EOF > "$TMPDIR/expected"
|
||||||
Hostname | openbsd.my.domain
|
Hostname | openbsd.my.domain
|
||||||
@@ -1452,7 +1452,7 @@ Architecture | CPU = 32-bit, OS = 32-bit
|
|||||||
# The End ####################################################
|
# The End ####################################################
|
||||||
EOF
|
EOF
|
||||||
report_system_summary "$samples/BSD/openbsd_001" | tail -n +3 > "$TMPDIR/got"
|
report_system_summary "$samples/BSD/openbsd_001" | tail -n +3 > "$TMPDIR/got"
|
||||||
no_diff "$TMPDIR/got" "$TMPDIR/expected" "report_system_summary works with samples from a OpenBSD box"
|
no_diff "$TMPDIR/got" "$TMPDIR/expected" "openbsd_001"
|
||||||
|
|
||||||
cat <<EOF > "$TMPDIR/expected"
|
cat <<EOF > "$TMPDIR/expected"
|
||||||
Hostname | hugmeir
|
Hostname | hugmeir
|
||||||
@@ -1571,10 +1571,10 @@ Unable to collect information
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
report_system_summary "$samples/Linux/001" | tail -n +3 > "$TMPDIR/got"
|
report_system_summary "$samples/Linux/001" | tail -n +3 > "$TMPDIR/got"
|
||||||
no_diff "$TMPDIR/got" "$TMPDIR/expected" "report_system_summary works with samples from Linux (Ubuntu)"
|
no_diff "$TMPDIR/got" "$TMPDIR/expected" "Linux/001 (Ubuntu)"
|
||||||
|
|
||||||
report_system_summary "$samples/Linux/002" | tail -n +3 > "$TMPDIR/got"
|
report_system_summary "$samples/Linux/002" | tail -n +3 > "$TMPDIR/got"
|
||||||
no_diff "$TMPDIR/got" "$samples/Linux/output_002.txt" "report_system_summary works with samples from Linux (CentOS 5.7, as root)"
|
no_diff "$TMPDIR/got" "$samples/Linux/output_002.txt" "Linux/002 (CentOS 5.7, as root)"
|
||||||
|
|
||||||
report_system_summary "$samples/Linux/003" | tail -n +3 > "$TMPDIR/got"
|
report_system_summary "$samples/Linux/003" | tail -n +3 > "$TMPDIR/got"
|
||||||
no_diff "$TMPDIR/got" "$samples/Linux/output_003.txt" "report_system_summary works with samples from Linux (CentOS 5.7, as non-root)"
|
no_diff "$TMPDIR/got" "$samples/Linux/output_003.txt" "Linux/003 (CentOS 5.7, as non-root)"
|
||||||
|
Reference in New Issue
Block a user