From 203fefa0498286d94d6826ea5af1b0cd8b2ee53d Mon Sep 17 00:00:00 2001 From: Darold Date: Sun, 24 Jun 2012 13:10:42 +0200 Subject: [PATCH] Add --disable-hourly command line option to remove hourly statistics from the output --- README | 1 + doc/pgBadger.pod | 2 +- pgbadger | 435 +++++++++++++++++++++++------------------------ 3 files changed, 215 insertions(+), 223 deletions(-) diff --git a/README b/README index 4921c34..ed60f5d 100644 --- a/README +++ b/README @@ -45,6 +45,7 @@ SYNOPSIS from the report. For example: "^(COPY|VACUUM|COMMIT)" you can use this option multiple time. --disable-error : do not generate error report. + --disable-hourly : do not generate hourly reports. Examples: diff --git a/doc/pgBadger.pod b/doc/pgBadger.pod index 658a1ec..9460a78 100644 --- a/doc/pgBadger.pod +++ b/doc/pgBadger.pod @@ -47,7 +47,7 @@ Options: from the report. For example: "^(COPY|VACUUM|COMMIT)" you can use this option multiple time. --disable-error : do not generate error report. - + --disable-hourly : do not generate hourly reports. Examples: diff --git a/pgbadger b/pgbadger index bc5a98f..bc5d70b 100755 --- a/pgbadger +++ b/pgbadger @@ -66,6 +66,7 @@ my $progress = 0; my $error_only = 0; my @exclude_query = (); my $disable_error = 0; +my $disable_hourly = 0; my $NUMPROGRESS = 10000; my @DIMENSIONS = (800,300); @@ -111,6 +112,7 @@ my $result = GetOptions ( "w|watch-mode!" => \$error_only, "exclude-query=s" => \@exclude_query, "disable-error!"=> \$disable_error, + "disable-hourly!"=> \$disable_hourly, ); if ($ver) { @@ -522,6 +524,7 @@ Options: from the report. For example: "^(COPY|VACUUM|COMMIT)" you can use this option multiple time. --disable-error : do not generate error report. + --disable-hourly : do not generate hourly reports. Examples: @@ -726,14 +729,15 @@ Average duration of sessions: $avg_session_duration if ($connection_info{count}) { print $fh "Total number of connections: $connection_info{count}\n"; } - - print $fh qq{ + if (!$disable_hourly) { + print $fh qq{ - Hourly statistics ---------------------------------------------------- Report not supported by text format }; + } # INSERT/DELETE/UPDATE/SELECT repartition my $totala = $overall_stat{'SELECT'} + $overall_stat{'INSERT'} + $overall_stat{'UPDATE'} + $overall_stat{'DELETE'}; @@ -1214,7 +1218,13 @@ EOF print $fh qq{