Skip to content

Commit a24ad12

Browse files
author
Jake Schmidt
committed
add backend options to mprof run
1 parent 4fbd124 commit a24ad12

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

mprof.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ 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+
help="Current supported backends: 'psutil', 'psutil_pss', 'psutil_uss', 'posix', 'tracemalloc'")
217219
parser.add_argument("program", nargs=REMAINDER,
218220
help='Option 1: "<EXECUTABLE> <ARG1> <ARG2>..." - profile executable\n'
219221
'Option 2: "<PYTHON_SCRIPT> <ARG1> <ARG2>..." - profile python script\n'
@@ -279,7 +281,7 @@ def run_action():
279281
f.write("CMDLINE {0}\n".format(cmd_line))
280282
mp.memory_usage(proc=p, interval=args.interval, timeout=args.timeout, timestamps=True,
281283
include_children=args.include_children,
282-
multiprocess=args.multiprocess, stream=f)
284+
multiprocess=args.multiprocess, stream=f, backend=args.backend)
283285

284286
if args.exit_code:
285287
if p.returncode != 0:

0 commit comments

Comments
 (0)