Extract print_model() methods to DataModel.print()
This commit is contained in:
parent
c12488ecf9
commit
7347900349
7 changed files with 37 additions and 23 deletions
|
@ -69,7 +69,7 @@
|
|||
"# Process\n",
|
||||
"events = load_file(converted_file_path)\n",
|
||||
"handler = Ros2Handler.process(events)\n",
|
||||
"#handler.data.print_model()"
|
||||
"#handler.data.print()"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -25,3 +25,7 @@ class DataModel():
|
|||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
def print(self) -> None:
|
||||
"""Print the data model."""
|
||||
return None
|
||||
|
|
|
@ -51,9 +51,9 @@ class CpuTimeDataModel(DataModel):
|
|||
}
|
||||
self.times = self.times.append(data, ignore_index=True)
|
||||
|
||||
def print_model(self) -> None:
|
||||
"""Debug method to print every contained df."""
|
||||
def print(self) -> None:
|
||||
print('====================CPU TIME DATA MODEL====================')
|
||||
tail = 20
|
||||
print(f'Times (tail={tail}):\n{self.times.tail(tail).to_string()}')
|
||||
print(f'Times (tail={tail}):')
|
||||
print(self.times.tail(tail).to_string())
|
||||
print('===========================================================')
|
||||
|
|
|
@ -61,9 +61,9 @@ class ProfileDataModel(DataModel):
|
|||
}
|
||||
self.times = self.times.append(data, ignore_index=True)
|
||||
|
||||
def print_model(self) -> None:
|
||||
"""Debug method to print every contained df."""
|
||||
def print(self) -> None:
|
||||
print('====================PROFILE DATA MODEL====================')
|
||||
tail = 20
|
||||
print(f'Times (tail={tail}):\n{self.times.tail(tail).to_string()}')
|
||||
print(f'Times (tail={tail}):')
|
||||
print(self.times.tail(tail).to_string())
|
||||
print('==========================================================')
|
||||
|
|
|
@ -154,28 +154,38 @@ class Ros2DataModel(DataModel):
|
|||
}
|
||||
self.callback_instances = self.callback_instances.append(data, ignore_index=True)
|
||||
|
||||
def print_model(self) -> None:
|
||||
"""Debug method to print every contained df."""
|
||||
print('====================ROS DATA MODEL====================')
|
||||
print(f'Contexts:\n{self.contexts.to_string()}')
|
||||
def print(self) -> None:
|
||||
print('====================ROS 2 DATA MODEL===================')
|
||||
print('Contexts:')
|
||||
print(self.contexts.to_string())
|
||||
print()
|
||||
print(f'Nodes:\n{self.nodes.to_string()}')
|
||||
print('Nodes:')
|
||||
print(self.nodes.to_string())
|
||||
print()
|
||||
print(f'Publishers:\n{self.publishers.to_string()}')
|
||||
print('Publishers:')
|
||||
print(self.publishers.to_string())
|
||||
print()
|
||||
print(f'Subscriptions:\n{self.subscriptions.to_string()}')
|
||||
print('Subscriptions:')
|
||||
print(self.subscriptions.to_string())
|
||||
print()
|
||||
print(f'Subscription objects:\n{self.subscription_objects.to_string()}')
|
||||
print('Subscription objects:')
|
||||
print(self.subscription_objects.to_string())
|
||||
print()
|
||||
print(f'Services:\n{self.services.to_string()}')
|
||||
print('Services:')
|
||||
print(self.services.to_string())
|
||||
print()
|
||||
print(f'Clients:\n{self.clients.to_string()}')
|
||||
print('Clients:')
|
||||
print(self.clients.to_string())
|
||||
print()
|
||||
print(f'Timers:\n{self.timers.to_string()}')
|
||||
print('Timers:')
|
||||
print(self.timers.to_string())
|
||||
print()
|
||||
print(f'Callback objects:\n{self.callback_objects.to_string()}')
|
||||
print('Callback objects:')
|
||||
print(self.callback_objects.to_string())
|
||||
print()
|
||||
print(f'Callback symbols:\n{self.callback_symbols.to_string()}')
|
||||
print('Callback symbols:')
|
||||
print(self.callback_symbols.to_string())
|
||||
print()
|
||||
print(f'Callback instances:\n{self.callback_instances.to_string()}')
|
||||
print('Callback instances:')
|
||||
print(self.callback_instances.to_string())
|
||||
print('==================================================')
|
||||
|
|
|
@ -137,7 +137,7 @@ def process(
|
|||
ros2_handler = Ros2Handler.process(events)
|
||||
|
||||
time_diff = time.time() - start_time
|
||||
ros2_handler.data.print_model()
|
||||
ros2_handler.data.print()
|
||||
print(f'processed {len(events)} events in {time_diff_to_str(time_diff)}')
|
||||
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ class DependencySolver():
|
|||
|
||||
|
||||
class Processor():
|
||||
"""Base processor class."""
|
||||
"""Processor class, which dispatches events to event handlers."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue