Skip to content

Commit

Permalink
Merge pull request #281 from emil-peters/html-show-all
Browse files Browse the repository at this point in the history
Allow for inline show_all in html output
  • Loading branch information
joerick authored Nov 26, 2023
2 parents f53b97e + e7ee144 commit f4294a9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pyinstrument/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,21 @@ def output_text(
)
)

def output_html(self, timeline: bool = False) -> str:
def output_html(self, timeline: bool = False, show_all: bool = False) -> str:
"""
Return the profile output as HTML, as rendered by :class:`HTMLRenderer`
"""
return self.output(renderer=renderers.HTMLRenderer(timeline=timeline))
return self.output(renderer=renderers.HTMLRenderer(timeline=timeline, show_all=show_all))

def write_html(self, path: str | os.PathLike[str], timeline: bool = False):
def write_html(
self, path: str | os.PathLike[str], timeline: bool = False, show_all: bool = False
):
"""
Writes the profile output as HTML to a file, as rendered by :class:`HTMLRenderer`
"""
file = Path(path)
file.write_text(
self.output(renderer=renderers.HTMLRenderer(timeline=timeline)),
self.output(renderer=renderers.HTMLRenderer(timeline=timeline, show_all=show_all)),
encoding="utf-8",
)

Expand Down

0 comments on commit f4294a9

Please sign in to comment.