Include parent function name in profiling data

This commit is contained in:
Christophe Bedard 2019-08-02 10:36:49 +02:00
parent e1446f36aa
commit bb0b4049f7
2 changed files with 5 additions and 0 deletions

View file

@ -29,6 +29,7 @@ class ProfileDataModel(DataModel):
'tid',
'depth',
'function_name',
'parent_name',
'start_timestamp',
'duration',
])
@ -38,6 +39,7 @@ class ProfileDataModel(DataModel):
tid: int,
depth: int,
function_name: str,
parent_name: str,
start_timestamp: int,
duration: int,
) -> None:
@ -45,6 +47,7 @@ class ProfileDataModel(DataModel):
'tid': tid,
'depth': depth,
'function_name': function_name,
'parent_name': parent_name,
'start_timestamp': start_timestamp,
'duration': duration,
}

View file

@ -99,11 +99,13 @@ class ProfileHandler(EventHandler):
function_depth = len(tid_functions) - 1
(start_timestamp, start_function_name) = tid_functions.pop()
# Add to data model
parent_name = tid_functions[-1][1] if function_depth > 0 else None
duration = metadata.timestamp - start_timestamp
self._data.add_duration(
tid,
function_depth,
start_function_name,
parent_name,
start_timestamp,
duration
)