Skip to content

Commit 402a60a

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fix-missing-badge-for-turbo-drive
2 parents b53316d + ac28045 commit 402a60a

File tree

14 files changed

+115
-60
lines changed

14 files changed

+115
-60
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [FIX] Truncate long profiler name in profiler popup. [#634](https://github.com/MiniProfiler/rack-mini-profiler/pull/634)
77
- [FIX] `flamegraph_mode` query param having no effect. [#635](https://github.com/MiniProfiler/rack-mini-profiler/pull/635)
88
- [FEATURE] Show record type and count in SQL query UI. [#638](https://github.com/MiniProfiler/rack-mini-profiler/pull/638)
9+
- [FEATURE] Show Active Record QueryCache hits in UI. [#640](https://github.com/MiniProfiler/rack-mini-profiler/pull/640)
910
- [FIX] missing badge for Turbo Drive page loads. [#631](https://github.com/MiniProfiler/rack-mini-profiler/pull/631)
1011

1112
## 3.3.1 - 2024-02-15

lib/html/includes.css

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,21 @@
133133
.profiler-result .profiler-timings .profiler-queries-duration {
134134
padding-left: 6px; }
135135
.profiler-result .profiler-timings .profiler-percent-in-sql {
136-
white-space: nowrap;
137-
text-align: right; }
138-
.profiler-result .profiler-timings tfoot td {
139-
padding-top: 10px;
136+
white-space: nowrap; }
137+
.profiler-result .profiler-timings tfoot tr td:last-child {
140138
text-align: right; }
141-
.profiler-result .profiler-timings tfoot td a {
139+
.profiler-result .profiler-timings-summary {
140+
display: flex;
141+
justify-content: space-between;
142+
padding-top: 10px; }
143+
.profiler-result .profiler-timings-summary a {
142144
font-size: 95%;
143145
display: inline-block;
144146
margin-left: 12px; }
145-
.profiler-result .profiler-timings tfoot td a:first-child {
147+
.profiler-result .profiler-timings-summary a:first-child {
146148
float: left;
147149
margin-left: 0px; }
148-
.profiler-result .profiler-timings tfoot td a.profiler-custom-link {
150+
.profiler-result .profiler-timings-summary a.profiler-custom-link {
149151
float: left; }
150152
.profiler-result .profiler-queries {
151153
font-family: Helvetica, Arial, sans-serif; }
@@ -163,6 +165,12 @@
163165
background-color: #fdd; }
164166
.profiler-result .profiler-queries tr.very-very-slow {
165167
background-color: #fcc; }
168+
.profiler-result .profiler-queries tr.cached {
169+
background-color: #f2f0ef; }
170+
.profiler-result .profiler-queries span.cached {
171+
color: #818589; }
172+
.profiler-result .profiler-queries span.cached + pre {
173+
display: inline; }
166174
.profiler-result .profiler-queries pre {
167175
font-family: Consolas, monospace, serif;
168176
white-space: pre-wrap; }

lib/html/includes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,10 @@ var _MiniProfiler = (function() {
13151315

13161316
sqlTiming.parent_timing_name = timing.name;
13171317

1318+
if (sqlTiming.cached) {
1319+
sqlTiming.row_class = "cached";
1320+
}
1321+
13181322
if (sqlTiming.duration_milliseconds > 50) {
13191323
sqlTiming.row_class = "slow";
13201324
}

lib/html/includes.scss

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,28 @@ $zindex: 2147483640; // near 32bit max 2147483647
147147
}
148148
.profiler-percent-in-sql {
149149
white-space: nowrap;
150+
}
151+
tfoot tr td:last-child {
150152
text-align: right;
151153
}
154+
}
152155

153-
tfoot {
154-
td {
155-
padding-top: 10px;
156-
text-align: right;
156+
.profiler-timings-summary {
157+
display: flex;
158+
justify-content: space-between;
159+
padding-top: 10px;
157160

158-
a {
159-
font-size: 95%;
160-
display: inline-block;
161-
margin-left: 12px;
161+
a {
162+
font-size: 95%;
163+
display: inline-block;
164+
margin-left: 12px;
162165

163-
&:first-child {
164-
float: left;
165-
margin-left: 0px;
166-
}
167-
&.profiler-custom-link {
168-
float: left;
169-
}
170-
}
166+
&:first-child {
167+
float: left;
168+
margin-left: 0px;
169+
}
170+
&.profiler-custom-link {
171+
float: left;
171172
}
172173
}
173174
}
@@ -202,6 +203,18 @@ $zindex: 2147483640; // near 32bit max 2147483647
202203
background-color: #fcc;
203204
}
204205

206+
tr.cached {
207+
background-color: #f2f0ef;
208+
}
209+
210+
span.cached {
211+
color: #818589;
212+
}
213+
214+
span.cached + pre {
215+
display: inline;
216+
}
217+
205218
pre {
206219
font-family: $codeFonts;
207220
white-space: pre-wrap;

lib/html/includes.tmpl

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,42 @@
4545
<tbody>
4646
{{= MiniProfiler.templates.timingTemplate({timing: it.root, page: it}) }}
4747
</tbody>
48-
<tfoot>
49-
<tr>
50-
<td colspan="3">
51-
{{? !it.client_timings}}
52-
{{= MiniProfiler.templates.linksTemplate({timing: it.root, page: it}) }}
53-
{{?}}
54-
<a class="profiler-toggle-duration-with-children" title="toggles column with aggregate child durations">show time with children</a>
55-
<a
56-
class="profiler-snapshots-page-link"
57-
title="Go to snapshots page"
58-
href="{{= MiniProfiler.options.path }}snapshots">snapshots</a>
59-
</td>
60-
{{? it.has_sql_timings}}
61-
<td colspan="2" class="profiler-number profiler-percent-in-sql" title="{{= MiniProfiler.getSqlTimingsCount(it.root) }} queries spent {{= MiniProfiler.formatDuration(it.duration_milliseconds_in_sql) }} ms of total request time">
62-
{{= MiniProfiler.formatDuration(it.duration_milliseconds_in_sql / it.duration_milliseconds * 100) }}
63-
<span class="profiler-unit">% in sql</span>
48+
{{? it.has_sql_timings}}
49+
<tfoot>
50+
<tr>
51+
<td colspan="1">
52+
SQL Summary:
6453
</td>
65-
{{?}}
66-
{{~ it.custom_timing_names :value}}
67-
<td colspan="2" class="profiler-number profiler-percentage-in-sql" title="{{= it.custom_timing_stats[value].count }} {{= value.toLowerCase() }} invocations spent {{= MiniProfiler.formatDuration(it.custom_timing_stats[value].duration) }} ms of total request time">
68-
{{= MiniProfiler.formatDuration(it.custom_timing_stats[value].duration / it.duration_milliseconds * 100) }}
69-
<span class="profiler-unit">% in {{= value.toLowerCase() }}</span>
54+
<td colspan="5" title="percent of total request time spent in SQL">
55+
{{=it.sql_count}} {{? it.cached_sql_count > 0 }} ({{=it.cached_sql_count}} cached) {{?}}
56+
<span class="profiler-unit" title="percent of total request time spent in SQL"> -
57+
{{= MiniProfiler.formatDuration(it.duration_milliseconds_in_sql / it.duration_milliseconds * 100) }}% in sql
58+
</span>
7059
</td>
71-
{{~}}
72-
</tr>
73-
</tfoot>
60+
</tr>
61+
</tfoot>
62+
{{?}}
7463
</table>
64+
65+
<div class="profiler-timings-summary">
66+
<div>
67+
{{? !it.client_timings}}
68+
{{= MiniProfiler.templates.linksTemplate({timing: it.root, page: it}) }}
69+
{{?}}
70+
<a class="profiler-toggle-duration-with-children" title="toggles column with aggregate child durations">show time with children</a>
71+
<a
72+
class="profiler-snapshots-page-link"
73+
title="Go to snapshots page"
74+
href="{{= MiniProfiler.options.path }}snapshots">snapshots</a>
75+
</div>
76+
{{~ it.custom_timing_names :value}}
77+
<div class="profiler-number profiler-percentage-in-sql" title="{{= it.custom_timing_stats[value].count }} {{= value.toLowerCase() }} invocations spent {{= MiniProfiler.formatDuration(it.custom_timing_stats[value].duration) }} ms of total request time">
78+
{{= MiniProfiler.formatDuration(it.custom_timing_stats[value].duration / it.duration_milliseconds * 100) }}
79+
<span class="profiler-unit">% in {{= value.toLowerCase() }}</span>
80+
</div>
81+
{{~}}
82+
</div>
83+
7584
{{? it.client_timings}}
7685
<table class="profiler-timings profiler-client-timings">
7786
<thead>
@@ -230,6 +239,9 @@
230239
<td>
231240
<div class="query">
232241
<pre class="profiler-stack-trace">{{= it.s.stack_trace_snippet }}</pre>
242+
{{? it.s.cached }}
243+
<span class="cached"> [CACHE] </span>
244+
{{?}}
233245
{{? it.s.formatted_command_string}}
234246
<pre class="prettyprint lang-sql"><code>{{= it.s.formatted_command_string }}; {{= MiniProfiler.formatParameters(it.s.parameters) }}</code></pre>
235247
{{??}}

0 commit comments

Comments
 (0)