Skip to content

Exporting start_time in InstructionEvent to Inspector #10295

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions devtools/inspector/_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ class Event:
_delegate_time_scale_converter: Optional[
Callable[[Union[int, str], Union[int, float]], Union[int, float]]
] = None
_start_time: Optional[List[Union[int, float]]] = None

@cached_property
def delegate_debug_metadatas(self) -> Union[List[str], Dict[str, Any]]:
Expand All @@ -352,6 +353,13 @@ def raw_delegate_debug_metadatas(self) -> List[str]:
"""
return self._delegate_debug_metadatas

@property
def start_time(self) -> Optional[List[Union[int, float]]]:
"""
Returns the start time of the event.
"""
return self._start_time

def to_dataframe(self, _units="") -> pd.DataFrame:
"""
Convert the Event into a pandas DataFrame
Expand Down Expand Up @@ -402,6 +410,7 @@ def truncated_list(long_list: List[str]) -> str:
"is_delegated_op": self.is_delegated_op,
"delegate_backend_name": self.delegate_backend_name,
"debug_data": [self.debug_data],
"start_time": [self._start_time],
}

@staticmethod
Expand Down Expand Up @@ -530,6 +539,7 @@ def _populate_profiling_related_fields(

# Fill out fields from profile event
data = []
stime = []
delegate_debug_metadatas = []
for event in events:
if (profile_events := event.profile_events) is not None:
Expand Down Expand Up @@ -571,6 +581,7 @@ def _populate_profiling_related_fields(
)

data.append(scaled_time)
stime.append(profile_event.start_time)
delegate_debug_metadatas.append(
profile_event.delegate_debug_metadata
if profile_event.delegate_debug_metadata
Expand All @@ -583,6 +594,10 @@ def _populate_profiling_related_fields(
if any(delegate_debug_metadatas):
ret_event._delegate_debug_metadatas = delegate_debug_metadatas

# add _start_time to the event
if len(stime) > 0:
ret_event._start_time = stime

@staticmethod
def _populate_debugging_related_fields(
ret_event: "Event",
Expand Down
Loading