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
Fix for issue #52

module resource seems to give wrong measurements on some
cases.
Merge remote branch 'fabianp/master' into mprofile

Conflicts:
	memory_profiler.py
	test/test_loop.py

The resulting code has been only lightly tested. The new "max_usage" keyword
has not been tested, in particular.