tracetools_analysis.processor package
Submodules
Module contents
Base processor module.
- class tracetools_analysis.processor.AutoProcessor(events: List[tracetools_read.DictEvent], **kwargs)
Bases:
object
Automatic processor, which takes a list of events and enables all relevant handlers.
It checks each existing EventHandler, and, if its required events are in the events list, it uses that handler.
- static get_applicable_event_handlers(events: List[tracetools_read.DictEvent]) List[EventHandler]
Get applicable EventHandler instances for a list of events.
- Parameters:
events – the list of events
- Returns:
the concrete EventHandler instances which are applicable
- print_data() None
Print data models of all handlers.
- class tracetools_analysis.processor.Dependant(**kwargs)
Bases:
object
Object which depends on other types.
A dependant depends on other types which might have dependencies themselves. Dependencies are type-related only.
- class tracetools_analysis.processor.DependencySolver(*initial_dependants: Dependant, **kwargs)
Bases:
object
Solve Dependant dependencies.
Post-order depth-first search (ish). Does not check for circular dependencies or other errors.
- class tracetools_analysis.processor.EventHandler(*, handler_map: Dict[str, Callable[[tracetools_read.DictEvent, EventMetadata], None]], data_model: DataModel | None = None, **kwargs)
Bases:
Dependant
Base event handling class.
Provides handling functions for some events, depending on the name. Passes that on to a data model. Should be subclassed, but it is not necessary since the handling functions can be anything; therefore it does not raise any error if it is directly instantiated.
- finalize() None
Finalize the event handler.
This should be called at the end, once all events have been processed.
- property handler_map: Dict[str, Callable[[tracetools_read.DictEvent, EventMetadata], None]]
Get the handler functions map.
- static int_to_hex_str(addr: int) str
Format an int into an hex str.
- classmethod process(events: List[tracetools_read.DictEvent], **kwargs) EventHandler
Create a Processor and process an instance of the class.
- Parameters:
events – the list of events
- Returns:
the processor object after processing
- register_processor(processor: Processor) None
Register processor with this EventHandler so that it can query other handlers.
- static required_events() Set[str]
Get the set of events required by this EventHandler.
Without these events, the EventHandler would be invalid/useless. Inheriting classes can decide not to declare that they require specific events.
- class tracetools_analysis.processor.EventMetadata(event_name: str, timestamp: int, cpu_id: int, procname: str | None = None, pid: int | None = None, tid: int | None = None)
Bases:
object
Container for event metadata.
- property cpu_id
- property event_name
- property pid
- property procname
- property tid
- property timestamp
- class tracetools_analysis.processor.ProcessingProgressDisplay(processing_elements: List[str])
Bases:
object
Display processing progress periodically on stdout.
- did_work(increment: int = 1) None
Increment the amount of work done.
- Parameters:
increment – the number of units of work to add to the total
- done(erase: bool = False) None
Set progress to done.
- Parameters:
erase – whether to erase the progress message
- set_work_total(total: int) None
Set the total units of work.
- Parameters:
total – the total number of units of work to do
- class tracetools_analysis.processor.Processor(*handlers: EventHandler, quiet: bool = False, **kwargs)
Bases:
object
Processor class, which dispatches events to event handlers.
- exception RequiredEventNotFoundError
Bases:
RuntimeError
When a trace does not contain at least one event required by an EventHandler.
- static get_event_names(events: List[tracetools_read.DictEvent]) Set[str]
Get set of names from a list of events.
- get_handler_by_type(handler_type: Type) EventHandler | None
Get an existing EventHandler instance from its type.
- Parameters:
handler_type – the type of EventHandler subclass to find
- Returns:
the EventHandler instance if found, otherwise None
- print_data() None
Print processed data.
- process(events: List[tracetools_read.DictEvent], erase_progress: bool = False, no_required_events_check: bool = False) None
Process all events.
- Parameters:
events – the events to process
erase_progress – whether to erase the progress message
no_required_events_check – whether to skip the check for required events