{% extends "silk/base/detail_base.html" %}
{% load silk_filters %}
{% load silk_nav %}
{% load silk_inclusion %}
{% load static %}

{% block pagetitle %}Silky - CProfile - {{ silk_request.path }}{% endblock %}

{% block js %}
    <script type="text/javascript" src="{% static 'silk/lib/viz-lite.js' %}"></script>
    <script type="text/javascript" src="{% static 'silk/lib/svg-pan-zoom.min.js' %}"></script>
    {{ block.super }}
{% endblock %}

{% block style %}
    {{ block.super }}
    <link rel="stylesheet" href="{% static 'silk/css/pages/cprofile.css' %}">
{% endblock %}

{% block menu %}
    {% request_menu request silk_request %}
{% endblock %}

{% block data %}
<div class="silk-detail-page">

    {% if silk_request.pyprofile %}
    <section class="silk-section">
        <h3 class="silk-section__heading">
            <i data-lucide="bar-chart-2" class="silk-icon silk-icon--sm"></i> CProfile Output
        </h3>
        <p class="silk-detail-note">
            Raw dump from the cPython profiler.
            {% if silk_request.prof_file %}
            <a href="{% url 'silk:request_profile_download' request_id=silk_request.pk %}">Download .prof file</a>
            {% endif %}
        </p>
        <pre class="silk-pre silk-pre--wide">{{ silk_request.pyprofile }}</pre>
    </section>
    {% else %}
    <div class="silk-empty">
        <div class="silk-empty__icon"><i data-lucide="bar-chart-2" class="silk-icon silk-icon--large"></i></div>
        <p class="silk-empty__title">No CProfile data</p>
        <p class="silk-empty__desc">Enable <code>SILKY_PYTHON_PROFILER = True</code> to capture profiling data.</p>
    </div>
    {% endif %}

</div>
{% endblock %}
