{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% import _self as helper %} {% block toolbar %} {% set has_time_events = collector.events|length > 0 %} {% set total_time = has_time_events ? '%.0f'|format(collector.duration) : 'n/a' %} {% set initialization_time = collector.events|length ? '%.0f'|format(collector.inittime) : 'n/a' %} {% set status_color = has_time_events and collector.duration > 1000 ? 'yellow' %} {% set icon %} {{ source('@WebProfiler/Icon/time.svg') }} {{ total_time }} ms {% endset %} {% set text %}
Total time {{ total_time }} ms
Initialization time {{ initialization_time }} ms
{% endset %} {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }} {% endblock %} {% block menu %} {{ source('@WebProfiler/Icon/time.svg') }} Performance {% endblock %} {% block panel %} {% set has_time_events = collector.events|length > 0 %}

Performance metrics

{{ '%.0f'|format(collector.duration) }} ms Total execution time
{{ '%.0f'|format(collector.inittime) }} ms Symfony initialization
{% if profile.collectors.memory %}
{{ '%.2f'|format(profile.collectors.memory.memory / 1024 / 1024) }} MiB Peak memory usage
{% endif %} {% if profile.children|length > 0 %}
{{ profile.children|length }} Sub-Request{{ profile.children|length > 1 ? 's' }}
{% if has_time_events %} {% set subrequests_time = 0 %} {% for child in profile.children %} {% set subrequests_time = subrequests_time + child.getcollector('time').events.__section__.duration %} {% endfor %} {% else %} {% set subrequests_time = 'n/a' %} {% endif %}
{{ subrequests_time }} ms Sub-Request{{ profile.children|length > 1 ? 's' }} time
{% endif %}

Execution timeline

{% if not collector.isStopwatchInstalled() %}

The Stopwatch component is not installed. If you want to see timing events, run: composer require symfony/stopwatch.

{% elseif collector.events is empty %}

No timing events have been recorded. Check that symfony/stopwatch is installed and debugging enabled in the kernel.

{% else %} {{ block('panelContent') }} {% endif %} {% endblock %} {% block panelContent %}
ms (timeline only displays events with a duration longer than this threshold)
{% if profile.parent %}

Sub-Request {{ profiler_dump(profile.getcollector('request').requestattributes.get('_controller')) }} {{ collector.events.__section__.duration }} ms Return to parent request

{% elseif profile.children|length > 0 %}

Main Request {{ collector.events.__section__.duration }} ms

{% endif %} {{ helper.display_timeline(token, collector.events, collector.events.__section__.origin) }} {% if profile.children|length %}

Note: sections with a striped background correspond to sub-requests.

Sub-requests ({{ profile.children|length }})

{% for child in profile.children %} {% set events = child.getcollector('time').events %}

{{ child.getcollector('request').identifier }} {{ events.__section__.duration }} ms

{{ helper.display_timeline(child.token, events, collector.events.__section__.origin) }} {% endfor %} {% endif %} {% endblock %} {% macro dump_request_data(token, events, origin) %} {% autoescape 'js' %} {% from _self import dump_events %} { id: "{{ token }}", left: {{ "%F"|format(events.__section__.origin - origin) }}, end: "{{ '%F'|format(events.__section__.endtime) }}", events: [ {{ dump_events(events) }} ], } {% endautoescape %} {% endmacro %} {% macro dump_events(events) %} {% autoescape 'js' %} {% for name, event in events %} {% if '__section__' != name %} { name: "{{ name }}", category: "{{ event.category }}", origin: {{ "%F"|format(event.origin) }}, starttime: {{ "%F"|format(event.starttime) }}, endtime: {{ "%F"|format(event.endtime) }}, duration: {{ "%F"|format(event.duration) }}, memory: {{ "%.1F"|format(event.memory / 1024 / 1024) }}, elements: {}, periods: [ {%- for period in event.periods -%} { start: {{ "%F"|format(period.starttime) }}, end: {{ "%F"|format(period.endtime) }}, duration: {{ "%F"|format(period.duration) }}, elements: {} }, {%- endfor -%} ], }, {% endif %} {% endfor %} {% endautoescape %} {% endmacro %} {% macro display_timeline(token, events, origin) %} {% import _self as helper %}
{% endmacro %}