]> granicus.if.org Git - pgbadger/commitdiff
Add "Average queries per session" and "Average queries duration per session" in Sessi...
authorDalibo <admin@dalibo.com>
Fri, 7 Nov 2014 22:50:56 +0000 (23:50 +0100)
committerDalibo <admin@dalibo.com>
Fri, 7 Nov 2014 22:50:56 +0000 (23:50 +0100)
pgbadger

index 9ce21e5890e88eae04647ebd3ef86754801f78a9..8954e4f8f392aee5eeab0f3c42b6c1946c059f73 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -3021,9 +3021,13 @@ Average size of temporary files: $fmt_temp_avsize
        if (!$disable_session && $session_info{count}) {
                my $avg_session_duration = &convert_time($session_info{duration} / $session_info{count});
                my $tot_session_duration = &convert_time($session_info{duration});
+               my $avg_queries = &comma_numbers(int($overall_stat{'queries_number'}/$session_info{count}));
+               my $avg_duration = &convert_time(int($overall_stat{'queries_duration'}/$session_info{count}));
                print $fh qq{Total number of sessions: $session_info{count}
 Total duration of sessions: $tot_session_duration
 Average duration of sessions: $avg_session_duration
+Average queries per sessions: $avg_queries
+Average queries duration per sessions: $avg_duration
 };
                foreach (sort {$overall_stat{'peak'}{$b}{session} <=> $overall_stat{'peak'}{$a}{session}} keys %{$overall_stat{'peak'}}) {
                        print $fh "Session peak: ", &comma_numbers($overall_stat{'peak'}{$_}{session}), " sessions at $_";
@@ -3825,6 +3829,8 @@ sub print_overall_statistics
                $query_peak_date = $_;
                last;
        }
+       my $avg_queries = &comma_numbers(int($overall_stat{'queries_number'}/$session_info{count}));
+       my $avg_duration = &convert_time(int($overall_stat{'queries_duration'}/$session_info{count}));
        my $fmt_errors = &comma_numbers($overall_stat{'errors_number'});
        my $fmt_unique_error = &comma_numbers(scalar keys %error_info);
        my $autovacuum_count = &comma_numbers($autovacuum_info{count});
@@ -3911,6 +3917,9 @@ sub print_overall_statistics
                                                        <li><span class="figure">$session_peak sessions at $session_peak_date</span> <span class="figure-label">Session peak</span></li>
                                                        <li><span class="figure">$tot_session_duration</span> <span class="figure-label">Total duration of sessions</span></li>
                                                        <li><span class="figure">$avg_session_duration</span> <span class="figure-label">Average duration of sessions</span></li>
+                                                       <li><span class="figure">$avg_queries</span> <span class="figure-label">Average queries per session</span></li>
+                                                       <li><span class="figure">$avg_duration</span> <span class="figure-label">Average queries duration per session</span></li>
+
                                                </ul>
                                        </div>
                                        <div class="tab-pane" id="tab-connections">