libmuscle.profiling module

class libmuscle.profiling.ProfileEvent(event_type: ProfileEventType, start_time: ProfileTimestamp | None = None, stop_time: ProfileTimestamp | None = None, port: Port | None = None, port_length: int | None = None, slot: int | None = None, message_number: int | None = None, message_size: int | None = None, message_timestamp: float | None = None)[source]

Bases: object

A profile event as used by MUSCLE3.

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

Parameters:
  • event_type – Type of event that was measured.

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

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

  • 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_number – Number of message on this port, if applicable. Starts at 0 for the first message sent or received.

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

  • message_timestamp – Timestamp sent with the message, if applicable.

event_type

Type of event that was measured.

start_time

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

stop_time

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

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_number

Number of message on this port, if applicable. Starts at 0 for the first message sent or received.

message_size

Size of the message involved, if applicable.

message_timestamp

Timestamp sent with the message, if applicable.

start() None[source]

Sets start_time to the current time.

stop() None[source]

Sets stop_time to the current time.

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

Bases: Enum

Profiling event types for MUSCLE3.

CONNECT = 4
DEREGISTER = 1
DISCONNECT_WAIT = 8
RECEIVE = 3
RECEIVE_DECODE = 7
RECEIVE_TRANSFER = 6
RECEIVE_WAIT = 5
REGISTER = 0
SEND = 2
SHUTDOWN = 10
SHUTDOWN_WAIT = 9
class libmuscle.profiling.ProfileTimestamp(nanoseconds: int | None = None)[source]

Bases: object

A timestamp for profiling.

This has higher resolution than Timestamp, storing a number of nanoseconds since the UNIX epoch in an int.

nanoseconds

Nanoseconds since the UNIX epoch.