{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% from _self import display_timeline, dump_request_data %} {% if colors is not defined %} {% set colors = { 'default': '#aacd4e', 'section': '#666', 'event_listener': '#3dd', 'event_listener_loading': '#add', 'template': '#dd3', 'doctrine': '#d3d', 'propel': '#f4d', 'child_sections': '#eed', } %} {% endif %} {% block toolbar %} {% set duration = collector.events|length ? '%.0f ms'|format(collector.duration) : 'n/a' %} {% set icon %} {{ duration }} {% endset %} {% set text %}
Total time {{ duration }}
{% endset %} {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url } %} {% endblock %} {% block menu %} Timeline {% endblock %} {% block panel %}

Timeline

{% if collector.events|length %} {{ block('panelContent') }} {% else %}

No timing events have been recorded. Are you sure that debugging is enabled in the kernel?

{% endif %} {% endblock %} {% block panelContent %}
Total time {{ '%.0f'|format(collector.duration) }} ms
Initialization time {{ '%.0f'|format(collector.inittime) }} ms
Threshold ms

{{ profile.parent ? "Request" : "Main Request" }} - {{ collector.events.__section__.duration }} ms {% if profile.parent %} - parent {% endif %}

{{ display_timeline('timeline_' ~ token, collector.events, colors) }} {% if profile.children|length %} {% for child in profile.children %} {% set events = child.getcollector('time').events %}

Sub-request "{{ child.getcollector('request').requestattributes.get('_controller') }}" - {{ events.__section__.duration }} ms

{{ 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 %}