mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-03 19:15:54 +00:00
Revert r587: *do* sync on clock ticks. Fix pt-stalk.t (127.1 no longer works?). Enhance --sleep-collect docs.
This commit is contained in:
@@ -887,7 +887,6 @@ collect() {
|
|||||||
local start_time=$(date +'%s')
|
local start_time=$(date +'%s')
|
||||||
local curr_time=$start_time
|
local curr_time=$start_time
|
||||||
while [ $((curr_time - start_time)) -lt $OPT_RUN_TIME ]; do
|
while [ $((curr_time - start_time)) -lt $OPT_RUN_TIME ]; do
|
||||||
local ts="$(date +"TS %s.%N %F %T")"
|
|
||||||
|
|
||||||
disk_space $d > $d/$p-disk-space
|
disk_space $d > $d/$p-disk-space
|
||||||
check_disk_space \
|
check_disk_space \
|
||||||
@@ -896,6 +895,9 @@ collect() {
|
|||||||
"$OPT_DISK_PCT_FREE" \
|
"$OPT_DISK_PCT_FREE" \
|
||||||
|| break
|
|| break
|
||||||
|
|
||||||
|
sleep $(date +'%s.%N' | awk "{print $OPT_SLEEP_COLLECT - (\$1 % $OPT_SLEEP_COLLECT)}")
|
||||||
|
local ts="$(date +"TS %s.%N %F %T")"
|
||||||
|
|
||||||
if [ -d "/proc" ]; then
|
if [ -d "/proc" ]; then
|
||||||
if [ -f "/proc/diskstats" ]; then
|
if [ -f "/proc/diskstats" ]; then
|
||||||
(echo $ts; cat /proc/diskstats) >> "$d/$p-diskstats" &
|
(echo $ts; cat /proc/diskstats) >> "$d/$p-diskstats" &
|
||||||
@@ -926,7 +928,6 @@ collect() {
|
|||||||
(echo $ts; transactions) >>"$d/$p-transactions" &
|
(echo $ts; transactions) >>"$d/$p-transactions" &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep $OPT_SLEEP_COLLECT
|
|
||||||
curr_time=$(date +'%s')
|
curr_time=$(date +'%s')
|
||||||
done
|
done
|
||||||
log "Loop end: $(date +'TS %s.%N %F %T')"
|
log "Loop end: $(date +'TS %s.%N %F %T')"
|
||||||
@@ -1996,7 +1997,9 @@ reasonably.
|
|||||||
|
|
||||||
type: int; default: 1
|
type: int; default: 1
|
||||||
|
|
||||||
How long to sleep between collection loop cycles.
|
How long to sleep between collection loop cycles. This is useful with
|
||||||
|
C<--no-stalk> to do long collections. For example, to collect data every
|
||||||
|
minute for an hour, specify: C<--no-stalk --run-time 3600 --sleep-collect 60>.
|
||||||
|
|
||||||
=item --socket
|
=item --socket
|
||||||
|
|
||||||
|
@@ -182,7 +182,6 @@ collect() {
|
|||||||
local start_time=$(date +'%s')
|
local start_time=$(date +'%s')
|
||||||
local curr_time=$start_time
|
local curr_time=$start_time
|
||||||
while [ $((curr_time - start_time)) -lt $OPT_RUN_TIME ]; do
|
while [ $((curr_time - start_time)) -lt $OPT_RUN_TIME ]; do
|
||||||
local ts="$(date +"TS %s.%N %F %T")"
|
|
||||||
|
|
||||||
# We check the disk, but don't exit, because we need to stop jobs if we
|
# We check the disk, but don't exit, because we need to stop jobs if we
|
||||||
# need to exit.
|
# need to exit.
|
||||||
@@ -193,6 +192,11 @@ collect() {
|
|||||||
"$OPT_DISK_PCT_FREE" \
|
"$OPT_DISK_PCT_FREE" \
|
||||||
|| break
|
|| break
|
||||||
|
|
||||||
|
# Sleep between collect cycles.
|
||||||
|
# Synchronize ourselves onto the clock tick, so the sleeps are 1-second
|
||||||
|
sleep $(date +'%s.%N' | awk "{print $OPT_SLEEP_COLLECT - (\$1 % $OPT_SLEEP_COLLECT)}")
|
||||||
|
local ts="$(date +"TS %s.%N %F %T")"
|
||||||
|
|
||||||
# #####################################################################
|
# #####################################################################
|
||||||
# Collect data for this cycle.
|
# Collect data for this cycle.
|
||||||
# #####################################################################
|
# #####################################################################
|
||||||
@@ -226,8 +230,6 @@ collect() {
|
|||||||
(echo $ts; transactions) >>"$d/$p-transactions" &
|
(echo $ts; transactions) >>"$d/$p-transactions" &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Sleep between collect cycles.
|
|
||||||
sleep $OPT_SLEEP_COLLECT
|
|
||||||
curr_time=$(date +'%s')
|
curr_time=$(date +'%s')
|
||||||
done
|
done
|
||||||
log "Loop end: $(date +'TS %s.%N %F %T')"
|
log "Loop end: $(date +'TS %s.%N %F %T')"
|
||||||
|
@@ -4,5 +4,5 @@
|
|||||||
--
|
--
|
||||||
-umsandbox
|
-umsandbox
|
||||||
-pmsandbox
|
-pmsandbox
|
||||||
--host 127.1
|
--host 127.0.0.1
|
||||||
--port 12345
|
--port 12345
|
||||||
|
Reference in New Issue
Block a user