diff options
author | Steven Knight <knight@baldmt.com> | 2006-02-12 13:03:27 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2006-02-12 13:03:27 (GMT) |
commit | 8cddc4743be562bac3851eea6aa5b26a3c5370cd (patch) | |
tree | 0eed265a22c740b420618e119f47d84a22011da7 | |
parent | e7bff6aa5ee0f0cbb687ba67cdbc7d696657638c (diff) | |
download | SCons-8cddc4743be562bac3851eea6aa5b26a3c5370cd.zip SCons-8cddc4743be562bac3851eea6aa5b26a3c5370cd.tar.gz SCons-8cddc4743be562bac3851eea6aa5b26a3c5370cd.tar.bz2 |
Support the --debug=memory option on Windows. (Baptiste Lepilleur)
-rw-r--r-- | src/CHANGES.txt | 5 | ||||
-rw-r--r-- | src/engine/SCons/Debug.py | 13 | ||||
-rw-r--r-- | test/option/debug-memory.py | 8 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 754768d..1407e3f 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -126,6 +126,11 @@ RELEASE 0.97 - XXX - Add x64 support for Microsoft Visual Studio 8. + From Baptiste Lepilleur: + + - Support the --debug=memory option on Windows when the Python version + has the win32process and win32api modules. + From Christian Maaser: - Add support for Visual Studio Express Editions. diff --git a/src/engine/SCons/Debug.py b/src/engine/SCons/Debug.py index bb49dbd..cc97fe0 100644 --- a/src/engine/SCons/Debug.py +++ b/src/engine/SCons/Debug.py @@ -98,8 +98,17 @@ else: try: import resource except ImportError: - def memory(): - return 0 + try: + import win32process + import win32api + except ImportError: + def memory(): + return 0 + else: + def memory(): + process_handle = win32api.GetCurrentProcess() + memory_info = win32process.GetProcessMemoryInfo( process_handle ) + return memory_info['PeakWorkingSetSize'] else: def memory(): res = resource.getrusage(resource.RUSAGE_SELF) diff --git a/test/option/debug-memory.py b/test/option/debug-memory.py index 0a2875f..9ed674e 100644 --- a/test/option/debug-memory.py +++ b/test/option/debug-memory.py @@ -39,8 +39,12 @@ test = TestSCons.TestSCons() try: import resource except ImportError: - x = "Python version has no 'resource' module; skipping tests.\n" - test.skip_test(x) + try: + import win32process + import win32api + except ImportError: + x = "Python version has no 'resource' or 'win32api/win32process' module; skipping tests.\n" + test.skip_test(x) |