Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #170 #171

Merged
merged 1 commit into from
Mar 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions silk/templates/silk/profile_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@
font-size: 13px;

}

a {
color: #45ADA8;
}

a:visited {
color: #45ADA8;
}

a:hover {
color: #547980;
}

a:active {
color: #594F4F;
}
</style>
{% endblock %}

Expand Down Expand Up @@ -54,6 +70,19 @@
</div>
{% endif %}

{% if silk_request.pyprofile %}
<div class="heading">
<div class="inner-heading">Python Profiler</div>
</div>
<div class="description">
The below is a dump from the cPython profiler.
</div>
{% if silk_request.prof_file %}
Click <a href="{% url 'silk:request_profile_download' request_id=silk_request.pk %}">here</a> to download profile.
{% endif %}
<pre class="pyprofile">{{ silk_request.pyprofile }}</pre>
{% endif %}

</div>
</div>

Expand Down
11 changes: 0 additions & 11 deletions silk/templates/silk/profiling.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,4 @@ <h2>Silk Profiler</h2>
</div>
</div>
{% endif %}

{% if silk_request.pyprofile %}
<div class="container">
<h2>Python Profiler</h2>
{% if silk_request.prof_file %}
<a href="{% url "silk:request_profile_download" request_id=silk_request.pk %}" style="float:right;"><button>Download Binary cProfile Data</button></a>
{% endif %}
<div class="description">The below is a dump from the cPython profiler.</div>
<pre class="pyprofile">{{ silk_request.pyprofile }}</pre>
</div>
{% endif %}
{% endblock %}
8 changes: 3 additions & 5 deletions silk/views/profile_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.utils.decorators import method_decorator
from django.views.generic import View
from silk.auth import login_possibly_required, permissions_possibly_required
from silk.models import Profile, Request
from silk.models import Profile
from silk.views.sql_detail import _code


Expand All @@ -12,7 +12,6 @@ class ProfilingDetailView(View):
@method_decorator(permissions_possibly_required)
def get(self, request, *_, **kwargs):
profile_id = kwargs['profile_id']
silk_request_id = kwargs.get('request_id', None)
context = {
'request': request
}
Expand All @@ -22,9 +21,8 @@ def get(self, request, *_, **kwargs):
context['profile'] = profile
context['line_num'] = file_path
context['file_path'] = line_num
if silk_request_id:
silk_request = Request.objects.get(pk=silk_request_id)
context['silk_request'] = silk_request
if profile.request:
context['silk_request'] = profile.request
if file_path and line_num:
try:
actual_line, code = _code(file_path, line_num, profile.end_line_num)
Expand Down