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>
impl<'cfg> Timings<'cfg>
pub fn new(bcx: &BuildContext<'_, 'cfg>, root_units: &[Unit]) -> Timings<'cfg>
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,
cx: &Context<'_, '_>,
error: &Option<Error>
) -> CargoResult<()>
pub fn finished( &mut self, cx: &Context<'_, '_>, error: &Option<Error> ) -> CargoResult<()>
Call this when all units are finished.
sourcefn report_html(
&self,
cx: &Context<'_, '_>,
error: &Option<Error>
) -> CargoResult<()>
fn report_html( &self, cx: &Context<'_, '_>, 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<'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> 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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§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>,
source§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: 288 bytes