1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00

add some more metrics around get_lines_with_hyperlinks_applied + others

This commit is contained in:
Wez Furlong 2021-08-01 14:29:33 -07:00
parent 25f4308e4f
commit 86bf251f3f
3 changed files with 17 additions and 3 deletions

View File

@ -4266,13 +4266,15 @@ impl<T: Texture2d> GlyphCache<T> {
} }
} }
// FIXME: add latency metric around this load let start = Instant::now();
let mut decoded = let mut decoded =
DecodedImage::load(image_data).or_else(|e| -> anyhow::Result<DecodedImage> { DecodedImage::load(image_data).or_else(|e| -> anyhow::Result<DecodedImage> {
log::debug!("Failed to decode image: {:#}", e); log::debug!("Failed to decode image: {:#}", e);
// Use a placeholder instead // Use a placeholder instead
Ok(DecodedImage::placeholder()) Ok(DecodedImage::placeholder())
})?; })?;
metrics::histogram!("glyphcache.cached_image.decode.rate", 1.);
metrics::histogram!("glyphcache.cached_image.decode.latency", start.elapsed());
let sprite = self let sprite = self
.atlas .atlas
.allocate_with_padding(&decoded.frames[0].image, padding)?; .allocate_with_padding(&decoded.frames[0].image, padding)?;

View File

@ -238,9 +238,15 @@ impl super::TermWindow {
None => dims.physical_top..dims.physical_top + dims.viewport_rows as StableRowIndex, None => dims.physical_top..dims.physical_top + dims.viewport_rows as StableRowIndex,
}; };
let start = Instant::now();
let (top, vp_lines) = pos let (top, vp_lines) = pos
.pane .pane
.get_lines_with_hyperlinks_applied(stable_range, &self.config.hyperlink_rules); .get_lines_with_hyperlinks_applied(stable_range, &self.config.hyperlink_rules);
metrics::histogram!("get_lines_with_hyperlinks_applied.latency", start.elapsed());
log::trace!(
"get_lines_with_hyperlinks_applied took {:?}",
start.elapsed()
);
stable_top = top; stable_top = top;
lines = vp_lines; lines = vp_lines;
} }

View File

@ -89,7 +89,8 @@ where
let reserve_width = reserve_width + padding.unwrap_or(0) as i32 + PADDING * 2; let reserve_width = reserve_width + padding.unwrap_or(0) as i32 + PADDING * 2;
let reserve_height = reserve_height + padding.unwrap_or(0) as i32 + PADDING * 2; let reserve_height = reserve_height + padding.unwrap_or(0) as i32 + PADDING * 2;
if let Some(allocation) = self let start = std::time::Instant::now();
let res = if let Some(allocation) = self
.allocator .allocator
.allocate(AtlasSize::new(reserve_width, reserve_height)) .allocate(AtlasSize::new(reserve_width, reserve_height))
{ {
@ -102,6 +103,7 @@ where
self.texture.write(rect, im); self.texture.write(rect, im);
metrics::histogram!("window.atlas.allocate.success.rate", 1.);
Ok(Sprite { Ok(Sprite {
texture: Rc::clone(&self.texture), texture: Rc::clone(&self.texture),
coords: rect, coords: rect,
@ -109,11 +111,15 @@ where
} else { } else {
// It's not possible to satisfy that request // It's not possible to satisfy that request
let size = (reserve_width.max(reserve_height) as usize).next_power_of_two(); let size = (reserve_width.max(reserve_height) as usize).next_power_of_two();
metrics::histogram!("window.atlas.allocate.failure.rate", 1.);
Err(OutOfTextureSpace { Err(OutOfTextureSpace {
size: Some((self.side * 2).max(size)), size: Some((self.side * 2).max(size)),
current_size: self.side, current_size: self.side,
}) })
} };
metrics::histogram!("window.atlas.allocate.latency", start.elapsed());
res
} }
pub fn size(&self) -> usize { pub fn size(&self) -> usize {