Merge lp:~percona-toolkit-dev/percona-toolkit/pt-sift-pt-diskstats-options-fix-bug-945834 into lp:percona-toolkit/2.0

Proposed by Daniel Nichter
Status: Merged
Approved by: Daniel Nichter
Approved revision: 198
Merged at revision: 203
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/pt-sift-pt-diskstats-options-fix-bug-945834
Merge into: lp:percona-toolkit/2.0
Diff against target: 63 lines (+12/-8)
1 file modified
bin/pt-sift (+12/-8)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/pt-sift-pt-diskstats-options-fix-bug-945834
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+96167@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-sift'
2--- bin/pt-sift 2012-03-02 20:23:54 +0000
3+++ bin/pt-sift 2012-03-06 16:18:03 +0000
4@@ -169,11 +169,11 @@
5 DEFAULT)
6 echo "--diskstats--"
7
8- $PR_diskstats -g disk "${BASEDIR}/${PREFIX}-diskstats" \
9+ $PR_diskstats --group-by disk "${BASEDIR}/${PREFIX}-diskstats" \
10 | awk '
11 /ts/ { header = $0 }
12 /[0-9]/ {
13- io = $3 + $6;
14+ io = $3 + $9;
15 if ( io >= mio ) {
16 mio = io;
17 mseen = $0;
18@@ -185,10 +185,10 @@
19 }'
20
21 # Find out which device was the busiest.
22- mdev="$($PR_diskstats -g disk "${BASEDIR}/${PREFIX}-diskstats" \
23+ mdev="$($PR_diskstats --group-by disk "${BASEDIR}/${PREFIX}-diskstats" \
24 | awk '
25 /[0-9]/ {
26- io = $3 + $6;
27+ io = $3 + $9;
28 if ( io >= mio ) {
29 mio = io;
30 mdev = $2;
31@@ -200,14 +200,14 @@
32
33 # Print the busy% for that device, rounded to the nearest N%, with
34 # "." as a marker for a repeated value.
35- $PR_diskstats -g sample "${BASEDIR}/${PREFIX}-diskstats" \
36+ $PR_diskstats --group-by sample "${BASEDIR}/${PREFIX}-diskstats" \
37 | awk "
38 BEGIN {
39 fuzz = 5;
40 printf \" ${mdev} \"
41 }
42 \$1 = \"${mdev}\" {
43- busy_rounded = fuzz * sprintf(\"%d\", substr(\$9, 1, length(\$9) - 1) / fuzz);
44+ busy_rounded = fuzz * sprintf(\"%d\", substr(\$15, 1, length(\$15) - 1) / fuzz);
45 if ( printed == 1 && prev == busy_rounded ) {
46 printf \" .\";
47 }
48@@ -444,9 +444,13 @@
49 esac
50
51 # Capture and handle the interactive key-strokes.
52+ tput sgr0
53 KEY=""
54- read -n 1 -s KEY
55- case "${KEY}" in
56+ if ! read -n 1 -s KEY 2>/dev/null; then
57+ echo "Error while trying to read interactive keystroke command. Exiting."
58+ exit
59+ fi
60+ case "${KEY:-}" in
61 j|k)
62 PREFIX="$(awk "
63 BEGIN {

Subscribers

People subscribed via source and target branches