Mojo struct
BenchMetric
Defines a benchmark throughput metric.
Aliases
elements = BenchMetric(0, "throughput", "GElems/s")
:bytes = BenchMetric(1, "DataMovement", "GB/s")
:flops = BenchMetric(2, "Arithmetic", "GFLOPS/s")
:DEFAULTS = BenchMetric(0, "throughput", "GElems/s"), BenchMetric(1, "DataMovement", "GB/s"), BenchMetric(2, "Arithmetic", "GFLOPS/s")
: Default set of benchmark metrics.
Fields
- code (
Int
): Op-code of the Metric. - name (
String
): Metric's name. - unit (
String
): Metric's throughput rate unit (count/second).
Implemented traits
AnyType
,
CollectionElement
,
Copyable
,
Movable
,
Stringable
Methods
__init__
__init__(inout self: Self, *, other: Self)
Explicitly construct a deep copy of the provided value.
Args:
- other (
Self
): The value to copy.
__eq__
__eq__(self: Self, other: Self) -> Bool
Compares two metrics for equality.
Args:
- other (
Self
): The metric to compare.
Returns:
True if the two metrics are equal.
__ne__
__ne__(self: Self, other: Self) -> Bool
Compares two metrics for inequality.
Args:
- other (
Self
): The metric to compare.
Returns:
True if the two metrics are NOT equal.
__str__
__str__(self: Self) -> String
Gets a string representation of this metric.
Returns:
The string representation.
check_name
check_name(self: Self, alt_name: String) -> Bool
Checks whether a string contains the metric's name.
Args:
- alt_name (
String
): Alternative name of a metric.
Returns:
True if 'alt_name' is valid alternative of the metric's name.
get_metric_from_list
static get_metric_from_list(name: String, metric_list: List[BenchMetric, 0]) -> Self
Gets a metric from a given list using only the metric's name.
Args:
- name (
String
): Metric's name. - metric_list (
List[BenchMetric, 0]
): List of metrics to search.
Returns:
The selected metric.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
😔 What went wrong?