This repository has been archived by the owner on May 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
myq_innodb_status
executable file
·506 lines (450 loc) · 20.2 KB
/
myq_innodb_status
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
#!/usr/bin/env perl
# Copyright (c) 2008 Yahoo! Inc. All rights reserved. The copyrights
# embodied in the content of this file are licensed by Yahoo! Inc.
# under the BSD (revised) open source license
use strict;
use FindBin;
# Users can symlink this script and it will still add the correct locations to
# perls path using FindBin::RealBin, but to ensure compatibility with old perl
# we need to be a bit more clever
sub get_lib {
# Start with a sensible default
my $bin_path = $FindBin::Bin;
{
no warnings 'uninitialized';
my $real_path="$FindBin::RealBin"; #This may fail on Perl < 5.10
if ($real_path ne ''){ # if the value is set, we'll use it
$bin_path = $real_path;
}
}
return $bin_path;
}
use lib get_lib();
use MySQL_Script_Utils;
use vars qw/ @ARGV $yinst_settings $TIMEOUT $innodb_status $prev_innodb_status $variables /;
sub parse_status {
my( $output ) = @_;
my %local_status;
foreach my $line( @$output ) {
next if( $line =~ m/^Variable_name/ );
$line =~ m/^(.*)\t(.*)$/;
$local_status{lc $1} = $2;
}
return \%local_status;
}
sub parse_innodb_status {
my( $output ) = @_;
my %innodb_status;
foreach my $line( @$output ) {
# SEMAPHORES SECTION
if( $line =~ m/^Per second averages calculated from the last (\d+) seconds$/ ) {
$innodb_status{sample_seconds} = $1;
} elsif( $line =~ m/^OS WAIT ARRAY INFO: reservation count (\d+), signal count (\d+)$/ ) {
$innodb_status{reservation_count} = $1;
$innodb_status{signal_count} = $2;
} elsif( $line =~ m/^Mutex spin waits (\d+), rounds (\d+), OS waits (\d+)$/ ) {
$innodb_status{mutex_spin_waits} = $1;
$innodb_status{mutex_rounds} = $2;
$innodb_status{mutex_os_waits} = $3;
} elsif( $line =~ m/^RW-shared spins (\d+), OS waits (\d+); RW-excl spins (\d+), OS waits (\d+)$/ ) {
$innodb_status{rw_shared_spins} = $1;
$innodb_status{rw_shared_os_waits} = $2;
$innodb_status{rw_excl_spins} = $3;
$innodb_status{rw_excl_os_waits} = $4;
# TRANSACTIONS SECTION
} elsif( $line =~ m/^Trx id counter (\d+) (\d+)$/ ) {
$innodb_status{trx_id_counter_min} = $1;
$innodb_status{trx_id_counter_max} = $2;
# FILE I/O SECTION
} elsif( $line =~ m/^Pending normal aio reads: (\d+), aio writes: (\d+),$/ ) {
$innodb_status{pending_normal_aio_reads} = $1;
$innodb_status{pending_normal_aio_writes} = $2;
} elsif( $line =~ m/^ ibuf aio reads: (\d+), log i\/o's: (\d+), sync i\/o's: (\d+)$/ ) {
$innodb_status{ibuf_aio_reads} = $1;
$innodb_status{ibuf_log_ios} = $2;
$innodb_status{ibuf_sync_ios} = $3;
} elsif( $line =~ m/^Pending flushes \(fsync\) log: (\d+); buffer pool: (\d+)$/ ) {
$innodb_status{pending_flushes_log} = $1;
$innodb_status{pending_flushes_buffer_pool} = $2;
} elsif( $line =~ m/^(\d+) OS file reads, (\d+) OS file writes, (\d+) OS fsyncs$/ ) {
$innodb_status{os_file_reads} = $1;
$innodb_status{os_file_writes} = $2;
$innodb_status{os_fsyncs} = $3;
} elsif( $line =~ m/^(\d+\.\d+) reads\/s, (\d+) avg bytes\/read, (\d+\.\d+) writes\/s, (\d+\.\d+) fsyncs\/s$/ ) {
$innodb_status{os_file_reads_per_sec} = $1;
$innodb_status{os_file_bytes_per_read} = $2;
$innodb_status{os_file_writes_per_sec} = $3;
$innodb_status{os_file_fsyncs_per_sec} = $4;
# INSERT BUFFER AND ADAPTIVE HASH INDEX SECTION
# LOG SECTION
} elsif( $line =~ m/^Log sequence number\s+(\d+)$/ ) {
$innodb_status{log_sequence_number} = $1;
} elsif( $line =~ m/^Log flushed up to\s+(\d+)$/ ) {
$innodb_status{log_flushed_to} = $1;
} elsif( $line =~ m/^Last checkpoint at\s+(\d+)$/ ) {
$innodb_status{log_checkpoint_at} = $1;
} elsif( $line =~ m/^(\d+) pending log writes, (\d+) pending chkp writes$/ ) {
$innodb_status{pending_log_writes} = $1;
$innodb_status{pending_chkp_writes} = $2;
} elsif( $line =~ m/^(\d+) log i\/o's done, (\d+\.\d+) log i\/o's\/second$/ ) {
$innodb_status{log_ios_done} = $1;
$innodb_status{iog_ios_per_sec} = $2;
# BUFFER POOL AND MEMORY SECTION
} elsif( $line =~ m/^Total memory allocated (\d+); in additional pool allocated (\d+)$/ ) {
$innodb_status{memory_allocated} = $1;
$innodb_status{additional_pool_allocated} = $2;
} elsif( $line =~ m/^Buffer pool size (\d+)$/ ) {
$innodb_status{buffer_pool_size} = $1;
} elsif( $line =~ m/^Free buffers (\d+)$/ ) {
$innodb_status{free_buffers} = $1;
} elsif( $line =~ m/^Database pages (\d+)$/ ) {
$innodb_status{database_pages} = $1;
} elsif( $line =~ m/^Modified db pages (\d+)$/ ) {
$innodb_status{modified_db_pages} = $1;
} elsif( $line =~ m/^Pending reads (\d+)$/ ) {
$innodb_status{pending_reads} = $1;
} elsif( $line =~ m/^Pending writes: LRU (\d+), flush list (\d+), single page (\d+)$/ ) {
$innodb_status{pending_writes_lru} = $1;
$innodb_status{pending_writes_flush_list} = $2;
$innodb_status{pending_writes_single_page} = $3;
} elsif( $line =~ m/^Pages read (\d+), created (\d+), written (\d+)$/) {
$innodb_status{pages_read} = $1;
$innodb_status{pages_created} = $2;
$innodb_status{pages_written} = $3;
} elsif( $line =~ m/^(\d+\.\d+) reads\/s, (\d+\.\d+) creates\/s, (\d+\.\d+) writes\/s$/ ) {
$innodb_status{pages_reads_per_sec} = $1;
$innodb_status{pages_creates_per_sec} = $2;
$innodb_status{pages_writes_per_sec} = $3;
} elsif( $line =~ m/^Buffer pool hit rate (\d+) \/ (\d+)/ ) {
$innodb_status{hit_rate} = ($1 / $2) * 100;
# ROW OPERATIONS SECTIONS
} elsif( $line =~ m/^(\d+) queries inside InnoDB, (\d+) queries in queue$/ ) {
$innodb_status{queries_in_innodb} = $1;
$innodb_status{queries_in_queue} = $2;
} elsif( $line =~ m/^(\d+\.\d+) inserts\/s, (\d+\.\d+) updates\/s, (\d+\.\d+) deletes\/s, (\d+\.\d+) reads\/s$/ ) {
$innodb_status{inserts_per_sec} = $1;
$innodb_status{updates_per_sec} = $2;
$innodb_status{deletes_per_sec} = $3;
$innodb_status{reads_per_sec} = $4;
}
}
return \%innodb_status;
}
sub counter_diff {
my( $key ) = @_;
return $innodb_status->{$key} . '!'
if( !defined( $prev_innodb_status ));
return $innodb_status->{$key} -
$prev_innodb_status->{$key};
}
my $MODE = 'one';
my $REPEAT_TIME = 60;
my $password_on = grep( /-p/, @ARGV );
my %options = (
't=i' => \$REPEAT_TIME,
);
if( !&parse_options( \%options ) or $#ARGV > 0 ) {
print STDERR <<USAGE;
myq_innodb_status $DEFAULT_OPTIONS_STRING [-t <secs>] [sema|row|file|log|mem|one]
USAGE
exit;
}
$MODE = shift @ARGV if( $#ARGV == 0 );
die "Mode must be one of 'one', 'sema', 'row', 'file', 'log', 'mem', 'extramem'\n" if( $MODE !~ m/sema|row|file|log|mem|one/ );
die "Repeat time must be at least than 10 seconds\n" if( $REPEAT_TIME < 10 );
my $cache_file = "/tmp/myq_innodb_status_$HOST";
my $count = 0;
my $lines_per_header = 15;;
my $variables = &parse_status( &mysql_call( "SHOW GLOBAL VARIABLES" ));
LOOP: while( 1 ) {
my $start_time = time;
my @array;
my $output = \@array;
if( -f $cache_file ) {
(open( CACHEL, "$cache_file" ) and flock( CACHEL, 2 ))
or die "Could not get lock\n";
}
if( -s $cache_file and ( time - (stat( $cache_file ))[9] < 10 )) {
# Keep the cache
&print_debug( "Keeping the cache: $cache_file" );
open( CACHE, "<$cache_file" ) || die "Could not open cache: $cache_file\n";
while( my $line = <CACHE> ) {
push( @$output, $line );
}
close( CACHE );
} else {
# (Re-)generate the cache
&print_debug( "Generating the cache: $cache_file" );
$output = &mysql_call( "SHOW /*!50000 ENGINE */ INNODB STATUS\\G" );
if( open( CACHE, ">$cache_file" )) {
foreach my $line( @$output ) {
print CACHE $line;
}
close( CACHE );
} else {
print "Skipping cache\n";
}
}
flock( CACHEL, 8 );
$innodb_status = &parse_innodb_status( $output );
foreach my $key( keys %$innodb_status ) {
&print_debug( "$key => " . $innodb_status->{$key} );
}
if( $innodb_status->{sample_seconds} <= 1 ) {
# Occasionally we get a status that has a very small sample space
# and skewed values... hence sleep 10 and try to fetch it again...
sleep 10;
next LOOP;
}
#foreach my $key( sort keys %$innodb_status ) {
#print "$key => " . $innodb_status->{$key} . "\n";
#}
my $pretty_time = `date '+\%H:\%M:\%S'`;
chop $pretty_time;
if( $MODE eq 'one' ) {
printf( "row %-20s %-13s %-14s %-4s %-15s %-10s\n",
'Inno Engine (/sec)',
'Buffer (/sec)',
'(%)',
'Log',
'OS (/sec)',
'Semaphores',
) if( $count % $lines_per_header == 0 );
printf( "time % 4s % 4s % 4s % 4s % 4s % 4s % 4s % 4s % 4s % 4s % 4s % 4s % 4s % 4s %4s %4s %4s\n",
'read', 'ins', 'upd','del',
'new', 'read', 'wrte',
'full', 'dirt', 'hit',
'io/s',
'read', 'wrte', 'fsyc',
'spw', 'rnds', 'osw',
) if( $count % $lines_per_header == 0 );
printf( "%s % 4s % 4s % 4s % 4s % 4s % 4s % 4s % 4.0f % 4.0f % 4.0f % 4s % 4s % 4s % 4s % 4s % 4s % 4s ",
$pretty_time,
&format_number( $innodb_status->{reads_per_sec}, 1, 4 ),
&format_number( $innodb_status->{inserts_per_sec}, 1, 4 ),
&format_number( $innodb_status->{updates_per_sec}, 1, 4 ),
&format_number( $innodb_status->{deletes_per_sec}, 1, 4 ),
&format_number( $innodb_status->{pages_creates_per_sec}, 1, 4 ),
&format_number( $innodb_status->{pages_reads_per_sec}, 1, 4 ),
&format_number( $innodb_status->{pages_writes_per_sec}, 1, 4 ),
&format_percent( $innodb_status->{database_pages},
$innodb_status->{buffer_pool_size} ),
&format_percent( $innodb_status->{modified_db_pages},
$innodb_status->{buffer_pool_size} ),
$innodb_status->{hit_rate},
&format_number( $innodb_status->{iog_ios_per_sec}, 1, 4 ),
&format_number( $innodb_status->{os_file_reads_per_sec}, 1, 4),
&format_number( $innodb_status->{os_file_writes_per_sec}, 1, 4),
&format_number( $innodb_status->{os_file_fsyncs_per_sec}, 1, 4),
&format_number( &counter_diff( 'mutex_spin_waits' ), 1, 4),
&format_number( &counter_diff( 'mutex_rounds' ), 1, 4),
&format_number( &counter_diff( 'mutex_os_waits' ), 1, 4 ),
#&format_percent(
#&counter_diff( 'mutex_spin_waits' ) -
#&counter_diff( 'mutex_os_waits' ),
#&counter_diff( 'mutex_spin_waits' )
#),
#&format_percent(
#&counter_diff( 'rw_shared_spins' ) -
#&counter_diff( 'rw_shared_os_waits' ),
#&counter_diff( 'rw_shared_spins' )
#),
#&format_percent(
#&counter_diff( 'rw_excl_spins' ) -
#&counter_diff( 'rw_excl_os_waits' ),
#
#&counter_diff( 'rw_excl_spins' )),
);
} elsif( $MODE eq 'sema' ) {
printf( "sema % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s\n",
'resv cnt',
'sig cnt',
'mut_sw',
'mut_rnds',
'mut_osw',
'rwsh_sp',
'rwsh_os',
'rwex_sp',
'rwex_os',
) if( $count % $lines_per_header == 0 );
printf( "%s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s",
$pretty_time,
&format_number( &counter_diff( 'reservation_count' ), 2, 6 ),
&format_number( &counter_diff( 'signal_count' ), 2, 6 ),
&format_number( &counter_diff( 'mutex_spin_waits' ), 2, 6 ),
&format_number( &counter_diff( 'mutex_rounds' ), 2, 6 ),
&format_number( &counter_diff( 'mutex_os_waits' ), 2, 6 ),
&format_number( &counter_diff( 'rw_shared_spins' ), 2, 6 ),
&format_number( &counter_diff( 'rw_shared_os_waits' ), 2, 6 ),
&format_number( &counter_diff( 'rw_excl_spins' ), 2, 6 ),
&format_number( &counter_diff( 'rw_excl_os_waits' ), 2, 6 ),
);
} elsif( $MODE eq 'row' ) {
printf( "row % 8s % 8s % 8s % 8s % 8s % 8s\n",
'ins/sec',
'upd/sec',
'del/sec',
'read/sec',
) if( $count % $lines_per_header == 0 );
printf( "%s % 8s % 8s % 8s % 8s % 8s % 8s",
$pretty_time,
&format_number( $innodb_status->{reads_per_sec}, 2, 6 ),
&format_number( $innodb_status->{inserts_per_sec}, 2, 6 ),
&format_number( $innodb_status->{updates_per_sec}, 2, 6 ),
&format_number( $innodb_status->{deletes_per_sec}, 2, 6 ),
)
} elsif( $MODE eq 'extrarow' ) {
printf( "row % 8s % 8s % 8s % 8s % 8s % 8s\n",
'qry_inno',
'qry_que',
'ins/sec',
'upd/sec',
'del/sec',
'read/sec',
) if( $count % $lines_per_header == 0 );
printf( "%s % 8s % 8s % 8s % 8s % 8s % 8s",
$pretty_time,
&format_number( $innodb_status->{queries_in_innodb}, 2, 6 ),
&format_number( $innodb_status->{queries_in_queue}, 2, 6 ),
&format_number( $innodb_status->{reads_per_sec}, 2, 6 ),
&format_number( $innodb_status->{inserts_per_sec}, 2, 6 ),
&format_number( $innodb_status->{updates_per_sec}, 2, 6 ),
&format_number( $innodb_status->{deletes_per_sec}, 2, 6 ),
)
} elsif( $MODE eq 'file' ) {
printf( "file % 8s % 8s % 8s % 8s % 8s % 8s\n",
'os_f_r',
'os_r/sec',
'os_f_w',
'os_w/s',
'os_fsncs',
'os_fs/s',
) if( $count % $lines_per_header == 0 );
printf( "%s % 8s % 8s % 8s % 8s % 8s % 8s",
$pretty_time,
&format_number( &counter_diff( 'os_file_reads' ), 2, 6 ),
&format_number( $innodb_status->{os_file_reads_per_sec}, 2, 6),
&format_number( &counter_diff( 'os_file_writes' ), 2, 6 ),
&format_number( $innodb_status->{os_file_writes_per_sec}, 2, 6),
&format_number( &counter_diff( 'os_fsyncs' ), 2, 6 ),
&format_number( $innodb_status->{os_file_fsyncs_per_sec}, 2, 6),
);
} elsif( $MODE eq 'extrafile' ) {
printf( "file % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s\n",
'pen_aior',
'pen_aiow',
'ib_aior',
'iblogio',
'ibsyncio',
'pen_lgfl',
'pen_bpfl',
'os_f_r',
'os_f_w',
'os_fsncs',
'os_r/sec',
'os_b/r',
'os_w/s',
'os_fs/s',
) if( $count % $lines_per_header == 0 );
printf( "%s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s",
$pretty_time,
&format_number( $innodb_status->{pending_normal_aio_reads}, 2, 6 ),
&format_number( $innodb_status->{pending_normal_aio_writes}, 2, 6 ),
&format_number( $innodb_status->{ibuf_aio_reads}, 2, 6 ),
&format_number( $innodb_status->{ibuf_log_ios}, 2, 6 ),
&format_number( $innodb_status->{ibuf_sync_ios}, 2, 6 ),
&format_number( $innodb_status->{pending_flushes_log}, 2, 6 ),
&format_number( $innodb_status->{pending_flushes_buffer_pool}, 2, 6 ),
&format_number( &counter_diff( 'os_file_reads' ), 2, 6 ),
&format_number( &counter_diff( 'os_file_writes' ), 2, 6 ),
&format_number( &counter_diff( 'os_fsyncs' ), 2, 6 ),
&format_number( $innodb_status->{os_file_reads_per_sec}, 2, 6 ),
&format_memory( $innodb_status->{os_file_bytes_per_read}, 2, 6 ),
&format_number( $innodb_status->{os_file_writes_per_sec}, 2, 6 ),
&format_number( $innodb_status->{os_file_fsyncs_per_sec}, 2, 6 ),
);
} elsif( $MODE eq 'log' ) {
printf( "log % 8s % 8s % 8s % 8s % 8s % 8s\n",
'log_io',
'log_io/s',
'Chpt Age',
'Pct fill',
'Mb W'
) if( $count % $lines_per_header == 0 );
printf( "%s % 8s % 8s % 8s % 8s % 8s",
$pretty_time,
&format_number( &counter_diff( 'log_ios_done' ), 2, 6 ),
&format_number( $innodb_status->{iog_ios_per_sec}, 2, 6 ),
&format_memory( ($innodb_status->{log_sequence_number} -
$innodb_status->{log_checkpoint_at}), 2, 6 ),
&format_percent( ($innodb_status->{log_sequence_number} -
$innodb_status->{log_checkpoint_at}),
($variables->{innodb_log_file_size} *
$variables->{innodb_log_files_in_group}), 2, 6),
&format_number( &counter_diff( 'log_sequence_number' )/1024/1024, 2, 6 )
);
} elsif( $MODE eq 'extralog' ) {
printf( "log % 8s % 8s % 8s % 8s\n",
'pen_logw',
'pen_chkw',
'log_io',
'log_io/s'
) if( $count % $lines_per_header == 0 );
printf( "%s % 8s % 8s % 8s % 8s",
$pretty_time,
&format_number( $innodb_status->{pending_log_writes}, 2, 6 ),
&format_number( $innodb_status->{pending_chkp_writes}, 2, 6 ),
&format_number( &counter_diff( 'log_ios_done' ), 2, 6 ),
&format_number( $innodb_status->{iog_ios_per_sec}, 2, 6 ),
);
} elsif( $MODE eq 'mem' ) {
printf( "mem % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s\n",
'pgs_db',
'pgdb_mod',
'pgs_crt',
'pgs_c/s',
'pgs_wrt',
'pgs_w/s',
'pgs_read',
'pgs_r/s'
) if( $count % $lines_per_header == 0 );
printf( "%s % 8s % 8s % 8s % 8s % 8s % 8s % 8s % 8s",
$pretty_time,
&format_percent( $innodb_status->{database_pages},
$innodb_status->{buffer_pool_size} ),
&format_percent( $innodb_status->{modified_db_pages},
$innodb_status->{database_pages} ),
&format_number( &counter_diff( 'pages_created' ), 2, 6 ),
&format_number( $innodb_status->{pages_creates_per_sec}, 2, 6 ),
&format_number( &counter_diff( 'pages_written' ), 2, 6 ),
&format_number( $innodb_status->{pages_writes_per_sec}, 2, 6 ),
&format_number( &counter_diff( 'pages_read' ), 2, 6 ),
&format_number( $innodb_status->{pages_reads_per_sec}, 2, 6 ),
);
} elsif( $MODE eq 'extramem' ) {
printf( "mem % 8s % 8s % 8s % 8s % 8s\n",
'pen_read',
'pen_wlru',
'pen_wfll',
'pen_wsp',
) if( $count % $lines_per_header == 0 );
printf( "%s % 8s % 8s % 8s % 8s",
$pretty_time,
&format_number( $innodb_status->{pending_reads}, 2, 6 ),
&format_number( $innodb_status->{pending_writes_lru}, 2, 6 ),
&format_number( $innodb_status->{pending_writes_flush_list}, 2, 6 ),
&format_number( $innodb_status->{pending_writes_single_page}, 2, 6 ),
);
}
print "\n";
my $end_time = time;
$prev_innodb_status = $innodb_status;
# By default try to sleep until 5 seconds after the minute
my $run_time = $end_time - $start_time;
&print_debug( "$REPEAT_TIME - $run_time" );
my $sleep_time = $REPEAT_TIME - $run_time;
$sleep_time = 0 if( $sleep_time < 0 );
&print_debug( "Sleeping: $sleep_time\n" );
sleep $sleep_time;
$count++;
}