Skip to content

Commit

Permalink
Merge pull request joerick#294 from gnuille/print-flat
Browse files Browse the repository at this point in the history
Add flat argument to print to Profiler.print()
  • Loading branch information
joerick committed Jun 27, 2024
2 parents 420768e + 386a727 commit b364e53
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyinstrument/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ def print(
color: bool | None = None,
show_all: bool = False,
timeline: bool = False,
flat: bool = False,
):
"""print(file=sys.stdout, *, unicode=None, color=None, show_all=False, timeline=False)
"""print(file=sys.stdout, *, unicode=None, color=None, show_all=False, timeline=False, flat=False)
Print the captured profile to the console.
Expand All @@ -268,6 +269,7 @@ def print(
:param color: Override ANSI color support detection.
:param show_all: Sets the ``show_all`` parameter on the renderer.
:param timeline: Sets the ``timeline`` parameter on the renderer.
:param flat: Sets the ``flat`` parameter on the renderer.
"""
if unicode is None:
unicode = file_supports_unicode(file)
Expand All @@ -280,6 +282,7 @@ def print(
color=color,
show_all=show_all,
timeline=timeline,
flat=flat,
),
file=file,
)
Expand All @@ -290,13 +293,14 @@ def output_text(
color: bool = False,
show_all: bool = False,
timeline: bool = False,
flat: bool = False,
) -> str:
"""
Return the profile output as text, as rendered by :class:`ConsoleRenderer`
"""
return self.output(
renderer=renderers.ConsoleRenderer(
unicode=unicode, color=color, show_all=show_all, timeline=timeline
unicode=unicode, color=color, show_all=show_all, timeline=timeline, flat=flat
)
)

Expand Down

0 comments on commit b364e53

Please sign in to comment.