Skip to content

Commit

Permalink
Improve the introspection paint stats
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Mar 20, 2022
1 parent e369626 commit fde9c23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions egui/src/introspection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@ impl Widget for &epaint::stats::PaintStats {

ui.label("Intermediate:");
label(ui, shapes, "shapes").on_hover_text("Boxes, circles, etc");
label(ui, shape_text, "text (mostly cached)");
ui.horizontal(|ui| {
label(ui, shape_text, "text");
ui.small("(mostly cached)");
});
label(ui, shape_path, "paths");
label(ui, shape_mesh, "nested meshes");
label(ui, shape_vec, "nested shapes");
ui.label(format!("{} callbacks", num_callbacks));
ui.label(format!("{:6} callbacks", num_callbacks));
ui.add_space(10.0);

ui.label("Text shapes:");
Expand All @@ -115,7 +118,7 @@ impl Widget for &epaint::stats::PaintStats {
ui.add_space(10.0);

ui.label("Tessellated (and culled):");
label(ui, clipped_primitives, "clipped_primitives")
label(ui, clipped_primitives, "primitives lists")
.on_hover_text("Number of separate clip rectangles");
label(ui, vertices, "vertices");
label(ui, indices, "indices").on_hover_text("Three 32-bit indices per triangles");
Expand Down
8 changes: 4 additions & 4 deletions epaint/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,25 @@ impl AllocInfo {

pub fn format(&self, what: &str) -> String {
if self.num_allocs() == 0 {
format!("{:6} {:14}", 0, what)
format!("{:6} {:16}", 0, what)
} else if self.num_allocs() == 1 {
format!(
"{:6} {:14} {} 1 allocation",
"{:6} {:16} {} 1 allocation",
self.num_elements,
what,
self.megabytes()
)
} else if self.element_size != ElementSize::Heterogenous {
format!(
"{:6} {:14} {} {:3} allocations",
"{:6} {:16} {} {:3} allocations",
self.num_elements(),
what,
self.megabytes(),
self.num_allocs()
)
} else {
format!(
"{:6} {:14} {} {:3} allocations",
"{:6} {:16} {} {:3} allocations",
"",
what,
self.megabytes(),
Expand Down

0 comments on commit fde9c23

Please sign in to comment.