Skip to content
API REFERENCEUsage guides →

cellpack::opt::CostModel ​

struct

Module contract · All interfaces

At a glance ​

pub struct CostModel {Show 13 fields
    pub cores: f64,
    pub iops: f64,
    pub bandwidth: f64,
    pub memory_bandwidth: f64,
    pub serial: f64,
    pub bucket: u64,
    pub access: f64,
    pub request: f64,
    pub compile: f64,
    pub input: InputCost,
    pub rows: RowCost,
    pub outputs: Vec<OutputCost>,
    pub convert: [f64; 6],
}

The loader’s resources on one machine and the work it does per access, record, element, request and cached-row byte. Work is in core-seconds: seconds of one physical core (two workers sharing a core through SMT take it together).

Fields and variants ​

cores ​

cores: f64

Physical cores the workers run on (at most one per worker).

iops ​

iops: f64

Read requests per second the device sustains.

bandwidth ​

bandwidth: f64

Bytes per second the device sustains.

memory_bandwidth ​

memory_bandwidth: f64

Bytes per second of cached-row traffic main memory sustains.

serial ​

serial: f64

Share of the shorter of device and worker time that does not overlap the longer, in [0, 1].

bucket ​

bucket: u64

Accesses per priced window.

access ​

access: f64

Every access: claiming, bookkeeping, completing, the ring.

request ​

request: f64

One read request: building, submitting and harvesting it.

compile ​

compile: f64

The online compiler, per access, where it shares the workers’ cores.

input ​

input: InputCost

Decoding records.

rows ​

rows: RowCost

Cached rows.

outputs ​

outputs: Vec<OutputCost>

Per output schema, in loader order.

convert ​

convert: [f64; 6]

Converting an element, per Conversion class, on top of the schema’s map_element.

Member index ​

6 of 6 members

  • defaultsDefault costs (see crate::opt::defaults ) for a loader whose workers run on cores physical cores, reading storage of tier , with builtin[k] telling whether schema k is the built-in output.
  • secondsModeled seconds of a window with these loads.
  • serviceEach resource’s service time for these loads: requests, bytes, cores and memory.
  • pricesThe prices of loads near l : the chain rule through the three maxima of T , with each maximum split smoothly by share so a resource that is about to bind already carries part of the price.
  • to_bytesThe cost model as bytes: a magic, its fields (as plan files embed them) and a checksum.
  • from_bytesReads CostModel::to_bytes . The values are not checked against a graph; compilation does that.

Methods and associated constants ​

defaults ​

pub fn defaults(cores: f64, tier: Tier, builtin: &[bool]) -> Self

Default costs (see crate::opt::defaults) for a loader whose workers run on cores physical cores, reading storage of tier, with builtin[k] telling whether schema k is the built-in output.

seconds ​

pub fn seconds(&self, l: &Loads) -> f64

Modeled seconds of a window with these loads.

service ​

pub fn service(&self, l: &Loads) -> [f64; 4]

Each resource’s service time for these loads: requests, bytes, cores and memory.

prices ​

pub fn prices(&self, l: &Loads) -> Prices

The prices of loads near l: the chain rule through the three maxima of T, with each maximum split smoothly by share so a resource that is about to bind already carries part of the price.

to_bytes ​

pub fn to_bytes(&self) -> Vec<u8> ⓘ

The cost model as bytes: a magic, its fields (as plan files embed them) and a checksum.

from_bytes ​

pub fn from_bytes(bytes: &[u8]) -> Result<Self>

Reads CostModel::to_bytes. The values are not checked against a graph; compilation does that.

Implemented traits ​

impl Clone for CostModel
impl Debug for CostModel
impl<'de> Deserialize<'de> for CostModel

Contract reference ​

See the module reference for semantic input/output rules, units, allocation, mutation, failure behavior, and lifetime requirements. Declarations and documented members are synchronized from the crate source.

Definition