Add max_usage and retval kwargs to memory_usage()

The max_usage parameter modifies the behavior of the function so that it
only keeps track of the peak mem usage over the duration of the
profiling. This is useful for profiling very long running processes.

The retval parameter is for profiling Python functions. If set, the
return value of the profiled function will be kept and returned in a
tuple along with the memory usage.

Signed-off-by: cheesinglee <cheesinglee@gmail.com>
Minor changes

Fixed stupid copy-paste error in external process part of memory_usage()

Add ret to docstring of memory_usage()

Signed-off-by: cheesinglee <cheesinglee@gmail.com>
Units of getrusage() seem to be different in OSX
test refactoring