{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% import _self as helper %} {% if colors is not defined %} {% set colors = { 'default': '#999', 'section': '#444', 'event_listener': '#00B8F5', 'template': '#66CC00', 'doctrine': '#FF6633', } %} {% endif %} {% 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 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('timeline_' ~ token, collector.events, colors) }} {% 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('timeline_' ~ child.token, events, colors) }} {% endfor %} {% endif %} {% endblock %} {% macro dump_request_data(token, profile, events, origin) %} {% autoescape 'js' %} {% from _self import dump_events %} { "id": "{{ token }}", "left": {{ "%F"|format(events.__section__.origin - origin) }}, "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) }}, "periods": [ {%- for period in event.periods -%} {"start": {{ "%F"|format(period.starttime) }}, "end": {{ "%F"|format(period.endtime) }}}{{ loop.last ? '' : ', ' }} {%- endfor -%} ] }{{ loop.last ? '' : ',' }} {% endif %} {% endfor %} {% endautoescape %} {% endmacro %} {% macro display_timeline(id, events, colors) %}
{% for category, color in colors %} {{ category }} {% endfor %}
{% endmacro %}