umpyre.collectors.base#

Base collector class with Mapping interface.

Classes

CollectorRegistry()

Registry for managing available collectors.

MetricCollector()

Abstract base for metric collectors using Mapping interface.

class umpyre.collectors.base.CollectorRegistry[source]#

Bases: object

Registry for managing available collectors.

get(name)[source]#

Get collector class by name.

Return type:

type[MetricCollector]

list_collectors()[source]#

List all registered collector names.

Return type:

list[str]

register(name, collector_class)[source]#

Register a collector class.

Parameters:
class umpyre.collectors.base.MetricCollector[source]#

Bases: Mapping, ABC

Abstract base for metric collectors using Mapping interface.

Collectors implement the Mapping protocol to provide dict-like access to collected metrics, enabling flexible composition and iteration.

Example

>>> class SimpleCollector(MetricCollector):
...     def collect(self) -> dict:
...         return {'lines': 100, 'functions': 10}
>>> collector = SimpleCollector()
>>> collector['lines']
100
>>> list(collector)
['lines', 'functions']
abstractmethod collect()[source]#

Collect metrics and return as dictionary.

Return type:

dict

Returns:

Dictionary of metric names to values

refresh()[source]#

Force re-collection of metrics.

to_dict()[source]#

Export all metrics as dictionary.

Return type:

dict