Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix to sampling profiler when memory is turned off.

Test Plan: Load the homepage with sampling profiler, with and without memory sampling.

Reviewers: alan

Reviewed By: alan

Differential Revision: http://phabricator.khanacademy.org/D10850
  • Loading branch information...
commit 7a5fd0b07835861f9a7de00a13ad69472adaf979 1 parent 77d0e3b
@benjaminjkraft benjaminjkraft authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 sampling_profiler.py
View
12 sampling_profiler.py
@@ -198,17 +198,21 @@ def results(self):
Profile.annotate_prev_samples(samples, 'next_memory_sample_index',
rev=True)
- return {
+ results = {
"frame_names": [
util.short_method_fmt(frame) for frame in frames],
"samples": samples,
"total_samples": total_samples,
- # We always take a memory sample at the end, so the following
- # are safe.
+ }
+
+ if self.memory_sample_every and self.memory_samples:
+ results.update({
"start_memory": round(self.memory_samples.values()[0], 2),
"max_memory": round(max(self.memory_samples.values()), 2),
"end_memory": round(self.memory_samples.values()[-1], 2),
- }
+ })
+
+ return results
@staticmethod
def annotate_prev_samples(samples, key, rev=False):
Please sign in to comment.
Something went wrong with that request. Please try again.