Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mem_max_rss measurement on macOS #173

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions pyperf/_collect_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
get_logical_cpu_count, format_cpu_infos,
set_cpu_affinity)
from pyperf._formatter import format_timedelta, format_datetime
from pyperf._process_time import get_max_rss
from pyperf._utils import (MS_WINDOWS,
open_text, read_first_line, sysfs_path, proc_path)
if MS_WINDOWS:
Expand Down Expand Up @@ -199,10 +200,7 @@ def collect_system_metadata(metadata):

def collect_memory_metadata(metadata):
if resource is not None:
usage = resource.getrusage(resource.RUSAGE_SELF)
max_rss = usage.ru_maxrss
if max_rss:
metadata['mem_max_rss'] = max_rss * 1024
metadata["mem_max_rss"] = get_max_rss()

# Note: Don't collect VmPeak of /proc/self/status on Linux because it is
# not accurate. See pyperf._linux_memory for more accurate memory metrics.
Expand Down
Loading