未验证 提交 194d16c1 编写于 作者: K kuizhiqing 提交者: GitHub

[Profiler] add views in summary API (#45225)

* add views in summary api

* add args in the last position
上级 1aa6adb1
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
from .profiler import ProfilerState, ProfilerTarget from .profiler import ProfilerState, ProfilerTarget
from .profiler import make_scheduler, export_chrome_tracing, export_protobuf from .profiler import make_scheduler, export_chrome_tracing, export_protobuf
from .profiler import Profiler from .profiler import Profiler
from .profiler import SummaryView
from .profiler import TracerEventType from .profiler import TracerEventType
from .utils import RecordEvent, load_profiler_result from .utils import RecordEvent, load_profiler_result
from .profiler_statistic import SortedKeys from .profiler_statistic import SortedKeys
...@@ -22,5 +23,5 @@ from .profiler_statistic import SortedKeys ...@@ -22,5 +23,5 @@ from .profiler_statistic import SortedKeys
__all__ = [ __all__ = [
'ProfilerState', 'ProfilerTarget', 'make_scheduler', 'ProfilerState', 'ProfilerTarget', 'make_scheduler',
'export_chrome_tracing', 'export_protobuf', 'Profiler', 'RecordEvent', 'export_chrome_tracing', 'export_protobuf', 'Profiler', 'RecordEvent',
'load_profiler_result', 'SortedKeys' 'load_profiler_result', 'SortedKeys', 'SummaryView'
] ]
...@@ -34,6 +34,22 @@ from paddle.profiler import utils ...@@ -34,6 +34,22 @@ from paddle.profiler import utils
from .timer import benchmark 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): class ProfilerState(Enum):
r""" r"""
ProfilerState is used to present the state of :ref:`Profiler <api_paddle_profiler_Profiler>` . ProfilerState is used to present the state of :ref:`Profiler <api_paddle_profiler_Profiler>` .
...@@ -734,7 +750,8 @@ class Profiler: ...@@ -734,7 +750,8 @@ class Profiler:
sorted_by=SortedKeys.CPUTotal, sorted_by=SortedKeys.CPUTotal,
op_detail=True, op_detail=True,
thread_sep=False, thread_sep=False,
time_unit='ms'): time_unit='ms',
views=None):
r""" r"""
Print the Summary table. Currently support overview, model, distributed, operator, memory manipulation and userdefined summary. Print the Summary table. Currently support overview, model, distributed, operator, memory manipulation and userdefined summary.
...@@ -743,6 +760,7 @@ class Profiler: ...@@ -743,6 +760,7 @@ class Profiler:
op_detail(bool, optional): expand each operator detail information, default value is True. 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. 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'. 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: Examples:
.. code-block:: python .. code-block:: python
...@@ -770,7 +788,8 @@ class Profiler: ...@@ -770,7 +788,8 @@ class Profiler:
sorted_by=sorted_by, sorted_by=sorted_by,
op_detail=op_detail, op_detail=op_detail,
thread_sep=thread_sep, thread_sep=thread_sep,
time_unit=time_unit)) time_unit=time_unit,
views=views))
def get_profiler(config_path): def get_profiler(config_path):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册