Skip to content

Commit 6c77514

Browse files
author
fanzuquan
committed
fit plotting data to xlim
1 parent eed3447 commit 6c77514

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎mprof.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,18 @@ def plot_file(filename, index=0, timestamps=True, children=True, options=None):
430430

431431
mem = np.asarray(mem)
432432
t = np.asarray(t)
433+
global_start = t[0]
434+
t = t - global_start
435+
436+
if options.xlim is not None:
437+
cond = (t >= options.xlim[0]) & (t <= options.xlim[1])
438+
mem, t = mem[cond], t[cond]
439+
433440
ind = t.argsort()
434441
mem = mem[ind]
435442
t = t[ind]
436443

437444
# Plot curves
438-
global_start = float(t[0])
439-
t = t - global_start
440-
441445
max_mem = mem.max()
442446
max_mem_ind = mem.argmax()
443447

0 commit comments

Comments
 (0)