Mojo struct
BenchMetric
Defines a benchmark throughput metric.
Aliases
elements = BenchMetric(0, String("throughput"), String("GElems/s"))
:bytes = BenchMetric(1, String("DataMovement"), String("GB/s"))
:flops = BenchMetric(2, String("Arithmetic"), String("GFLOPS/s"))
:theoretical_flops = BenchMetric(3, String("TheoreticalArithmetic"), String("GFLOPS/s"))
:DEFAULTS = List(BenchMetric(0, String("throughput"), String("GElems/s")), BenchMetric(1, String("DataMovement"), String("GB/s")), BenchMetric(2, String("Arithmetic"), String("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__(out self, *, other: Self)
Explicitly construct a deep copy of the provided value.
Args:
- other (
Self
): The value to copy.
__eq__
__eq__(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, 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) -> String
Gets a string representation of this metric.
Returns:
The string representation.
check_name
check_name(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]) -> Self
Gets a metric from a given list using only the metric's name.
Args:
- name (
String
): Metric's name. - metric_list (
List[BenchMetric]
): 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!