mirror of
https://github.com/rui314/mold.git
synced 2026-11-09 04:49:33 -10:00
Format timer labels only when recording is enabled
This commit is contained in:
1 parent
b2775275f8
commit
7d1dee4a3a
2 files changed
+8
-7
No files matched your search
+5
-4
@@ -823,11 +823,12 @@ fn run_tasks<E: Arch>(
|
||||
|
||||
work.into_par_iter().for_each(|(task, mut bufs)| {
|
||||
let name = ctx.chunk_header(task.chunk).name;
|
||||
let _t = timer.child(&if name.is_empty() {
|
||||
"(header)".to_string()
|
||||
let name = if name.is_empty() {
|
||||
bstr::BStr::new("(header)")
|
||||
} else {
|
||||
name.to_string()
|
||||
});
|
||||
name
|
||||
};
|
||||
let _t = timer.child(name);
|
||||
let mut bufs = bufs.drain(..);
|
||||
let own = bufs.next().unwrap();
|
||||
match task.chunk {
|
||||
|
||||
+3
-3
@@ -183,7 +183,7 @@ impl Timers {
|
||||
self.start_child(name, parent)
|
||||
}
|
||||
|
||||
fn start_child(&self, name: &str, parent: Option<usize>) -> Timer {
|
||||
fn start_child(&self, name: impl std::fmt::Display, parent: Option<usize>) -> Timer {
|
||||
let Some(records) = &self.records else {
|
||||
return self.inactive();
|
||||
};
|
||||
@@ -265,7 +265,7 @@ impl Timer {
|
||||
/// Starts a timer nested in this one. Timers started from parallel
|
||||
/// tasks name their parent this way, since which timer started last
|
||||
/// says nothing about nesting then.
|
||||
pub fn child(&self, name: &str) -> Timer {
|
||||
pub fn child(&self, name: impl std::fmt::Display) -> Timer {
|
||||
self.timers.start_child(name, Some(self.index))
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ impl Timer {
|
||||
}
|
||||
|
||||
impl TimerHandle {
|
||||
pub fn child(&self, name: &str) -> Timer {
|
||||
pub fn child(&self, name: impl std::fmt::Display) -> Timer {
|
||||
self.timers.start_child(name, Some(self.parent))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user