Enum datafusion::physical_plan::metrics::MetricValue

source ·
pub enum MetricValue {
    OutputRows(Count),
    ElapsedCompute(Time),
    SpillCount(Count),
    SpilledBytes(Count),
    SpilledRows(Count),
    CurrentMemoryUsage(Gauge),
    Count {
        name: Cow<'static, str>,
        count: Count,
    },
    Gauge {
        name: Cow<'static, str>,
        gauge: Gauge,
    },
    Time {
        name: Cow<'static, str>,
        time: Time,
    },
    StartTimestamp(Timestamp),
    EndTimestamp(Timestamp),
}
Expand description

Possible values for a super::Metric.

Among other differences, the metric types have different ways to logically interpret their underlying values and some metrics are so common they are given special treatment.

Variants§

§

OutputRows(Count)

Number of output rows produced: “output_rows” metric

§

ElapsedCompute(Time)

Elapsed Compute Time: the wall clock time spent in “cpu intensive” work.

This measurement represents, roughly:

use std::time::Instant;
let start = Instant::now();
// ...CPU intensive work here...
let elapsed_compute = (Instant::now() - start).as_nanos();

Note 1: Does not include time other operators spend computing input.

Note 2: Does includes time when the thread could have made progress but the OS did not schedule it (e.g. due to CPU contention), thus making this value different than the classical definition of “cpu_time”, which is the time reported from clock_gettime(CLOCK_THREAD_CPUTIME_ID, ..).

§

SpillCount(Count)

Number of spills produced: “spill_count” metric

§

SpilledBytes(Count)

Total size of spilled bytes produced: “spilled_bytes” metric

§

SpilledRows(Count)

Total size of spilled rows produced: “spilled_rows” metric

§

CurrentMemoryUsage(Gauge)

Current memory used

§

Count

Operator defined count.

Fields

§name: Cow<'static, str>

The provided name of this metric

§count: Count

The value of the metric

§

Gauge

Operator defined gauge.

Fields

§name: Cow<'static, str>

The provided name of this metric

§gauge: Gauge

The value of the metric

§

Time

Operator defined time

Fields

§name: Cow<'static, str>

The provided name of this metric

§time: Time

The value of the metric

§

StartTimestamp(Timestamp)

The time at which execution started

§

EndTimestamp(Timestamp)

The time at which execution ended

Implementations§

source§

impl MetricValue

source

pub fn name(&self) -> &str

Return the name of this SQL metric

source

pub fn as_usize(&self) -> usize

Return the value of the metric as a usize value

source

pub fn new_empty(&self) -> MetricValue

create a new MetricValue with the same type as self suitable for accumulating

source

pub fn aggregate(&mut self, other: &MetricValue)

Aggregates the value of other to self. panic’s if the types are mismatched or aggregating does not make sense for this value

Note this is purposely marked mut (even though atomics are used) so Rust’s type system can be used to ensure the appropriate API access. MetricValues should be modified using the original Count or Time they were created from.

source

pub fn display_sort_key(&self) -> u8

Returns a number by which to sort metrics by display. Lower numbers are “more useful” (and displayed first)

source

pub fn is_timestamp(&self) -> bool

returns true if this metric has a timestamp value

Trait Implementations§

source§

impl Clone for MetricValue

source§

fn clone(&self) -> MetricValue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MetricValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for MetricValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Prints the value of this metric

source§

impl PartialEq for MetricValue

source§

fn eq(&self, other: &MetricValue) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for MetricValue

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V