Module materialize.feature_benchmark.measurement
Expand source code Browse git
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.
from enum import Enum, auto
class MeasurementType(Enum):
WALLCLOCK = auto()
MEMORY = auto()
MESSAGES = auto()
def __str__(self) -> str:
return self.name.lower()
class Measurement:
def __init__(self, type: MeasurementType, value: float) -> None:
self.type = type
self.value = value
def __str__(self) -> str:
return f"{self.value:>11.3f}({self.type})"
Classes
class Measurement (type: MeasurementType, value: float)
-
Expand source code Browse git
class Measurement: def __init__(self, type: MeasurementType, value: float) -> None: self.type = type self.value = value def __str__(self) -> str: return f"{self.value:>11.3f}({self.type})"
class MeasurementType (*args, **kwds)
-
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
- attribute access::
>>> Color.RED <Color.RED: 1>
- value lookup:
>>> Color(1) <Color.RED: 1>
- name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
Expand source code Browse git
class MeasurementType(Enum): WALLCLOCK = auto() MEMORY = auto() MESSAGES = auto() def __str__(self) -> str: return self.name.lower()
Ancestors
- enum.Enum
Class variables
var MEMORY
var MESSAGES
var WALLCLOCK