Circuitscape/Circuitscape — pull request #22 by tanmaykm (2013-11-13 10:49:24+00:00)
Title: profiling improvements. refer #12

This replaces the existing `print_timing` decorator with `print_rusage` that prints additional information based on a new configuration flag `print_rusages`. If just `print_timings` is `True` it just logs elapsed times as before.

It now uses python logging with a separate logger named `circuitscape.profile`. It can be redirected to a separate file when required.

Uses the built in `resource` package by default, but can give more info if the `psutil` package (https://code.google.com/p/psutil/) is installed. Items logged:
- cpu times: user, system and elapsed
- memory: maxrss (max resident set), shared (includes code segment), heap, stack
- io: read_count, write_count, read_bytes, write_bytes

Only changes in the above attributes after the method call are logged. Logging of absolute values can be added if useful.