add some more metrics around get_lines_with_hyperlinks_applied + others

This commit is contained in:
Wez Furlong committed 2021-08-01 14:50:50 -07:00
1 parent 25f4308e4f
commit 86bf251f3f
3 files changed
+17 -3

No files matched your search

+3 -1
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 =
DecodedImage::load(image_data).or_else(|e| -> anyhow::Result<DecodedImage> {
log::debug!("Failed to decode image: {:#}", e);
// Use a placeholder instead
Ok(DecodedImage::placeholder())
})?;
metrics::histogram!("glyphcache.cached_image.decode.rate", 1.);
metrics::histogram!("glyphcache.cached_image.decode.latency", start.elapsed());
let sprite = self
.atlas
.allocate_with_padding(&decoded.frames[0].image, padding)?;
+6
View File
@@ -238,9 +238,15 @@ impl super::TermWindow {
None => dims.physical_top..dims.physical_top + dims.viewport_rows as StableRowIndex,
};
let start = Instant::now();
let (top, vp_lines) = pos
.pane
.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;
lines = vp_lines;
}
+8 -2
View File
@@ -89,7 +89,8 @@ where
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;
if let Some(allocation) = self
let start = std::time::Instant::now();
let res = if let Some(allocation) = self
.allocator
.allocate(AtlasSize::new(reserve_width, reserve_height))
{
@@ -102,6 +103,7 @@ where
self.texture.write(rect, im);
metrics::histogram!("window.atlas.allocate.success.rate", 1.);
Ok(Sprite {
texture: Rc::clone(&self.texture),
coords: rect,
@@ -109,11 +111,15 @@ where
} else {
// It's not possible to satisfy that request
let size = (reserve_width.max(reserve_height) as usize).next_power_of_two();
metrics::histogram!("window.atlas.allocate.failure.rate", 1.);
Err(OutOfTextureSpace {
size: Some((self.side * 2).max(size)),
current_size: self.side,
})
}
};
metrics::histogram!("window.atlas.allocate.latency", start.elapsed());
res
}
pub fn size(&self) -> usize {