libmuscle.profiling module

class libmuscle.profiling.ProfileEvent(instance_id: Reference, start_time: Timestamp, stop_time: Timestamp, event_type: ProfileEventType, port: Optional[Port] = None, port_length: Optional[int] = None, slot: Optional[int] = None, message_size: Optional[int] = None)[source]

Bases: object

A profile event as used by MUSCLE 3.

This represents a single measurement of the timing of some event that occurred while executing the simulation.

Parameters
  • instance_id – The identifier of the instance that generated this message.

  • start_time – When the event started (real-world, not simulation time).

  • stop_time – When the event ended (real-world, not simulation time).

  • event_type – Type of event that was measured.

  • port – Port used for sending or receiving, if applicable.

  • port_length – Length of that port, if a vector.

  • slot – Slot that was sent or received on, if applicable.

  • message_size – Size of the message involved, if applicable.

instance_id

The identifier of the instance that generated this message.

start_time

When the event started (real-world, not simulation time).

stop_time

When the event ended (real-world, not simulation time).

event_type

Type of event that was measured.

port

Port used for sending or receiving, if applicable.

port_length

Length of that port, if a vector.

slot

Slot that was sent or received on, if applicable.

message_size

Size of the message involved, if applicable.

stop() None[source]

Sets stop_time to the current time.

to_grpc() ProfileEvent[source]

Converts the profile event to the gRPC-generated type.

Returns

This profile event, as the gRPC type.

class libmuscle.profiling.ProfileEventType(value)[source]

Bases: Enum

Profiling event types for MUSCLE 3.

These match the types in the MUSCLE Manager Protocol, and should be kept identical to those.

CONNECT = 4
DEREGISTER = 1
RECEIVE = 3
REGISTER = 0
SEND = 2
static from_grpc(event_type: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7f18360d1908>) ProfileEventType[source]

Creates an event type from a gRPC-generated message.

Parameters

event_type – A profile event type, received from gRPC.

Returns

The same event type, as a ProfileEventType.

to_grpc() <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7f18360d1908>[source]

Converts the event type to the gRPC generated type.

Returns

The current event type, as the gRPC type.