mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 21:19:59 +00:00
pt-mysql-summary: Make sure the Status Counters don't use scientific notation
This commit is contained in:
@@ -1171,8 +1171,7 @@ format_status_variables () {
|
|||||||
utime2 = ${utime2};
|
utime2 = ${utime2};
|
||||||
udays = utime1 / 86400;
|
udays = utime1 / 86400;
|
||||||
udiff = utime2 - utime1;
|
udiff = utime2 - utime1;
|
||||||
format=\"%-35s %11s %11s %11s\\n\";
|
printf(\"%-35s %11s %11s %11s\\n\", \"Variable\", \"Per day\", \"Per second\", udiff \" secs\");
|
||||||
printf(format, \"Variable\", \"Per day\", \"Per second\", udiff \" secs\");
|
|
||||||
}
|
}
|
||||||
\$2 ~ /^[0-9]*\$/ {
|
\$2 ~ /^[0-9]*\$/ {
|
||||||
if ( \$2 > 0 && \$2 < 18446744073709551615 ) {
|
if ( \$2 > 0 && \$2 < 18446744073709551615 ) {
|
||||||
@@ -1195,9 +1194,13 @@ format_status_variables () {
|
|||||||
persec = int(persec);
|
persec = int(persec);
|
||||||
nowsec = int(nowsec);
|
nowsec = int(nowsec);
|
||||||
if ( perday + persec + nowsec > 0 ) {
|
if ( perday + persec + nowsec > 0 ) {
|
||||||
if ( perday == 0 ) { perday = \"\"; }
|
perday_format=\"%11.f\";
|
||||||
if ( persec == 0 ) { persec = \"\"; }
|
persec_format=\"%11.f\";
|
||||||
if ( nowsec == 0 ) { nowsec = \"\"; }
|
nowsec_format=\"%11.f\";
|
||||||
|
if ( perday == 0 ) { perday = \"\"; perday_format=\"%11s\"; }
|
||||||
|
if ( persec == 0 ) { persec = \"\"; persec_format=\"%11s\"; }
|
||||||
|
if ( nowsec == 0 ) { nowsec = \"\"; nowsec_format=\"%11s\"; }
|
||||||
|
format=\"%-35s \" perday_format \" \" persec_format \" \" nowsec_format \"\\n\";
|
||||||
printf(format, \$1, perday, persec, nowsec);
|
printf(format, \$1, perday, persec, nowsec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -228,8 +228,7 @@ format_status_variables () {
|
|||||||
utime2 = ${utime2};
|
utime2 = ${utime2};
|
||||||
udays = utime1 / 86400;
|
udays = utime1 / 86400;
|
||||||
udiff = utime2 - utime1;
|
udiff = utime2 - utime1;
|
||||||
format=\"%-35s %11s %11s %11s\\n\";
|
printf(\"%-35s %11s %11s %11s\\n\", \"Variable\", \"Per day\", \"Per second\", udiff \" secs\");
|
||||||
printf(format, \"Variable\", \"Per day\", \"Per second\", udiff \" secs\");
|
|
||||||
}
|
}
|
||||||
\$2 ~ /^[0-9]*\$/ {
|
\$2 ~ /^[0-9]*\$/ {
|
||||||
if ( \$2 > 0 && \$2 < 18446744073709551615 ) {
|
if ( \$2 > 0 && \$2 < 18446744073709551615 ) {
|
||||||
@@ -252,9 +251,18 @@ format_status_variables () {
|
|||||||
persec = int(persec);
|
persec = int(persec);
|
||||||
nowsec = int(nowsec);
|
nowsec = int(nowsec);
|
||||||
if ( perday + persec + nowsec > 0 ) {
|
if ( perday + persec + nowsec > 0 ) {
|
||||||
if ( perday == 0 ) { perday = \"\"; }
|
# We do the format in this roundabout way because we want two clashing
|
||||||
if ( persec == 0 ) { persec = \"\"; }
|
# behaviors: If something is zero, just print the space padding,
|
||||||
if ( nowsec == 0 ) { nowsec = \"\"; }
|
# however, if it's any other number, we want that. Problem: %s alone
|
||||||
|
# might use scientific notation, and we can't use %11.f for both cases
|
||||||
|
# as it would turn the empty string into a zero. So use both.
|
||||||
|
perday_format=\"%11.f\";
|
||||||
|
persec_format=\"%11.f\";
|
||||||
|
nowsec_format=\"%11.f\";
|
||||||
|
if ( perday == 0 ) { perday = \"\"; perday_format=\"%11s\"; }
|
||||||
|
if ( persec == 0 ) { persec = \"\"; persec_format=\"%11s\"; }
|
||||||
|
if ( nowsec == 0 ) { nowsec = \"\"; nowsec_format=\"%11s\"; }
|
||||||
|
format=\"%-35s \" perday_format \" \" persec_format \" \" nowsec_format \"\\n\";
|
||||||
printf(format, \$1, perday, persec, nowsec);
|
printf(format, \$1, perday, persec, nowsec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user