{% if stats %} {% for function_result in stats %}

{{ function_result.func_name }} in {{ function_result.filename }}:{{ function_result.start_lineno }}

Total Time: {{ "%.2f"|format(function_result.total_time) }} ms {% for lineno, line, timing, nhits in function_result.timings %} {% set perc = 100 * timing/function_result.total_time %} {% if perc > 10 %} {% set tr_class = 'red10' %} {% elif perc > 1 %} {% set tr_class = 'red1' %} {% elif lineno % 2 == 0 %} {% set tr_class = 'even' %} {% else %} {% set tr_class = 'odd' %} {% endif %} {% endfor %}
    % Time Time (ms) Hits
{{ lineno }}
{{ line }}
{{ "%.1f"|format(perc) }} {{ "%.1f"|format(timing) }} {{ nhits }}
{% endfor %} {% endif %}

Usage Instructinos

from flask_debugtoolbar_lineprofilerpanel.profile import line_profile

# Using it as a decorator
@app.route('/profile')
@line_profile
def profile_page():
    ...
    return flask.render_template('profile_page')

# Explicit argument
line_profile(some_function)