Skip to content

Commit d030a9d

Browse files
javiereguiluzfabpot
authored andcommitted
Improved the design of the metrics in the profiler
1 parent 2011f44 commit d030a9d

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,19 @@
6060
<span class="label">Symfony initialization</span>
6161
</div>
6262

63+
{% if profile.collectors.memory %}
64+
<div class="metric">
65+
<span class="value">{{ '%.2f'|format(profile.collectors.memory.memory / 1024 / 1024) }} <span class="unit">MB</span></span>
66+
<span class="label">Peak memory usage</span>
67+
</div>
68+
{% endif %}
69+
6370
{% if profile.children|length > 0 %}
71+
<div class="metric-divider"></div>
72+
6473
<div class="metric">
6574
<span class="value">{{ profile.children|length }}</span>
66-
<span class="label">Sub-Requests</span>
75+
<span class="label">Sub-Request{{ profile.children|length > 1 ? 's' }}</span>
6776
</div>
6877

6978
{% set subrequests_time = 0 %}
@@ -73,14 +82,7 @@
7382

7483
<div class="metric">
7584
<span class="value">{{ subrequests_time }} <span class="unit">ms</span></span>
76-
<span class="label">Sub-Requests time</span>
77-
</div>
78-
{% endif %}
79-
80-
{% if profile.collectors.memory %}
81-
<div class="metric">
82-
<span class="value">{{ '%.2f'|format(profile.collectors.memory.memory / 1024 / 1024) }} <span class="unit">MB</span></span>
83-
<span class="label">Peak memory usage</span>
85+
<span class="label">Sub-Request{{ profile.children|length > 1 ? 's' }} time</span>
8486
</div>
8587
{% endif %}
8688
</div>

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ table tbody ul {
250250
{# Metrics
251251
------------------------------------------------------------------------- #}
252252
.metrics {
253-
margin: 1em 0;
253+
margin: 1em 0 0;
254254
overflow: auto;
255255
}
256256
.metrics .metric {
257257
float: left;
258-
margin-right: 1em;
258+
margin: 0 1em 1em 0;
259259
}
260260

261261
.metric {
@@ -310,6 +310,12 @@ table tbody ul {
310310
vertical-align: middle;
311311
}
312312

313+
.metric-divider {
314+
float: left;
315+
margin: 0 1em;
316+
min-height: 1px; {# required to apply 'margin' to an empty 'div' #}
317+
}
318+
313319
{# Cards
314320
------------------------------------------------------------------------- #}
315321
.card {

0 commit comments

Comments
 (0)