Skip to content

Commit 70615bc

Browse files
authored
Merge pull request #333 from schmidt-jake/add-mprof-backends
Add backend options to `mprof run`
2 parents 4fbd124 + 02663cb commit 70615bc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

mprof.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ def run_action():
214214
help="""File to store results in, defaults to 'mprofile_<YYYYMMDDhhmmss>.dat' in the current directory,
215215
(where <YYYYMMDDhhmmss> is the date-time of the program start).
216216
This file contains the process memory consumption, in Mb (one value per line).""")
217+
parser.add_argument("--backend", dest="backend", choices=["psutil", "psutil_pss", "psutil_uss", "posix", "tracemalloc"],
218+
default="psutil",
219+
help="Current supported backends: 'psutil', 'psutil_pss', 'psutil_uss', 'posix', 'tracemalloc'. Defaults to 'psutil'.")
217220
parser.add_argument("program", nargs=REMAINDER,
218221
help='Option 1: "<EXECUTABLE> <ARG1> <ARG2>..." - profile executable\n'
219222
'Option 2: "<PYTHON_SCRIPT> <ARG1> <ARG2>..." - profile python script\n'
@@ -279,7 +282,7 @@ def run_action():
279282
f.write("CMDLINE {0}\n".format(cmd_line))
280283
mp.memory_usage(proc=p, interval=args.interval, timeout=args.timeout, timestamps=True,
281284
include_children=args.include_children,
282-
multiprocess=args.multiprocess, stream=f)
285+
multiprocess=args.multiprocess, stream=f, backend=args.backend)
283286

284287
if args.exit_code:
285288
if p.returncode != 0:

0 commit comments

Comments
 (0)