Skip to content

Jupyter plugin ignores --render-option=time=percent_of_total #419

@itamarst

Description

@itamarst

Or maybe I'm doing something wrong? I'm trying to have the Jupyter magic automatically render percentages instead of seconds:

Cell 1:

%load_ext pyinstrument
import numpy as np

def create_ones_array():
    return np.ones((1_000_000,), dtype=np.int64)

def do_some_math():
    array = create_ones_array()
    for i in range(1000):
        array2 = create_ones_array()
        array += array2 * array.sum()
    return array

Cell 2:

%%pyinstrument --render-option=time=percent_of_total
_ = do_some_math()

The percent_of_total is ignored. In normal Jupyter I'm getting percentages by default, in Quarto (a publishing system that uses Jupyter under the hood) I'm getting seconds, in either case I can't control the output.

PyInstrument is version 5.1.1.

Also I can't figure out how to get it to have the timeline be selected by default when generating the profile in Jupyter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions