Skip to content

Instantly share code, notes, and snippets.

@yoku0825
Created December 26, 2012 10:33
Show Gist options
  • Save yoku0825/4379490 to your computer and use it in GitHub Desktop.
Save yoku0825/4379490 to your computer and use it in GitHub Desktop.
anonymous Gistになってしまったので貼りなおし。。
*** innotop 2012-09-08 03:51:43.000000000 +0900
--- /usr/local/bin/innotop 2012-12-26 19:28:11.218670660 +0900
***************
*** 369,375 ****
my $w = qr/(\w+)/; # Words
my $fl = qr/([\w\.\/]+) line $d/; # Filename and line number
my $h = qr/((?:0x)?[0-9a-f]*)/; # Hex
! my $s = qr/(\d{6} .?\d:\d\d:\d\d)/; # InnoDB timestamp
# If you update this variable, also update the SYNOPSIS in the pod.
my %innodb_section_headers = (
--- 372,378 ----
my $w = qr/(\w+)/; # Words
my $fl = qr/([\w\.\/]+) line $d/; # Filename and line number
my $h = qr/((?:0x)?[0-9a-f]*)/; # Hex
! my $s = qr/(\d{4}-\d{2}-\d{2} .?\d:\d\d:\d\d)/; # InnoDB timestamp
# If you update this variable, also update the SYNOPSIS in the pod.
my %innodb_section_headers = (
***************
*** 468,474 ****
# Get the most basic info about the status: beginning and end, and whether
# I got the whole thing (if there has been a big deadlock and there are
# too many locks to print, the output might be truncated)
! my ( $time_text ) = $fulltext =~ m/^$s INNODB MONITOR OUTPUT$/m;
$innodb_data{'ts'} = [ parse_innodb_timestamp( $time_text ) ];
$innodb_data{'timestring'} = ts_to_string($innodb_data{'ts'});
( $innodb_data{'last_secs'} ) = $fulltext
--- 471,477 ----
# Get the most basic info about the status: beginning and end, and whether
# I got the whole thing (if there has been a big deadlock and there are
# too many locks to print, the output might be truncated)
! my ( $time_text ) = $fulltext =~ m/^$s .+ INNODB MONITOR OUTPUT$/m;
$innodb_data{'ts'} = [ parse_innodb_timestamp( $time_text ) ];
$innodb_data{'timestring'} = ts_to_string($innodb_data{'ts'});
( $innodb_data{'last_secs'} ) = $fulltext
***************
*** 608,616 ****
sub parse_innodb_timestamp {
my $text = shift;
my ( $y, $m, $d, $h, $i, $s )
! = $text =~ m/^(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)$/;
die("Can't get timestamp from $text\n") unless $y;
- $y += 2000;
return ( $y, $m, $d, $h, $i, $s );
}
--- 611,618 ----
sub parse_innodb_timestamp {
my $text = shift;
my ( $y, $m, $d, $h, $i, $s )
! = $text =~ m/^(\d{4})-(\d\d)-(\d\d) +(\d+):(\d+):(\d+)/;
die("Can't get timestamp from $text\n") unless $y;
return ( $y, $m, $d, $h, $i, $s );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment