Skip to content

Commit a192388

Browse files
fix: handle child processes
1 parent 4a0f9de commit a192388

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mprof.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,13 +841,17 @@ def peak_action():
841841
such file in the current directory."""
842842
parser = ArgumentParser(usage="mprof peak [options] [file.dat]", description=desc)
843843
parser.add_argument("profiles", nargs="*",
844-
help="profiles made by mprof run")
844+
help="profiles made by mprof run")
845845
args = parser.parse_args()
846846
filenames = get_profiles(args)
847847

848848
for filename in filenames:
849849
prof = read_mprofile_file(filename)
850850
print("{}\t{:.3f} MiB".format(prof["filename"], max(prof["mem_usage"])))
851+
for child, values in prof["children"].items():
852+
child_peak = max([ mem_ts[0] for mem_ts in values ])
853+
print(" Child {}\t\t\t{:.3f} MiB".format(child, child_peak))
854+
851855

852856
def get_profiles(args):
853857
profiles = glob.glob("mprofile_??????????????.dat")

0 commit comments

Comments
 (0)