]> granicus.if.org Git - pgbadger/commitdiff
Fix incremental mode where weeks on index page start on sunday and week reports start...
authorDarold Gilles <gilles@darold.net>
Sat, 14 Jun 2014 02:06:22 +0000 (04:06 +0200)
committerDarold Gilles <gilles@darold.net>
Sat, 14 Jun 2014 02:06:22 +0000 (04:06 +0200)
pgbadger

index 095e93dfa7eda997c0c7ebbdb2706bc3c245fc15..45c790f31ae4703aebd217450b50d1735b828cdf 100644 (file)
--- a/pgbadger
+++ b/pgbadger
@@ -3509,13 +3509,13 @@ sub print_general_activity
                                                <td>$count</td>
                                                <td>$min</td>
                                                <td>$max</td>
-                                               <td>$average</td>} ;
-                                               foreach my $lp (@LATENCY_PERCENTILE) {
-                                               $queries .=
-                                               qq{
-                                               <td>$percentile{$lp}</td> };
-                                               };
-                                       $queries .= qq{</tr>};
+                                               <td>$average</td>
+};
+                       foreach my $lp (@LATENCY_PERCENTILE) {
+                               $queries .= "<td>$percentile{$lp}</td>\n";
+                       }
+                       $queries .= qq{
+                                       </tr>};
                        $count = &comma_numbers($cur_period_info{'SELECT'}{count});
                        $average = &convert_time($cur_period_info{'SELECT'}{average});
                        $select_queries .= qq{
@@ -3523,13 +3523,13 @@ sub print_general_activity
                                                <td>$zday</td>
                                                <td>$h</td>
                                                <td>$count</td>
-                                               <td>$average</td>} ;
-                                                foreach my $lp (@LATENCY_PERCENTILE) {
-                                                $select_queries .=
-                                                qq{
-                                                <td>$percentile{'SELECT'}{$lp}</td> };
-                                                };
-                                        $select_queries .= qq{</tr>};
+                                               <td>$average</td>
+};
+                       foreach my $lp (@LATENCY_PERCENTILE) {
+                               $select_queries .= "<td>$percentile{'SELECT'}{$lp}</td>\n";
+                       }
+                       $select_queries .= qq{
+                                       </tr>};
                        my $insert_count = &comma_numbers($cur_period_info{'INSERT'}{count});
                        my $update_count = &comma_numbers($cur_period_info{'UPDATE'}{count});
                        my $delete_count = &comma_numbers($cur_period_info{'DELETE'}{count});
@@ -3542,12 +3542,11 @@ sub print_general_activity
                                                <td>$update_count</td>
                                                <td>$delete_count</td>
                                                <td>$write_average</td>} ;
-                                                foreach my $lp (@LATENCY_PERCENTILE) {
-                                                $write_queries .=
-                                                qq{
-                                                <td>$percentile{'WRITE'}{$lp}</td> };
-                                                };
-                                        $write_queries .= qq{</tr>};
+                       foreach my $lp (@LATENCY_PERCENTILE) {
+                               $write_queries .= "<td>$percentile{'WRITE'}{$lp}</td>\n";
+                       }
+                       $write_queries .= qq{
+                                       </tr>};
                        my $prepare_count = &comma_numbers($cur_period_info{prepare});
                        my $execute_count = &comma_numbers($cur_period_info{execute});
                        my $bind_prepare = &comma_numbers(sprintf("%.2f", $cur_period_info{execute}/($cur_period_info{prepare}||1)));
@@ -10373,7 +10372,7 @@ sub get_week_number
        if ($datefmt ne "$year-$month-$day") {
                return -1;
        }
-       my $weekNumber = POSIX::strftime("%W", 1, 1, 1, $day, $month - 1, $year - 1900);
+       my $weekNumber = POSIX::strftime("%U", 1, 1, 1, $day, $month - 1, $year - 1900);
 
        return sprintf("%02d", $weekNumber+1);
 }
@@ -10422,7 +10421,7 @@ sub get_wdays_per_month
                        if ($datefmt ne "$y-$m-$day") {
                                next;
                        }
-                       my $weekNumber = POSIX::strftime("%W", 1, 1, 1, $day, $m - 1, $y - 1900);
+                       my $weekNumber = POSIX::strftime("%U", 1, 1, 1, $day, $m - 1, $y - 1900);
                        if ( ($weekNumber == $wn) || ( ($weekNumber eq '00') && (($wn == 1) || ($wn >= 52)) ) ) {
                                push(@retdays, "$year-$m-$day");
                                return @retdays if ($#retdays == 6);
@@ -10447,7 +10446,7 @@ sub get_wdays_per_year
                        if ($datefmt ne "$y-$m-$day") {
                                next;
                        }
-                       my $weekNumber = POSIX::strftime("%W", 1, 1, 1, $day, $m - 1, $y - 1900);
+                       my $weekNumber = POSIX::strftime("%U", 1, 1, 1, $day, $m - 1, $y - 1900);
                        push(@{$result{$weekNumber}}, "$y-$m-$day");
                }
        }