Mojo struct
BenchMetric
struct BenchMetric
Defines a benchmark throughput metric.
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,
Copyable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable,
Writable
comptime members
bytes
comptime bytes = BenchMetric(1, String("DataMovement"), String("GB/s"))
Metric for measuring data movement in bytes per second.
DEFAULTS
comptime DEFAULTS = List(BenchMetric.elements, BenchMetric.bytes, BenchMetric.flops, __list_literal__=Tuple())
Default set of benchmark metrics.
elements
comptime elements = BenchMetric(0, String("throughput"), String("GElems/s"))
Metric for measuring throughput in elements per second.
flops
comptime flops = BenchMetric(2, String("Arithmetic"), String("GFLOPS/s"))
Metric for measuring floating point operations per second.
theoretical_flops
comptime theoretical_flops = BenchMetric(3, String("TheoreticalArithmetic"), String("GFLOPS/s"))
Metric for measuring theoretical floating point operations per second.
Methods
__eq__
__eq__(self, other: Self) -> Bool
Compares two metrics for equality.
Args:
- other (
Self): The metric to compare.
Returns:
Bool: 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:
Bool: True if the two metrics are NOT equal.
write_to
write_to(self, mut writer: T)
Formats this BenchMetric to the provided Writer.
Args:
- writer (
T): The object to write to.
write_repr_to
write_repr_to(self, mut writer: T)
Writes the repr of this BenchMetric to a writer.
Args:
- writer (
T): The object to write to.
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:
Bool: True if 'alt_name' is valid alternative of the metric's name.
get_metric_from_list
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!