[tools/memory] Add a tool to track IOSurface memory usage

IOSurfaces are used for GPU rendering. Using vmmap PID on macOS, one can
get all the surfaces, along with their characteristics.
The added tool does that.

Sample output:

IOSurfaces sorted by width:
	IOSurface(start=4514004992, end=4514054144, virtual=49152, resident=49152, dirty=49152, swapped=0, width=1, height=280, size=35840)
	IOSurface(start=4500996096, end=4501061632, virtual=65536, resident=0, dirty=0, swapped=65536, width=15, height=450, size=57344)
	IOSurface(start=4505305088, end=4505370624, virtual=65536, resident=0, dirty=0, swapped=65536, width=15, height=456, size=58368)
	IOSurface(start=4531732480, end=4531798016, virtual=65536, resident=0, dirty=0, swapped=65536, width=15, height=456, size=58368)
[...]

Memory lost due to page rounding = 5.1MiB
Dirty Memory = 173.4MiB
Swapped Memory = 732.6MiB

Showing that the process is using close to 1GiB of IOSurfaces, with more
than 700MiB swapped.

Change-Id: I2d3410228fce732ee1b3ed3905bd25cf6e75d727
Bug: 1298417
TBR: thestig # Per instructions in //tools/OWNERS
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3610117
Reviewed-by: Thiabaud Engelbrecht <thiabaud@google.com>
Commit-Queue: Benoit Lize <lizeb@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1007568}
NOKEYCHECK=True
GitOrigin-RevId: e61837e86514559aefde30e6b45a6e4569ca413f
2 files changed
tree: e1506ce85448f1d5db52780321fcd9cfa9918b29
  1. asan/
  2. mac/
  3. partition_allocator/
  4. tsan_v2/
  5. OWNERS