{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% import _self as helper %} {% set classnames = { 'default': 'timeline-category-default', 'section': 'timeline-category-section', 'event_listener': 'timeline-category-event-listener', 'template': 'timeline-category-template', 'doctrine': 'timeline-category-doctrine', 'messenger.middleware': 'timeline-category-messenger-middleware', 'controller.argument_value_resolver': 'timeline-category-controller-argument-value-resolver', } %} {% 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 %} {{ include('@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 %} {{ include('@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) }} MB 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, classnames, 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, classnames, 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, classnames, events, origin) %} {% import _self as helper %}
{% endmacro %}