Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,194 changes: 617 additions & 577 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ anyhow = "1.0.71"
smallvec = "1.11.1"
arc-swap = "1.6.0"
base64 = "0.22.0"
egui = "0.29.1"
egui_plot = "0.29.0"
egui_extras = { version = "0.29.1", features = ["image"] }
egui_commonmark = "0.18.0"
egui-phosphor = "0.7.3"
egui = "0.33.3"
egui_plot = "0.34.1"
egui_extras = { version = "0.33.3", features = ["image"] }
egui_commonmark = "0.22.0"
egui-phosphor = "0.11.0"
fallible-iterator = "0.3.0"
chrono = "0.4.31"
indexmap = "2.1.0"
Expand Down Expand Up @@ -75,7 +75,7 @@ default-features = false
features = ["zstd", "jemalloc"]

[dependencies.eframe]
version = "0.29.1"
version = "0.33.3"
default-features = false
features = ["default_fonts", "x11"]

Expand Down
9 changes: 4 additions & 5 deletions src/ui/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::ui::tabs::{Tab, TabWidget};
use chrono::Duration;
use eframe::egui::{Align, Layout};
use eframe::{egui, egui::Ui};
use egui::{Image, Label, Pos2, Rect, RichText, SelectableLabel, Sense, Vec2, Widget};
use egui::{Button, Image, Label, Pos2, Rect, RichText, Sense, Vec2, Widget};
use egui_commonmark::{CommonMarkCache, CommonMarkViewer};
use egui_plot::{Axis, AxisHints, Line, Plot, PlotBounds};

Expand Down Expand Up @@ -224,8 +224,8 @@ impl DevfilerUi {
.collect()
});

pui.line(Line::new(points.clone()));
pui.set_auto_bounds([false, true].into());
pui.line(Line::new("", points.clone()));
pui.set_auto_bounds(egui::Vec2b::new(false, true));

(data_start as UtcTimestamp, data_end as UtcTimestamp)
});
Expand Down Expand Up @@ -269,8 +269,7 @@ impl DevfilerUi {
("24h", Duration::try_days(1).unwrap()),
] {
let is_active = self.auto_scroll_time == Some(duration);
let label = SelectableLabel::new(is_active, text);
let response = label.ui(ui);
let response = Button::selectable(is_active, text).ui(ui);
if response.clicked() {
if is_active {
self.auto_scroll_time = None;
Expand Down
4 changes: 3 additions & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ async fn background_ui_waker(ctx: egui::Context) {
fn load_phosphor_icons(ctx: &egui::Context) {
let mut fonts = egui::FontDefinitions::default();
let data = egui_phosphor::Variant::Regular.font_data();
fonts.font_data.insert("phosphor".into(), data);
fonts
.font_data
.insert("phosphor".into(), std::sync::Arc::new(data));
for family in [egui::FontFamily::Proportional, egui::FontFamily::Monospace] {
if let Some(font_keys) = fonts.families.get_mut(&family) {
font_keys.push("phosphor".into());
Expand Down
29 changes: 18 additions & 11 deletions src/ui/tabs/executables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use crate::symbolizer::IngestTask;
use crate::ui::util::{clearable_line_edit, humanize_count};
use egui::emath::RectTransform;
use egui::{
show_tooltip_at_pointer, Align, Color32, Direction, Id, Layout, Pos2, Rect, Rounding, Sense,
Stroke, Vec2,
Align, Color32, CornerRadius, Direction, Id, Layout, PopupAnchor, Pos2, Rect, Sense, Stroke,
StrokeKind, Tooltip, Vec2,
};
use egui_extras::{Column, TableBuilder};
use egui_phosphor::regular as icons;
Expand Down Expand Up @@ -195,28 +195,35 @@ impl ExecutablesTab {
let size = Vec2::new(width, SYMB_STATUS_BAR_HEIGHT);
let rect = trans.transform_rect(Rect::from_min_size(pos, size));

painter.rect_filled(rect, Rounding::ZERO, color.gamma_multiply(0.8));
painter.rect_stroke(rect, Rounding::ZERO, Stroke::new(1.0, Color32::BLACK));
painter.rect_filled(rect, CornerRadius::ZERO, color.gamma_multiply(0.8));
painter.rect_stroke(
rect,
CornerRadius::ZERO,
Stroke::new(1.0, Color32::BLACK),
StrokeKind::Middle,
);

if matches!(response.hover_pos(), Some(p) if rect.contains(p)) {
let tooltip_id = Id::new("executable-bar-tooltip");
show_tooltip_at_pointer(
ui.ctx(),
Tooltip::always_open(
ui.ctx().clone(),
egui::LayerId::new(egui::Order::Tooltip, tooltip_id),
tooltip_id,
|ui: &mut Ui| {
ui.label(format!("{}: {:.0}", name, humanize_count(value)));
},
);
PopupAnchor::Pointer,
)
.show(|ui: &mut Ui| {
ui.label(format!("{}: {:.0}", name, humanize_count(value)));
});
}

offset += width;
}

painter.rect_stroke(
response.rect,
Rounding::same(1.0),
CornerRadius::same(1),
style.visuals.widgets.noninteractive.bg_stroke,
StrokeKind::Middle,
);
}

Expand Down
35 changes: 22 additions & 13 deletions src/ui/tabs/flamegraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use base64::Engine;
use egui::emath::RectTransform;
use egui::Stroke;
use egui::{
pos2, show_tooltip_at_pointer, vec2, Align, Align2, Color32, FontId, Id, Key, Label, Layout,
Painter, Pos2, Rangef, Rect, Response, Rounding, Sense, Shape, Vec2,
pos2, vec2, Align, Align2, Color32, CornerRadius, FontId, Id, Key, Label, Layout, Painter,
PopupAnchor, Pos2, Rangef, Rect, Response, Sense, Shape, StrokeKind, Tooltip, Vec2,
};
use egui_phosphor::regular as icons;
use std::collections::HashMap;
Expand Down Expand Up @@ -263,13 +263,14 @@ impl FlameGraphWidget {
let screen_rect = to_screen.transform_rect(selected_rect);
painter.add(Shape::rect_filled(
screen_rect,
Rounding::ZERO,
CornerRadius::ZERO,
Color32::YELLOW,
));
painter.add(Shape::rect_stroke(
screen_rect,
Rounding::ZERO,
CornerRadius::ZERO,
Stroke::new(2.0, Color32::BLACK),
StrokeKind::Middle,
));
painter.text(
to_screen * selected_rect.min + vec2(4.0, 4.0),
Expand Down Expand Up @@ -308,13 +309,14 @@ impl FlameGraphWidget {
let screen_rect = to_screen.transform_rect(rect);
painter.add(Shape::rect_filled(
screen_rect,
Rounding::ZERO,
CornerRadius::ZERO,
node.bg_color,
));
painter.add(Shape::rect_stroke(
screen_rect,
Rounding::ZERO,
CornerRadius::ZERO,
Stroke::new(0.5, Color32::BLACK),
StrokeKind::Middle,
));

if width > MIN_TEXT_WIDTH {
Expand Down Expand Up @@ -548,17 +550,23 @@ impl FlameGraphWidget {
if is_focused {
painter.add(Shape::rect_stroke(
screen_rect,
Rounding::ZERO,
CornerRadius::ZERO,
Stroke::new(3.0, Color32::from_rgb(255, 215, 0)), // Gold color
StrokeKind::Middle,
));
}

painter.add(Shape::rect_filled(screen_rect, Rounding::ZERO, bg_color));
painter.add(Shape::rect_filled(
screen_rect,
CornerRadius::ZERO,
bg_color,
));

painter.add(Shape::rect_stroke(
screen_rect,
Rounding::ZERO,
CornerRadius::ZERO,
Stroke::new(0.5, Color32::BLACK),
StrokeKind::Middle,
));

if flame_width > MIN_TEXT_WIDTH {
Expand All @@ -574,12 +582,13 @@ impl FlameGraphWidget {
if let Some(hover_pos) = cursor_hover_pos {
if screen_rect.contains(hover_pos) {
let id = Id::new("flamegraph-tooltip");
show_tooltip_at_pointer(
ctx,
Tooltip::always_open(
ctx.clone(),
egui::LayerId::new(egui::Order::Tooltip, id),
id,
|ui: &mut Ui| self.draw_tooltip(ui, cfg, root, flame),
);
PopupAnchor::Pointer,
)
.show(|ui: &mut Ui| self.draw_tooltip(ui, cfg, root, flame));

if clicked && flame.weight >= 1 {
if ctrl_held {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/tabs/flamescope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ fn draw_heatmap(
[x, y + cell_height],
];

let polygon = Polygon::new(points)
let polygon = Polygon::new("", points)
.fill_color(color)
.stroke(egui::Stroke::NONE);

Expand All @@ -227,7 +227,7 @@ fn draw_heatmap(
[sel_start, MS_PER_SECOND as f64],
];

let overlay = Polygon::new(points)
let overlay = Polygon::new("", points)
.fill_color(Color32::from_rgba_unmultiplied(255, 255, 0, 50))
.stroke(egui::Stroke::new(2.0, Color32::YELLOW));

Expand Down
12 changes: 9 additions & 3 deletions src/ui/tabs/top_funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::ui::cached::Cached;
use crate::ui::util::{
clearable_line_edit, draw_heat_map, frame_kind_color, humanize_count, plot_color,
};
use egui::{Align, Color32, Layout, Sense, Stroke};
use egui::{Align, Color32, Layout, Sense, Stroke, StrokeKind};
use egui_extras::{Column, TableBuilder};
use egui_phosphor::regular as icons;
use nohash_hasher::IntSet;
Expand Down Expand Up @@ -193,7 +193,7 @@ fn draw_percent_column(ui: &mut Ui, perc: f32) {
rect.set_width(rect.width() * perc);
let painter = ui.painter_at(rect);
let color = ui.visuals().selection.bg_fill;
painter.rect(rect, 0.0, color, Stroke::NONE);
painter.rect(rect, 0.0, color, Stroke::NONE, StrokeKind::Middle);
}

let text = format!("{:.02}%", perc * 100.0);
Expand All @@ -208,7 +208,13 @@ fn draw_frame_type_square(ui: &mut Ui, kind: FrameKind) {
let size = [10.0, 10.0].into();
let (rect, _) = ui.allocate_exact_size(size, Sense::hover());
let painter = ui.painter_at(rect);
painter.rect(rect, 0.0, color, Stroke::new(1.0, stroke_color));
painter.rect(
rect,
0.0,
color,
Stroke::new(1.0, stroke_color),
StrokeKind::Middle,
);
}

/// Draw a heatmap visualizing when within the filter period the function was invoked.
Expand Down
2 changes: 1 addition & 1 deletion src/ui/tabs/trace_freq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl TraceFreqTab {
)
})
.show(ui, |pui| {
pui.bar_chart(BarChart::new(bars.clone()));
pui.bar_chart(BarChart::new("", bars.clone()));
pui.plot_bounds()
});
}
Expand Down
19 changes: 13 additions & 6 deletions src/ui/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// under the License.

use crate::storage::{FrameKind, InterpKind};
use eframe::emath::{Pos2, Rect, Vec2};
use eframe::epaint::{Color32, Stroke};
use eframe::emath::{GuiRounding as _, Pos2, Rect, Vec2};
use eframe::epaint::{Color32, Stroke, StrokeKind};
use egui::{Align2, Button, FontId, TextEdit, Ui};
use egui_phosphor::regular as icons;
use std::fmt;
Expand Down Expand Up @@ -154,7 +154,13 @@ where

let painter = ui.painter_at(rect);
let bg_stroke = ui.visuals().widgets.noninteractive.bg_stroke;
painter.rect(rect, 0.0, ui.visuals().extreme_bg_color, bg_stroke);
painter.rect(
rect,
0.0,
ui.visuals().extreme_bg_color,
bg_stroke,
StrokeKind::Middle,
);
rect = rect.shrink(bg_stroke.width);

let tile_size = Vec2::new(rect.width() / columns as f32, rect.height() / rows as f32);
Expand All @@ -170,12 +176,13 @@ where
rect.min.y + tile_size.y * row_idx as f32,
);

let ppp = painter.pixels_per_point();
let tile = Rect::from_min_max(
painter.round_pos_to_pixels(min),
painter.round_pos_to_pixels(min + tile_size),
min.round_to_pixels(ppp),
(min + tile_size).round_to_pixels(ppp),
);

painter.rect(tile, 0.0, color, Stroke::NONE);
painter.rect(tile, 0.0, color, Stroke::NONE, StrokeKind::Middle);
}
}
}
Expand Down