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>
impl<'gctx> Timings<'gctx>
pub fn new(bcx: &BuildContext<'_, 'gctx>, root_units: &[Unit]) -> Timings<'gctx>
Sourcepub fn unit_start(&mut self, id: JobId, unit: Unit)
pub fn unit_start(&mut self, id: JobId, unit: Unit)
Mark that a unit has started running.
Sourcepub fn unit_rmeta_finished(&mut self, id: JobId, unlocked: Vec<&Unit>)
pub fn unit_rmeta_finished(&mut self, id: JobId, unlocked: Vec<&Unit>)
Mark that the .rmeta
file as generated.
Sourcepub fn unit_finished(&mut self, id: JobId, unlocked: Vec<&Unit>)
pub fn unit_finished(&mut self, id: JobId, unlocked: Vec<&Unit>)
Mark that a unit has finished running.
Sourcepub fn mark_concurrency(
&mut self,
active: usize,
waiting: usize,
inactive: usize,
)
pub fn mark_concurrency( &mut self, active: usize, waiting: usize, inactive: usize, )
This is called periodically to mark the concurrency of internal structures.
Sourcepub fn record_cpu(&mut self)
pub fn record_cpu(&mut self)
Take a sample of CPU usage
Sourcepub fn finished(
&mut self,
build_runner: &BuildRunner<'_, '_>,
error: &Option<Error>,
) -> CargoResult<()>
pub fn finished( &mut self, build_runner: &BuildRunner<'_, '_>, error: &Option<Error>, ) -> CargoResult<()>
Call this when all units are finished.
Sourcefn report_html(
&self,
build_runner: &BuildRunner<'_, '_>,
error: &Option<Error>,
) -> CargoResult<()>
fn report_html( &self, build_runner: &BuildRunner<'_, '_>, error: &Option<Error>, ) -> CargoResult<()>
Save HTML report to disk.
Sourcefn write_summary_table(
&self,
f: &mut impl Write,
duration: f64,
bcx: &BuildContext<'_, '_>,
error: &Option<Error>,
) -> CargoResult<()>
fn write_summary_table( &self, f: &mut impl Write, duration: f64, bcx: &BuildContext<'_, '_>, error: &Option<Error>, ) -> CargoResult<()>
Render the summary table.
Sourcefn write_js_data(&self, f: &mut impl Write) -> CargoResult<()>
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.
Sourcefn write_unit_table(&self, f: &mut impl Write) -> CargoResult<()>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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