sapling/tests/test-platform.t
Phil Cohen 48219d6c07 log maxxrss from within mercurial
Summary:
An updated version of D8174246 with a test. Max memory usage is very useful to us to understand which commands are using too much memory, and the existing wrapper metrics don't work when chg is used (they measure chg's usage).

Windows support will come later as it is a bit more involved.

Reviewed By: DurhamG

Differential Revision: D8318584

fbshipit-source-id: 323450bc7ab376014d70106beb5d4fdcc7fba0c8
2018-06-07 11:50:46 -07:00

12 lines
362 B
Perl

#require no-windows
Test maxrss() by allocating 300 MB:
>>> from mercurial import util
>>> MEGABYTE = 1024 ** 2
>>> start = util.getmaxrss()
>>> a = bytearray(300 * MEGABYTE)
>>> assert start + 300 * MEGABYTE <= util.getmaxrss() < start + 400 * MEGABYTE
>>> a = None
>>> assert start + 300 * MEGABYTE <= util.getmaxrss() < start + 400 * MEGABYTE