Mojo 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
Methods
__init__
__init__(inout self: Self, name: String, value: Int, reference: List[BenchMetric, 0] = BenchMetric(0, "throughput", "GElems/s"), BenchMetric(1, "DataMovement", "GB/s"), BenchMetric(2, "Arithmetic", "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, 0]
): Reference variadic list of BenchMetrics that contains this metric.
__init__(inout self: Self, *, other: Self)
Explicitly construct a deep copy of the provided value.
Args:
- other (
Self
): The value to copy.
__str__
__str__(self: Self) -> String
Gets a string representation of this ThroughputMeasure
.
Returns:
The string represntation.
compute
compute(self: 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.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!