hespas.event_counters.event

Classes

CounterEvent(event_name, timestamp, ...)

This class represents a single Performance Counter Event.

class hespas.event_counters.event.CounterEvent(event_name: str, timestamp: str | int | float, timeunit: str = '', metadata: dict[str, ~typing.Any]=<factory>)

Bases: Serialisable

This class represents a single Performance Counter Event. The details of the event are not specified - this is intended to simply serialise an event in a generic way to allowing flexible generation of events from Estimator sources and analysis of events in external tools (such as extracting power information).

This class is not intended to be used alone, but rather should be contained within a CounterEventStream. Users can instantiate this class and serialise/deserialise this class on its own, but it is not recommended. The recommended interface is use to use add_event() within CounterEventStream, and to only serialise/deserialise entire CounterEventStream objects.

‘timestamp’ is intended to be generic enough allow even Estimators without a concept of time to generate a stream of events. This is why ‘timeunit’ is seperate from ‘timestamp’. A ‘timeunit’ of “” (the empty string) should be taken as: “each timestamp represents a unique time quanta, with timestamps less than this one happening before this time quanta, equal to this timestamp happening at the same time quanta, and greater than happening after this time quanta” If the timeunit is defined to a non-empty string, it should either be a reasonable unit (like ‘s’) or something like ‘cycles’ that can be straightforwardly understood by external tools.

‘metadata’ is intentionally a (possibly empty) free dictionary to be used to capture any implementation-specific information that is useful for external tools to understand information related to this event. No specific default or required metadata is specified.

Parameters:
  • event_name – Name of the event being captured.

  • timestamp – A number representing the time that this event occurs.

  • timeunit – A string representing the unit of time for the timestamp, or empty string (meaning generic time quanta)

  • metadata – A (possibly empty) dict containing metadata for the counter event.

event_name: str
timestamp: str | int | float
timeunit: str = ''
metadata: dict[str, Any]
__init__(event_name: str, timestamp: str | int | float, timeunit: str = '', metadata: dict[str, ~typing.Any]=<factory>) None