diff options
| author | Travis Oliphant <oliphant@enthought.com> | 2006-05-28 22:08:51 +0000 |
|---|---|---|
| committer | Travis Oliphant <oliphant@enthought.com> | 2006-05-28 22:08:51 +0000 |
| commit | 9da998fd005e4d4774cd7f0152490a5bf8c35c99 (patch) | |
| tree | 05b18272905792a4ac7a2b7237be368d5710e052 | |
| parent | 4a514e0058568c363db0e240d838fe55ecbd30c0 (diff) | |
| download | numpy-0.9.8.tar.gz | |
Remove dependency on win32pdhv0.9.8
| -rw-r--r-- | numpy/testing/utils.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index d95d6a19e..9997e78a7 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -48,7 +48,7 @@ if sys.platform[:5]=='linux': f.close() return int(l[22]) except: - return + raise NotImplementedError else: # os.getpid is not in all platforms available. # Using time is safe but inaccurate, especially when process @@ -62,11 +62,19 @@ else: return int(100*(time.time()-_load_time[0])) def memusage(): """ Return memory usage of running python. [Not implemented]""" - return + raise NotImplementedError + +_have_win32pdh = 0 if os.name=='nt' and sys.version[:3] > '2.3': + try: + import win32pdh + _have_win32pdh = 1 + except: + pass + +if _have_win32pdh: # Code stolen from enthought/debug/memusage.py - import win32pdh # from win32pdhutil, part of the win32all package def GetPerformanceAttributes(object, counter, instance = None, inum=-1, format = win32pdh.PDH_FMT_LONG, machine=None): @@ -92,9 +100,14 @@ if os.name=='nt' and sys.version[:3] > '2.3': win32pdh.CloseQuery(hq) def memusage(processName="python", instance=0): + import win32pdh return GetPerformanceAttributes("Process", "Virtual Bytes", processName, instance, win32pdh.PDH_FMT_LONG, None) +else: + def memusage(): + raise NotImplementedError + def assert_equal(actual,desired,err_msg='',verbose=1): """ Raise an assertion if two items are not |
