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