pub struct Timings<'cfg> {
Show 16 fields config: &'cfg Config, enabled: bool, report_html: bool, report_json: bool, start: Instant, start_str: String, root_targets: Vec<(String, Vec<String>)>, profile: String, total_fresh: u32, total_dirty: u32, unit_times: Vec<UnitTime>, active: HashMap<JobId, UnitTime>, concurrency: Vec<Concurrency>, last_cpu_state: Option<State>, last_cpu_recording: Instant, cpu_usage: Vec<(f64, f64)>,
}
Expand description

Tracking information for the entire build.

Methods on this structure are generally called from the main thread of a running JobQueue instance (DrainState in specific) when the queue receives messages from spawned off threads.

Fields§

§config: &'cfg Config§enabled: bool

Whether or not timings should be captured.

§report_html: bool

If true, saves an HTML report to disk.

§report_json: bool

If true, emits JSON information with timing information.

§start: Instant

When Cargo started.

§start_str: String

A rendered string of when compilation started.

§root_targets: Vec<(String, Vec<String>)>

A summary of the root units.

Tuples of (package_description, target_descriptions).

§profile: String

The build profile.

§total_fresh: u32

Total number of fresh units.

§total_dirty: u32

Total number of dirty units.

§unit_times: Vec<UnitTime>

Time tracking for each individual unit.

§active: HashMap<JobId, UnitTime>

Units that are in the process of being built. When they finished, they are moved to unit_times.

§concurrency: Vec<Concurrency>

Concurrency-tracking information. This is periodically updated while compilation progresses.

§last_cpu_state: Option<State>

Last recorded state of the system’s CPUs and when it happened

§last_cpu_recording: Instant§cpu_usage: Vec<(f64, f64)>

Recorded CPU states, stored as tuples. First element is when the recording was taken and second element is percentage usage of the system.

Implementations§

source§

impl<'cfg> Timings<'cfg>

source

pub fn new(bcx: &BuildContext<'_, 'cfg>, root_units: &[Unit]) -> Timings<'cfg>

source

pub fn unit_start(&mut self, id: JobId, unit: Unit)

Mark that a unit has started running.

source

pub fn unit_rmeta_finished(&mut self, id: JobId, unlocked: Vec<&Unit>)

Mark that the .rmeta file as generated.

source

pub fn unit_finished(&mut self, id: JobId, unlocked: Vec<&Unit>)

Mark that a unit has finished running.

source

pub fn mark_concurrency( &mut self, active: usize, waiting: usize, inactive: usize )

This is called periodically to mark the concurrency of internal structures.

source

pub fn add_fresh(&mut self)

Mark that a fresh unit was encountered. (No re-compile needed)

source

pub fn add_dirty(&mut self)

Mark that a dirty unit was encountered. (Re-compile needed)

source

pub fn record_cpu(&mut self)

Take a sample of CPU usage

source

pub fn finished( &mut self, cx: &Context<'_, '_>, error: &Option<Error> ) -> CargoResult<()>

Call this when all units are finished.

source

fn report_html( &self, cx: &Context<'_, '_>, error: &Option<Error> ) -> CargoResult<()>

Save HTML report to disk.

source

fn write_summary_table( &self, f: &mut impl Write, duration: f64, bcx: &BuildContext<'_, '_>, error: &Option<Error> ) -> CargoResult<()>

Render the summary table.

source

fn write_js_data(&self, f: &mut impl Write) -> CargoResult<()>

Write timing data in JavaScript. Primarily for timings.js to put data in a <script> HTML element to draw graphs.

source

fn write_unit_table(&self, f: &mut impl Write) -> CargoResult<()>

Render the table of all units.

Auto Trait Implementations§

§

impl<'cfg> !RefUnwindSafe for Timings<'cfg>

§

impl<'cfg> !Send for Timings<'cfg>

§

impl<'cfg> !Sync for Timings<'cfg>

§

impl<'cfg> Unpin for Timings<'cfg>

§

impl<'cfg> !UnwindSafe for Timings<'cfg>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
§

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

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 288 bytes