fabianp/memory_profiler — pull request #31 by dreampuf (2013-01-18 05:46:19+00:00)
Title: Add global enable for recursion call

Hi fabinp, thank you for powerful module, and I'm make some change for recursion call profiling.

here is case:

def test_inner_func():
c = dict((i, i*2) for i in xrange(10000))

def inner_func():
inner_c = [1] * 1024 * 1024 * 5
return inner_c

inner_func()

In the `test_inner_func`, I need know profile of every sub call normally. so, i'm add an argument for enable the global switch to do this.

demo:

from memory_profiler import LineProfiler as MemeryProfiler, show_results
mp = MemeryProfiler(enable_global=True)
@mp
def test_inner_func():
c = dict((i, i*2) for i in xrange(10000))

def inner_func():
inner_c = [1] * 1024 * 1024 * 5
return inner_c

del c
inner_func()

import os
dirs = list(os.walk("."))