Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Profiler] add views in summary API #45225

Merged
merged 2 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion python/paddle/profiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
from .profiler import ProfilerState, ProfilerTarget
from .profiler import make_scheduler, export_chrome_tracing, export_protobuf
from .profiler import Profiler
from .profiler import SummaryView
from .profiler import TracerEventType
from .utils import RecordEvent, load_profiler_result
from .profiler_statistic import SortedKeys

__all__ = [
'ProfilerState', 'ProfilerTarget', 'make_scheduler',
'export_chrome_tracing', 'export_protobuf', 'Profiler', 'RecordEvent',
'load_profiler_result', 'SortedKeys'
'load_profiler_result', 'SortedKeys', 'SummaryView'
]
23 changes: 21 additions & 2 deletions python/paddle/profiler/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@
from .timer import benchmark


class SummaryView(Enum):
r"""
SummaryView define the summary view of different contents.

"""
DeviceView = 0
OverView = 1
ModelView = 2
DistributedView = 3
KernelView = 4
OperatorView = 5
MemoryView = 6
MemoryManipulationView = 7
UDFView = 8


class ProfilerState(Enum):
r"""
ProfilerState is used to present the state of :ref:`Profiler <api_paddle_profiler_Profiler>` .
Expand Down Expand Up @@ -734,7 +750,8 @@ def summary(self,
sorted_by=SortedKeys.CPUTotal,
op_detail=True,
thread_sep=False,
time_unit='ms'):
time_unit='ms',
views=None):
r"""
Print the Summary table. Currently support overview, model, distributed, operator, memory manipulation and userdefined summary.

Expand All @@ -743,6 +760,7 @@ def summary(self,
op_detail(bool, optional): expand each operator detail information, default value is True.
thread_sep(bool, optional): print op table each thread, default value is False.
time_unit(str, optional): time unit for display, can be chosen form ['s', 'ms', 'us', 'ns'], default value is 'ms'.
views(list[SummaryView], optional): summary tables to print, default to None means all views to be printed.

Examples:
.. code-block:: python
Expand Down Expand Up @@ -770,7 +788,8 @@ def summary(self,
sorted_by=sorted_by,
op_detail=op_detail,
thread_sep=thread_sep,
time_unit=time_unit))
time_unit=time_unit,
views=views))


def get_profiler(config_path):
Expand Down
Loading