mozilla/servo — pull request #2720 by nnethercote (2014-06-26 05:32:19+00:00)
Title: Add a basic memory profiler, invoked with -m.

This adds a basic memory profiler. It's invoked with the -m option. Sample
output:

> _category_ : _size (MiB)_
> vsize : 1355.47
> resident : 50.85

It currently only works on Linux. On other platforms, "???" will be printed
instead.

I chose to make the memory profiler entirely separate from the existing
profiler, as opposed to augmenting it. They are/will be different enough beasts
that this seemed the right thing to do. But it did result in a bit of copy &
pasting. And if you run with both -p and -m, the output can be interleaved,
which isn't ideal.

Something I didn't do, which might make sense, is to rename Profiler (and all
related names) as TimeProfiler. That name would nicely match the |time| module
name.

The option_try! macro might be a useful thing to add to Rust's std::macros.