Skip to content

Commit

Permalink
Fixes jazzband#170
Browse files Browse the repository at this point in the history
  • Loading branch information
perdy committed Mar 15, 2017
1 parent 92eab7e commit 8102e8a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
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 %}
6 changes: 2 additions & 4 deletions silk/views/profile_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8102e8a

Please sign in to comment.