|
1 | 1 | """Profile the memory usage of a Python program""" |
2 | 2 |
|
3 | 3 | # .. we'll use this to pass it to the child script .. |
4 | | -_clean_globals = globals().copy() |
| 4 | +_CLEAN_GLOBALS = globals().copy() |
5 | 5 |
|
6 | 6 | __version__ = '0.32' |
7 | 7 |
|
@@ -46,7 +46,7 @@ def _get_memory(pid, timestamps=False, include_children=False): |
46 | 46 | if has_psutil: |
47 | 47 | process = psutil.Process(pid) |
48 | 48 | try: |
49 | | - # avoid useing get_memory_info since it does not exists |
| 49 | + # avoid useing get_memory_info since it does not exists |
50 | 50 | # in psutil > 2.0 and accessing it will cause exception. |
51 | 51 | meminfo_attr = 'memory_info' if hasattr(process, 'memory_info') else 'get_memory_info' |
52 | 52 | mem = getattr(process, meminfo_attr)()[0] / _TWO_20 |
@@ -877,13 +877,13 @@ def flush(self): |
877 | 877 | # script where @profile is used) |
878 | 878 | import __builtin__ |
879 | 879 | __builtin__.__dict__['profile'] = prof |
880 | | - ns = copy(_clean_globals) |
| 880 | + ns = copy(_CLEAN_GLOBALS) |
881 | 881 | ns['profile'] = prof # shadow the profile decorator defined above |
882 | 882 | execfile(__file__, ns, ns) |
883 | 883 | else: |
884 | 884 | import builtins |
885 | 885 | builtins.__dict__['profile'] = prof |
886 | | - ns = copy(_clean_globals) |
| 886 | + ns = copy(_CLEAN_GLOBALS) |
887 | 887 | ns['profile'] = prof # shadow the profile decorator defined above |
888 | 888 | exec(compile(open(__file__).read(), __file__, 'exec'), ns, ns) |
889 | 889 | finally: |
|
0 commit comments