cargo::core::compiler::timings

Struct Timings

source
pub struct Timings<'gctx> {
Show 16 fields gctx: &'gctx GlobalContext, 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§

§gctx: &'gctx GlobalContext§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<'gctx> Timings<'gctx>

source

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

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, build_runner: &BuildRunner<'_, '_>, error: &Option<Error>, ) -> CargoResult<()>

Call this when all units are finished.

source

fn report_html( &self, build_runner: &BuildRunner<'_, '_>, 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<'gctx> Freeze for Timings<'gctx>

§

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

§

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

§

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

§

impl<'gctx> Unpin for Timings<'gctx>

§

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

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.

§

impl<T> Instrument for T

§

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

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

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 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

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

source§

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>,

source§

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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

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: 336 bytes