Skip to main content
Log in

Mojo struct

ThroughputMeasure

struct ThroughputMeasure

Records a throughput metric of metric BenchMetric and value.

Fields

  • metric (BenchMetric): Type of throughput metric.
  • value (Int): Measured count of throughput metric.

Implemented traits

AnyType, CollectionElement, Copyable, Movable, Stringable, UnknownDestructibility

Methods

__init__

__init__(out self, name: String, value: Int, reference: List[BenchMetric] = List(BenchMetric(0, String("throughput"), String("GElems/s")), BenchMetric(1, String("DataMovement"), String("GB/s")), BenchMetric(2, String("Arithmetic"), String("GFLOPS/s"))))

Creates a ThroughputMeasure based on metric's name.

Example: For the default bench metrics BenchMetric.DEFAULTS the following are equivalent: - ThroughputMeasure(BenchMetric.fmas, 1024) - ThroughputMeasure("fmas", 1024) - ThroughputMeasure("fmas", 1024, BenchMetric.DEFAULTS)

Args:

  • name (String): The name of BenchMetric in its corresponding reference.
  • value (Int): The measured value to assign to this metric.
  • reference (List[BenchMetric]): Pointer variadic list of BenchMetrics that contains this metric.

__init__(out self, *, other: Self)

Explicitly construct a deep copy of the provided value.

Args:

  • other (Self): The value to copy.

__str__

__str__(self) -> String

Gets a string representation of this ThroughputMeasure.

Returns:

The string represntation.

compute

compute(self, elapsed_sec: SIMD[float64, 1]) -> SIMD[float64, 1]

Computes throughput rate for this metric per unit of time (second).

Args:

  • elapsed_sec (SIMD[float64, 1]): Elapsed time measured in seconds.

Returns:

The throughput values as a floating point 64.