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