Display JIT info for plans

parent 34f0032e
......@@ -18,6 +18,6 @@ requires 'Encode';
requires 'English';
requires 'File::Spec';
requires 'Mojolicious';
requires 'Pg::Explain', '>= 0.90';
requires 'Pg::Explain', '>= 1.05';
# vim: set ft=perl:
......@@ -256,3 +256,22 @@ section p a:hover {background:#234;color:#fff;border:1px solid #123}
#trigger-times tr.c-2 {background-color:#fe8 !important}
#trigger-times tr.c-3 {background-color:#e80 !important;color:#fff}
#trigger-times tr.c-4 {background-color:#800 !important;color:#fff}
#jit-info {margin: 1em 0px;background: #eee;}
#jit-info thead a { border: 1px solid black; font-size: 0.5em; float: right; padding: 0.3em; }
#jit-info,
#jit-info th,
#jit-info td {border-collapse: collapse; border:1px solid #ccc;}
#jit-info .jit-timing th,
#jit-info .jit-option th {padding-left: 1.5em; padding-right: 1em;}
#jit-info .jit-option td {text-align: center;}
#jit-info .jit-option td span {font-size: 1.2em; font-weight: bold;}
#jit-info th { font-size: 1.2em; font-weight: bold; padding: 0.2em 0.5em;}
#jit-info thead th {text-align: center}
#jit-info th.top {font-size: 1.5em;}
#jit-info td {text-align: right; padding: 0.2em 0.5em;}
#jit-info .jit-fun td {text-align: center;}
#jit-info span.value { font-size: 1.2em; }
#jit-info tr.c-2 {background-color:#fe8 !important}
#jit-info tr.c-3 {background-color:#e80 !important;color:#fff}
#jit-info tr.c-4 {background-color:#800 !important;color:#fff}
......@@ -572,6 +572,46 @@
</table>
% }
% if (defined $explain->jit) {
% my $full_execution_time = $explain->runtime || 0;
<table id="jit-info">
<thead>
<tr><th colspan="2" class="top" title="Just-in-Time Compilation">JIT:<a href="https://www.postgresql.org/docs/current/jit.html" target='_new'>?</a></th></tr>
</thead>
<tbody>
<tr class="jit-fun"><th>Functions:</th><td><%= $explain->jit->functions %></td></tr>
<tr><th colspan="2">Options:</th></tr>
% my $opts = $explain->jit->options;
% for my $name ( sort keys %{ $opts } ) {
<tr class="jit-option">
<th><%= $name %></th>
<td>
% if ( $opts->{$name} ) {
<span>&check;</span> (true)
% } else {
<span>&cross;</span> (false)
% }
</td>
</tr>
% }
<tr><th colspan="2">Timing:</th></tr>
% my $ts = $explain->jit->timings;
% for my $name ( sort keys %{ $ts } ) {
% my $row_color = 1;
% if ( $full_execution_time ) {
% my $t_point = $ts->{$name} / $full_execution_time;
% if ( $t_point > 0.9 ) { $row_color = 4; }
% elsif ( $t_point > 0.5 ) { $row_color = 3; }
% elsif ( $t_point > 0.1 ) { $row_color = 2; }
% }
<tr class="jit-timing c-<%= $row_color %>"><th><%= $name %></th><td><%= commify_number( $ts->{$name} ) %> ms</td></tr>
% }
</tbody>
</table>
% }
% if ( defined $explain->trigger_times ) {
% my $full_execution_time = $explain->runtime || 0;
<table id="trigger-times">
......@@ -591,7 +631,7 @@
<tr class="c-<%= $row_color %>">
<th class="name"><%= $trg->{'name'} %></th>
<td class="time"><span class="value"><%= commify_number( sprintf '%.03f', $trg->{'time'} ) %></span> <span class="unit">ms</span></td>
<td class="count"><span class="value"><%= $trg->{'calls'} %></span></td>
<td class="count"><span class="value"><%= commify_number( $trg->{'calls'} ) %></span></td>
<td class="time"><span class="value"><%= commify_number( sprintf '%.03f', $trg->{'time'} / $trg->{'calls'} ) %></span> <span class="unit">ms</span></td>
</tr>
% }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment