'Return a dict of various numbers (ints or floats).  The
.timer command shows the difference between before and after
results of what this returns by calling :meth:`display_timing`'

def get_resource_usage(self):

    if (sys.platform == 'win32'):
        import ctypes, time, platform
        ctypes.windll.kernel32.GetProcessTimes.argtypes = [(((platform.architecture()[0] == '64bit') and ctypes.c_int64) or ctypes.c_int32), ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
        dummy = ctypes.c_ulonglong()
        utime = ctypes.c_ulonglong()
        stime = ctypes.c_ulonglong()
        rc = ctypes.windll.kernel32.GetProcessTimes(ctypes.windll.kernel32.GetCurrentProcess(), ctypes.byref(dummy), ctypes.byref(dummy), ctypes.byref(stime), ctypes.byref(utime))
        if rc:
            return {'Wall    clock': time.time(), 'User    time': (float(utime.value) / 10000000), 'System    time': (float(stime.value) / 10000000)}
        return {}
    else:
        import resource, time
        r = resource.getrusage(resource.RUSAGE_SELF)
        res = {'Wall    clock': time.time()}
        for (i, desc) in (('utime', 'User    time'), ('stime', 'System    time'), ('maxrss', 'Max    rss'), ('idrss', 'Memory'), ('isrss', 'Stack'), ('ixrss', 'Shared    Memory'), ('minflt', 'PF    (no    I/O)'), ('majflt', 'PF    (I/O)'), ('inblock', 'Blocks    in'), ('oublock', 'Blocks    out'), ('nsignals', 'Signals'), ('nvcsw', 'Voluntary    context    switches'), ('nivcsw', 'Involunary    context    switches'), ('msgrcv', 'Messages    received'), ('msgsnd', 'Messages    sent'), ('nswap', 'Swaps')):
            f = ('ru_' + i)
            if hasattr(r, f):
                res[desc] = getattr(r, f)
        return res
